2006-06-15 04:19:30 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "MemoryView.h"
|
2007-02-20 21:16:34 +00:00
|
|
|
#include "string_cast.h"
|
2007-02-28 20:20:18 +00:00
|
|
|
#include "win32/GdiObj.h"
|
|
|
|
#include "win32/ClientDeviceContext.h"
|
2014-06-29 22:45:24 -04:00
|
|
|
#include "win32/DefaultWndClass.h"
|
2007-02-28 20:20:18 +00:00
|
|
|
#include "lexical_cast_ex.h"
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
#define XMARGIN 5
|
|
|
|
#define YMARGIN 5
|
|
|
|
#define YSPACE 0
|
|
|
|
#define BYTESPACING 3
|
2014-06-30 00:22:00 -04:00
|
|
|
#define LINESECTIONSPACING 10
|
2014-06-30 00:18:41 -04:00
|
|
|
#define ADDRESSCHARS 8
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-29 22:45:24 -04:00
|
|
|
CMemoryView::CMemoryView(HWND parentWnd, const RECT& rect)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2014-06-29 22:45:24 -04:00
|
|
|
Create(WS_EX_CLIENTEDGE, Framework::Win32::CDefaultWndClass::GetName(), _T(""), WS_VISIBLE | WS_VSCROLL | WS_CHILD, rect, parentWnd, NULL);
|
2006-06-15 04:19:30 +00:00
|
|
|
SetClassPtr();
|
|
|
|
|
|
|
|
UpdateScrollRange();
|
|
|
|
}
|
|
|
|
|
|
|
|
CMemoryView::~CMemoryView()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
HFONT CMemoryView::GetFont()
|
|
|
|
{
|
|
|
|
return (HFONT)GetStockObject(ANSI_FIXED_FONT);
|
|
|
|
}
|
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
void CMemoryView::ScrollToAddress(uint32 address)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
auto renderParams = GetRenderParams();
|
2006-06-15 04:19:30 +00:00
|
|
|
|
|
|
|
//Humm, nvm...
|
2014-06-30 00:18:41 -04:00
|
|
|
if(renderParams.bytesPerLine == 0) return;
|
|
|
|
if(address >= m_size) return;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
unsigned int line = (address / renderParams.bytesPerLine);
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-29 22:45:24 -04:00
|
|
|
SCROLLINFO si;
|
2006-06-15 04:19:30 +00:00
|
|
|
memset(&si, 0, sizeof(SCROLLINFO));
|
|
|
|
si.cbSize = sizeof(SCROLLINFO);
|
2014-06-30 00:18:41 -04:00
|
|
|
si.nPos = line;
|
2006-06-15 04:19:30 +00:00
|
|
|
si.fMask = SIF_POS;
|
|
|
|
SetScrollInfo(m_hWnd, SB_VERT, &si, TRUE);
|
|
|
|
|
|
|
|
Redraw();
|
|
|
|
}
|
|
|
|
|
2007-02-28 20:51:06 +00:00
|
|
|
uint32 CMemoryView::GetSelection()
|
|
|
|
{
|
2014-06-29 22:45:24 -04:00
|
|
|
return m_selectionStart;
|
2007-02-28 20:51:06 +00:00
|
|
|
}
|
|
|
|
|
2006-06-15 04:19:30 +00:00
|
|
|
void CMemoryView::UpdateScrollRange()
|
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
auto renderParams = GetRenderParams();
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
unsigned int totalLines = 0;
|
|
|
|
if(renderParams.bytesPerLine != 0)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
totalLines = (m_size / renderParams.bytesPerLine);
|
|
|
|
if((m_size % renderParams.bytesPerLine) != 0) totalLines++;
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
totalLines = 0;
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
//Render params always compensate for partially visible lines
|
|
|
|
unsigned int totallyVisibleLines = renderParams.lines - 1;
|
|
|
|
|
2014-06-29 22:45:24 -04:00
|
|
|
SCROLLINFO si;
|
2006-06-15 04:19:30 +00:00
|
|
|
memset(&si, 0, sizeof(SCROLLINFO));
|
|
|
|
si.cbSize = sizeof(SCROLLINFO);
|
|
|
|
si.nMin = 0;
|
2014-06-30 00:18:41 -04:00
|
|
|
if(totalLines <= totallyVisibleLines)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
|
|
|
si.nMax = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
si.nMax = totalLines - totallyVisibleLines;
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
si.fMask = SIF_RANGE | SIF_DISABLENOSCROLL;
|
|
|
|
SetScrollInfo(m_hWnd, SB_VERT, &si, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int CMemoryView::GetScrollOffset()
|
|
|
|
{
|
|
|
|
SCROLLINFO si;
|
|
|
|
memset(&si, 0, sizeof(SCROLLINFO));
|
|
|
|
si.cbSize = sizeof(SCROLLINFO);
|
|
|
|
si.fMask = SIF_POS;
|
|
|
|
GetScrollInfo(m_hWnd, SB_VERT, &si);
|
|
|
|
return si.nPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int CMemoryView::GetScrollThumbPosition()
|
|
|
|
{
|
|
|
|
SCROLLINFO si;
|
|
|
|
memset(&si, 0, sizeof(SCROLLINFO));
|
|
|
|
si.cbSize = sizeof(SCROLLINFO);
|
|
|
|
si.fMask = SIF_TRACKPOS;
|
|
|
|
GetScrollInfo(m_hWnd, SB_VERT, &si);
|
|
|
|
return si.nTrackPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryView::Paint(HDC hDC)
|
|
|
|
{
|
2014-06-29 22:45:24 -04:00
|
|
|
Framework::Win32::CDeviceContext deviceContext(hDC);
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2013-04-29 04:53:49 +00:00
|
|
|
RECT rwin = GetClientRect();
|
2014-06-29 22:45:24 -04:00
|
|
|
BitBlt(deviceContext, 0, 0, rwin.right, rwin.bottom, NULL, 0, 0, WHITENESS);
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-29 22:45:24 -04:00
|
|
|
Framework::Win32::CFont font(GetFont());
|
|
|
|
deviceContext.SelectObject(font);
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
SIZE fontSize = deviceContext.GetFontSize(font);
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
auto renderParams = GetRenderParams();
|
2014-06-29 22:45:24 -04:00
|
|
|
unsigned int nY = YMARGIN;
|
2014-06-30 00:18:41 -04:00
|
|
|
uint32 address = renderParams.address;
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
for(unsigned int i = 0; i < renderParams.lines; i++)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
if(address >= m_size)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2014-06-30 00:18:41 -04:00
|
|
|
|
|
|
|
unsigned int bytesForCurrentLine = renderParams.bytesPerLine;
|
|
|
|
if((address + bytesForCurrentLine) >= m_size)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
bytesForCurrentLine = (m_size - address);
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
|
2014-06-29 22:45:24 -04:00
|
|
|
unsigned int nX = XMARGIN;
|
2014-06-30 00:18:41 -04:00
|
|
|
deviceContext.TextOut(nX, nY, lexical_cast_hex<std::tstring>(address, ADDRESSCHARS).c_str());
|
|
|
|
nX += (ADDRESSCHARS * fontSize.cx) + LINESECTIONSPACING;
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
for(unsigned int j = 0; j < bytesForCurrentLine; j++)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
deviceContext.TextOut(nX, nY, lexical_cast_hex<std::tstring>(GetByte(address + j), 2).c_str());
|
|
|
|
nX += (2 * fontSize.cx) + BYTESPACING;
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
2014-06-30 00:18:41 -04:00
|
|
|
//Compensate for incomplete lines (when bytesForCurrentLine < bytesPerLine)
|
|
|
|
nX += (renderParams.bytesPerLine - bytesForCurrentLine) * (2 * fontSize.cx + BYTESPACING);
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
nX += LINESECTIONSPACING;
|
2006-06-15 04:19:30 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
for(unsigned int j = 0; j < bytesForCurrentLine; j++)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
uint8 nValue = GetByte(address + j);
|
2006-06-15 04:19:30 +00:00
|
|
|
if(nValue < 0x20 || nValue > 0x7F)
|
|
|
|
{
|
|
|
|
nValue = '.';
|
|
|
|
}
|
2014-06-30 00:18:41 -04:00
|
|
|
|
|
|
|
char sValue[2];
|
2006-06-15 04:19:30 +00:00
|
|
|
sValue[0] = nValue;
|
|
|
|
sValue[1] = 0x00;
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-29 22:45:24 -04:00
|
|
|
deviceContext.TextOut(nX, nY, string_cast<std::tstring>(sValue).c_str());
|
2014-06-30 00:18:41 -04:00
|
|
|
nX += fontSize.cx;
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
nY += (fontSize.cy + YSPACE);
|
|
|
|
address += bytesForCurrentLine;
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryView::SetMemorySize(uint32 nSize)
|
|
|
|
{
|
2014-06-29 22:45:24 -04:00
|
|
|
m_size = nSize;
|
2006-06-15 04:19:30 +00:00
|
|
|
UpdateScrollRange();
|
|
|
|
}
|
|
|
|
|
|
|
|
long CMemoryView::OnVScroll(unsigned int nType, unsigned int nTrackPos)
|
|
|
|
{
|
|
|
|
SCROLLINFO si;
|
2014-06-29 22:45:24 -04:00
|
|
|
int nOffset = (int)GetScrollOffset();
|
2006-06-15 04:19:30 +00:00
|
|
|
switch(nType)
|
|
|
|
{
|
|
|
|
case SB_LINEDOWN:
|
|
|
|
nOffset++;
|
|
|
|
break;
|
|
|
|
case SB_LINEUP:
|
|
|
|
nOffset--;
|
|
|
|
break;
|
|
|
|
case SB_PAGEDOWN:
|
|
|
|
nOffset += 10;
|
|
|
|
break;
|
|
|
|
case SB_PAGEUP:
|
|
|
|
nOffset -= 10;
|
|
|
|
break;
|
|
|
|
case SB_THUMBPOSITION:
|
|
|
|
case SB_THUMBTRACK:
|
|
|
|
nOffset = GetScrollThumbPosition();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&si, 0, sizeof(SCROLLINFO));
|
|
|
|
si.cbSize = sizeof(SCROLLINFO);
|
|
|
|
si.nPos = nOffset;
|
|
|
|
si.fMask = SIF_POS;
|
|
|
|
SetScrollInfo(m_hWnd, SB_VERT, &si, TRUE);
|
|
|
|
|
2013-05-19 05:34:56 +00:00
|
|
|
UpdateCaretPosition();
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2006-06-15 04:19:30 +00:00
|
|
|
Redraw();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
long CMemoryView::OnSize(unsigned int nType, unsigned int nX, unsigned int nY)
|
|
|
|
{
|
|
|
|
UpdateScrollRange();
|
2013-05-19 05:34:56 +00:00
|
|
|
UpdateCaretPosition();
|
2006-06-15 04:19:30 +00:00
|
|
|
CCustomDrawn::OnSize(nType, nX, nY);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
long CMemoryView::OnSetFocus()
|
|
|
|
{
|
2014-06-29 22:45:24 -04:00
|
|
|
Framework::Win32::CClientDeviceContext deviceContext(m_hWnd);
|
|
|
|
Framework::Win32::CFont font(GetFont());
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-29 22:45:24 -04:00
|
|
|
CreateCaret(m_hWnd, NULL, 2, deviceContext.GetFontHeight(font));
|
2013-05-19 05:34:56 +00:00
|
|
|
ShowCaret(m_hWnd);
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2013-05-19 05:34:56 +00:00
|
|
|
UpdateCaretPosition();
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2013-05-19 05:34:56 +00:00
|
|
|
Redraw();
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2006-06-15 04:19:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2007-02-28 20:20:18 +00:00
|
|
|
long CMemoryView::OnKillFocus()
|
|
|
|
{
|
2013-05-19 05:34:56 +00:00
|
|
|
HideCaret(m_hWnd);
|
|
|
|
DestroyCaret();
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2013-05-19 05:34:56 +00:00
|
|
|
return FALSE;
|
2007-02-28 20:20:18 +00:00
|
|
|
}
|
|
|
|
|
2013-05-19 05:34:56 +00:00
|
|
|
long CMemoryView::OnMouseWheel(int x, int y, short z)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2013-05-19 05:34:56 +00:00
|
|
|
if(z < 0)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
|
|
|
OnVScroll(SB_LINEDOWN, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OnVScroll(SB_LINEUP, 0);
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-07-09 00:45:09 +00:00
|
|
|
long CMemoryView::OnLeftButtonDown(int nX, int nY)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
|
|
|
SetFocus();
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-02-28 20:20:18 +00:00
|
|
|
|
|
|
|
long CMemoryView::OnLeftButtonUp(int nX, int nY)
|
|
|
|
{
|
2014-06-29 22:45:24 -04:00
|
|
|
SIZE fontSize = Framework::Win32::CClientDeviceContext(m_hWnd).GetFontSize(Framework::Win32::CFont(GetFont()));
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-04-23 02:47:24 +00:00
|
|
|
nY -= YMARGIN;
|
2014-06-30 00:18:41 -04:00
|
|
|
nX -= XMARGIN + (ADDRESSCHARS * fontSize.cx) + LINESECTIONSPACING;
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-04-23 02:47:24 +00:00
|
|
|
if(nY < 0) return FALSE;
|
|
|
|
if(nX < 0) return FALSE;
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
unsigned int selectedLine = nY / (fontSize.cy + YSPACE);
|
|
|
|
unsigned int selectedByte = nX / ((2 * fontSize.cx) + BYTESPACING);
|
2014-06-29 22:45:24 -04:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
auto renderParams = GetRenderParams();
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
if(selectedByte >= renderParams.bytesPerLine) return FALSE;
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
SetSelectionStart(renderParams.address + selectedByte + (selectedLine * renderParams.bytesPerLine));
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-04-23 02:47:24 +00:00
|
|
|
return FALSE;
|
2007-02-28 20:20:18 +00:00
|
|
|
}
|
|
|
|
|
2014-04-23 02:47:24 +00:00
|
|
|
long CMemoryView::OnKeyDown(WPARAM nKey, LPARAM)
|
2007-02-28 20:20:18 +00:00
|
|
|
{
|
2014-04-23 02:47:24 +00:00
|
|
|
switch(nKey)
|
|
|
|
{
|
|
|
|
case VK_RIGHT:
|
2014-06-29 22:45:24 -04:00
|
|
|
SetSelectionStart(m_selectionStart + 1);
|
2014-04-23 02:47:24 +00:00
|
|
|
break;
|
|
|
|
case VK_LEFT:
|
2014-06-29 22:45:24 -04:00
|
|
|
SetSelectionStart(m_selectionStart - 1);
|
2014-04-23 02:47:24 +00:00
|
|
|
break;
|
|
|
|
case VK_UP:
|
|
|
|
case VK_DOWN:
|
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
auto renderParams = GetRenderParams();
|
|
|
|
SetSelectionStart(m_selectionStart + ((nKey == VK_UP) ? (-static_cast<int>(renderParams.bytesPerLine)) : (renderParams.bytesPerLine)));
|
2014-04-23 02:47:24 +00:00
|
|
|
}
|
2014-06-30 00:18:41 -04:00
|
|
|
break;
|
2014-04-23 02:47:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2007-02-28 20:20:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryView::SetSelectionStart(unsigned int nNewAddress)
|
|
|
|
{
|
2013-04-29 04:53:49 +00:00
|
|
|
if(static_cast<int>(nNewAddress) < 0) return;
|
2014-06-29 22:45:24 -04:00
|
|
|
if(nNewAddress >= m_size) return;
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-29 22:45:24 -04:00
|
|
|
m_selectionStart = nNewAddress;
|
2013-04-29 04:53:49 +00:00
|
|
|
UpdateCaretPosition();
|
2014-06-29 22:45:24 -04:00
|
|
|
OnSelectionChange(m_selectionStart);
|
2007-02-28 20:20:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryView::UpdateCaretPosition()
|
|
|
|
{
|
2014-06-29 22:45:24 -04:00
|
|
|
Framework::Win32::CClientDeviceContext deviceContext(m_hWnd);
|
|
|
|
Framework::Win32::CFont font(GetFont());
|
|
|
|
SIZE fontSize(deviceContext.GetFontSize(font));
|
2014-06-30 00:18:41 -04:00
|
|
|
auto renderParams = GetRenderParams();
|
2013-04-29 04:53:49 +00:00
|
|
|
if(
|
2014-06-30 00:18:41 -04:00
|
|
|
(renderParams.bytesPerLine != 0) &&
|
|
|
|
(m_selectionStart >= renderParams.address) &&
|
|
|
|
(m_selectionStart <= (renderParams.address + (renderParams.lines * renderParams.bytesPerLine)))
|
2013-04-29 04:53:49 +00:00
|
|
|
)
|
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
unsigned int selectionStart = m_selectionStart - renderParams.address;
|
|
|
|
int nX = XMARGIN + (ADDRESSCHARS * fontSize.cx) + LINESECTIONSPACING + (selectionStart % renderParams.bytesPerLine) * ((2 * fontSize.cx) + BYTESPACING);
|
|
|
|
int nY = YMARGIN + (fontSize.cy + YSPACE) * (selectionStart / renderParams.bytesPerLine);
|
2013-04-29 04:53:49 +00:00
|
|
|
SetCaretPos(nX, nY);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetCaretPos(-20, -20);
|
|
|
|
}
|
2007-02-28 20:20:18 +00:00
|
|
|
}
|
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
CMemoryView::RENDERPARAMS CMemoryView::GetRenderParams()
|
2007-02-28 20:20:18 +00:00
|
|
|
{
|
2014-06-30 00:18:41 -04:00
|
|
|
Framework::Win32::CClientDeviceContext deviceContext(m_hWnd);
|
|
|
|
Framework::Win32::CFont font(GetFont());
|
|
|
|
SIZE fontSize(deviceContext.GetFontSize(font));
|
|
|
|
|
|
|
|
RENDERPARAMS renderParams;
|
|
|
|
|
2014-06-29 22:45:24 -04:00
|
|
|
RECT clientRect(GetClientRect());
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
renderParams.lines = (clientRect.bottom - (YMARGIN * 2)) / (fontSize.cy + YSPACE);
|
|
|
|
renderParams.lines++;
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
//lineSize = (2 * XMARGIN) + (2 * LINESECTIONSPACING) + (ADDRESSCHARS * cx) + bytesPerLine * (2 * cx + BYTESPACING) + bytesPerLine * cx
|
|
|
|
renderParams.bytesPerLine = clientRect.right - (2 * XMARGIN) - (2 * LINESECTIONSPACING) - (ADDRESSCHARS * fontSize.cx);
|
|
|
|
renderParams.bytesPerLine /= ((2 * fontSize.cx + BYTESPACING) + (fontSize.cx));
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
renderParams.address = GetScrollOffset() * renderParams.bytesPerLine;
|
2007-02-28 20:20:18 +00:00
|
|
|
|
2014-06-30 00:18:41 -04:00
|
|
|
return renderParams;
|
2007-02-28 20:20:18 +00:00
|
|
|
}
|