Merge pull request #2022 from vgturtle127/beautification-7

Beautification 7 - Source/Project64/UserInterface/WTLControls
This commit is contained in:
zilmar 2021-03-23 12:45:29 +10:30 committed by GitHub
commit 04e2263354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 307 additions and 319 deletions

View File

@ -28,6 +28,7 @@
// template class helpers with functions for comparing elements
// override if using complex types without operator==
template <class T>
class CListCtrlArrayEqualHelper
{
@ -182,7 +183,7 @@ public:
if(TEqual::IsEqual(m_aT[i], t))
return i;
}
return -1; // not found
return -1; // Not found
}
BOOL SetAtIndex(int nIndex, const T& t)

View File

@ -1,4 +1,3 @@
#pragma once
#include <vector>
#include <shlobj.h>
@ -426,11 +425,11 @@ public:
if ( m_bAllowDrop )
{
// store drag data for later use in DragOver
// Store drag data for later use in DragOver
m_FormatEtc = m_vFormatEtc[ nFormatEtc ];
m_StgMedium = StgMedium;
// get client cursor position
// Get client cursor position
CWindow hWnd( m_hTargetWnd );
CPoint point( pt.x, pt.y );
hWnd.ScreenToClient( &point );
@ -453,7 +452,7 @@ public:
if ( m_bAllowDrop && m_FormatEtc.cfFormat != CF_NULL && m_StgMedium.tymed != TYMED_NULL )
{
// get client cursor position
// Get client cursor position
CWindow hWnd( m_hTargetWnd );
CPoint point( pt.x, pt.y );
hWnd.ScreenToClient( &point );
@ -496,7 +495,7 @@ public:
STGMEDIUM StgMedium;
if ( pDataObject->GetData( &m_FormatEtc, &StgMedium ) == S_OK )
{
// get client cursor position
// Get client cursor position
CWindow hWnd( m_hTargetWnd );
CPoint point( pt.x, pt.y );
hWnd.ScreenToClient( &point );
@ -681,11 +680,11 @@ public:
{
m_hTargetWnd = pDelegate->m_hWnd;
// instantiate new drop target object
// Instantiate new drop target object
m_pDropTarget = new CDropTargetT< T >( m_hTargetWnd );
m_pDropTarget->Register( pDelegate );
// register drop target
// Register drop target
if ( FAILED( RegisterDragDrop( m_hTargetWnd, m_pDropTarget ) ) )
{
delete m_pDropTarget;
@ -693,18 +692,18 @@ public:
return FALSE;
}
// is this a drop target only?
// Is this a drop target only?
if ( !bDropSource )
return TRUE;
// instantiate new drop source object
// Instantiate new drop source object
m_pDropSource = new CDropSource;
m_pDropSource->AddRef();
m_pDataObject = new CDataObjectT< T >( m_pDropSource );
m_pDataObject->AddRef();
// register drop source delegate for data render
// Register drop source delegate for data render
return m_pDataObject->Register( pDelegate );
}
@ -764,7 +763,7 @@ public:
IDragSourceHelper *pDragSourceHelper = NULL;
// instantiate drag source helper object
// Instantiate drag source helper object
if ( pDragImage != NULL )
{
if ( FAILED( CoCreateInstance( CLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER, IID_IDragSourceHelper, (LPVOID*)&pDragSourceHelper ) ) )
@ -777,7 +776,7 @@ public:
DWORD dwEffects = DROPEFFECT_NONE;
dwEffects = ::DoDragDrop( m_pDataObject, m_pDropSource, dwValidEffects, &dwEffects ) == DRAGDROP_S_DROP ? DROPEFFECT_NONE : dwEffects;
// destroy drag source helper object
// Destroy drag source helper object
if ( pDragSourceHelper != NULL )
pDragSourceHelper->Release();

View File

@ -1,4 +1,3 @@
#pragma once
#include "ListTypes.h"
#include <wtl/atlcrack.h>
@ -49,7 +48,7 @@ public:
m_rgbStaticBackground = GetSysColor( COLOR_HIGHLIGHT );
m_rgbStaticText = GetSysColor( COLOR_HIGHLIGHTTEXT );
// destroy old combo control...
// Destroy old combo control
if ( IsWindow() )
DestroyWindow();
@ -63,12 +62,12 @@ public:
if ( nFlags & ITEM_FLAGS_EDIT_UPPER )
dwStyle |= CBS_UPPERCASE;
// create combo control
// Create combo control
CRect Area( ( ( dwStyle & CBS_DROPDOWNLIST ) == CBS_DROPDOWNLIST ) ? rcRect.left + 3 : rcRect.left + 1, rcRect.top, rcRect.right, rcRect.bottom + ( 6 * rcRect.Height() ) );
if ( CWindowImpl< CListCombo, CComboBox >::Create( hWndParent, Area, NULL, dwStyle ) == NULL )
return FALSE;
// get system message font
// Get system message font
CLogFont logFont;
logFont.SetMessageBoxFont();
if ( !m_fntComboFont.IsNull() )
@ -77,7 +76,7 @@ public:
return FALSE;
SetFont( m_fntComboFont, FALSE );
// subclass edit control to capture keyboard input
// Subclass edit control to capture keyboard input
HWND hEditControl = GetWindow( GW_CHILD );
if ( hEditControl != NULL )
m_wndEditCtrl.SubclassWindow( hEditControl );
@ -97,25 +96,25 @@ public:
SetEditSel( 0, -1 );
}
// set static edit height
// Set static edit height
SetItemHeight( -1, rcRect.Height() - 6 );
COMBOBOXINFO infoComboBox = { sizeof( COMBOBOXINFO ) };
if ( !::GetComboBoxInfo( m_hWnd, &infoComboBox ) )
return FALSE;
// store combobox details for painting
// Store combo box details for painting
m_rcStatic = infoComboBox.rcItem;
m_rcButton = infoComboBox.rcButton;
m_rcButton.DeflateRect( 0, 1 );
m_rcButton.OffsetRect( -2, 0 );
// show combo control
// Show combo control
ShowWindow( SW_SHOW );
SetFocus();
// force redraw now
// Force redraw now
RedrawWindow();
return TRUE;
@ -123,7 +122,7 @@ public:
BOOL IsValid( TCHAR nChar )
{
// validate number and float input
// Validate number and float input
if ( !( m_nFlags & ( ITEM_FLAGS_EDIT_NUMBER | ITEM_FLAGS_EDIT_FLOAT ) ) || nChar == VK_BACK )
return TRUE;
@ -132,12 +131,12 @@ public:
strValue.reserve(nValueLength);
GetWindowText( (wchar_t *)strValue.c_str(), nValueLength );
// get selected positions
// Get selected positions
DWORD dwSelection = GetEditSel();
int nStartChar = LOWORD( dwSelection );
int nEndChar = HIWORD( dwSelection );
// are we changing the sign?
// Are we changing the sign?
if ( ( m_nFlags & ITEM_FLAGS_EDIT_NEGATIVE ) && nChar == _T( '-' ) )
{
BOOL bNegative = FALSE;
@ -156,12 +155,12 @@ public:
SetWindowText( strValue.c_str() );
// restore select position
// Restore select position
SetEditSel( bNegative ? nStartChar - 1 : nStartChar + 1, bNegative ? nEndChar - 1 : nEndChar + 1 );
return FALSE;
}
// construct new value string using entered character
// Construct new value string using entered character
std::wstring strNewValue = strValue.substr(0, nStartChar ) + nChar + strValue.substr(nEndChar, strValue.length() - nEndChar );
int nGreaterThan = 0;
@ -210,18 +209,18 @@ public:
break;
}
// invalid if text contains more than one '>', '<', '=' or '.'
// Invalid if text contains more than one '>', '<', '=' or '.'
if ( nGreaterThan > 1 || nLessThan > 1 || nEquals > 1 || nDecimalPoint > 1 )
return FALSE;
}
// invalid if text contains '=>' or '=<'
// Invalid if text contains '=>' or '=<'
if ( nGreaterIndex != -1 && nEqualIndex != -1 && nGreaterIndex > nEqualIndex )
return FALSE;
if ( nLessIndex != -1 && nEqualIndex != -1 && nLessIndex > nEqualIndex )
return FALSE;
// invalid if digits exist before operator
// Invalid if digits exist before operator
if ( nDigitIndex != -1 && nGreaterIndex != -1 && nGreaterIndex > nDigitIndex )
return FALSE;
if ( nDigitIndex != -1 && nLessIndex != -1 && nLessIndex > nDigitIndex )
@ -263,11 +262,11 @@ public:
trkMouse.dwFlags = TME_LEAVE;
trkMouse.hwndTrack = m_hWnd;
// notify when the mouse leaves button
// Notify when the mouse leaves button
_TrackMouseEvent( &trkMouse );
}
// do not show button as pressed when first created
// Do not show button as pressed when first created
m_bActivate = TRUE;
InvalidateRect( m_rcButton );
@ -301,13 +300,13 @@ public:
int nContextState = dcMemory.SaveDC();
// do not repaint background if drawing button only
// Do not repaint background if drawing button only
if ( !rcClip.EqualRect( m_rcButton ) )
{
CWindow wndParent( GetParent() );
if ( wndParent.IsWindow() )
{
// draw background from parent
// Draw background from parent
CPoint ptOrigin( 0 );
MapWindowPoints( wndParent, &ptOrigin, 1 );
dcMemory.OffsetWindowOrg( ptOrigin.x, ptOrigin.y, &ptOrigin );
@ -329,7 +328,7 @@ public:
dcMemory.SetBkColor( m_rgbStaticBackground );
dcMemory.ExtTextOut( m_rcStatic.left, m_rcStatic.top, ETO_OPAQUE, m_rcStatic, _T( "" ), 0, NULL );
// draw static text
// Draw static text
int nIndex = GetCurSel();
if ( nIndex != CB_ERR )
{
@ -353,7 +352,7 @@ public:
}
}
// draw drop down button
// Draw drop down button
dcMemory.DrawFrameControl( m_rcButton, DFC_SCROLL, DFCS_SCROLLDOWN | ( bPressed ? DFCS_FLAT | DFCS_PUSHED : 0 ) );
dcMemory.RestoreDC( nContextState );
@ -402,7 +401,7 @@ public:
listNotify.m_lpszItemText = strValue.c_str();
listNotify.m_lpItemDate = NULL;
// forward notification to parent
// Forward notification to parent
FORWARD_WM_NOTIFY( wndParent, listNotify.m_hdrNotify.idFrom, &listNotify.m_hdrNotify, ::SendMessage );
}

View File

@ -1,4 +1,3 @@
#pragma once
#include "ListTypes.h"
@ -35,7 +34,7 @@ public:
m_nFlags = nFlags;
m_nExitChar = 0;
// destroy old date control...
// Destroy old date control
if ( IsWindow() )
DestroyWindow();
@ -47,15 +46,15 @@ public:
if ( nFlags & ITEM_FLAGS_TIME_ONLY )
dwStyle |= DTS_UPDOWN;
// create date-time control
// Create date-time control
CRect Area( rcRect.left + 3, rcRect.top + 2, rcRect.right - 3, rcRect.bottom - 2 );
if ( CWindowImpl< CListDate, CDateTimePickerCtrl >::Create( hWndParent, Area, NULL, dwStyle ) == NULL )
return FALSE;
// remove border
// Remove border
ModifyStyleEx( WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED );
// get system message font
// Get system message font
CLogFont logFont;
logFont.SetMessageBoxFont();
if ( !m_fntDateFont.IsNull() )
@ -78,7 +77,7 @@ public:
else
SetFormat(stdstr_f("%s %s",szDateFormat,szTimeFormat ).ToUTF16().c_str());
// get current date if setting time-only
// Get current date if setting time-only
if ( nFlags & ITEM_FLAGS_TIME_ONLY )
{
SYSTEMTIME stCurrentDate;
@ -92,7 +91,7 @@ public:
SetSystemTime( ( !( nFlags & ITEM_FLAGS_TIME_ONLY ) && stItemDate.wYear == 0 ) ? GDT_NONE : GDT_VALID, &stItemDate );
// show date-time control
// Show date-time control
ShowWindow( SW_SHOW );
SetFocus();
@ -110,15 +109,15 @@ public:
void OnKillFocus( HWND hNewWnd )
{
// have we dropped down the calendar control?
// Have we dropped down the calendar control?
if ( hNewWnd != NULL && GetMonthCal() == hNewWnd )
return;
// have we selected a new date from the calendar control?
// Have we selected a new date from the calendar control?
if ( GetFocus() == m_hWnd )
return;
// hide calendar control in case it's not closed by losing focus
// Hide calendar control in case it's not closed by losing focus
if ( GetMonthCal().IsWindow() )
GetMonthCal().ShowWindow( SW_HIDE );
@ -156,7 +155,7 @@ public:
listNotify.m_lpszItemText = bValidDate ? _T( "1" ) : _T( "0" );
listNotify.m_lpItemDate = &stItemDate;
// forward notification to parent
// Forward notification to parent
FORWARD_WM_NOTIFY( wndParent, listNotify.m_hdrNotify.idFrom, &listNotify.m_hdrNotify, ::SendMessage );
}

View File

@ -1,4 +1,3 @@
#pragma once
#include "ListTypes.h"
@ -35,25 +34,25 @@ public:
m_nExitChar = 0;
m_nMaxLen = nMaxLen;
// destroy old edit control...
// Destroy old edit control
if ( IsWindow() )
DestroyWindow();
DWORD dwStyle = WS_CHILD | ES_AUTOHSCROLL | WS_BORDER;
// right-justify numbers
// Right-justify numbers
if ( nFlags & ( ITEM_FLAGS_EDIT_NUMBER | ITEM_FLAGS_EDIT_FLOAT ) )
dwStyle |= ES_RIGHT;
if ( nFlags & ITEM_FLAGS_EDIT_UPPER )
dwStyle |= ES_UPPERCASE;
// create edit control
// Create edit control
CRect Area( rcRect.left - 2, rcRect.top - 3, rcRect.right + 3, rcRect.bottom + 2 );
if ( CWindowImpl< CListEdit, CEdit >::Create( hWndParent, Area, NULL, dwStyle ) == NULL )
return FALSE;
// get system message font
// Get system message font
CLogFont logFont;
logFont.SetMessageBoxFont();
if ( !m_fntEditFont.IsNull() )
@ -65,7 +64,7 @@ public:
SetMargins( ITEM_EDIT_MARGIN, ITEM_EDIT_MARGIN );
SetWindowText( lpszItemText );
// show edit control
// Show edit control
ShowWindow( SW_SHOW );
SetSelAll();
@ -76,7 +75,7 @@ public:
BOOL IsValid( TCHAR nChar )
{
// validate number and float input
// Validate number and float input
if ( !( m_nFlags & ( ITEM_FLAGS_EDIT_HEX | ITEM_FLAGS_EDIT_NUMBER | ITEM_FLAGS_EDIT_FLOAT ) ) || nChar == VK_BACK )
return TRUE;
@ -88,7 +87,7 @@ public:
WindowText.resize(nValueLength);
GetWindowTextW((wchar_t *)WindowText.c_str(), nValueLength + 1);
}
// get selected positions
// Get selected positions
int nStartChar;
int nEndChar;
GetSel( nStartChar, nEndChar );
@ -100,7 +99,7 @@ public:
return FALSE;
}
}
// are we changing the sign?
// Are we changing the sign?
if ( ( m_nFlags & ITEM_FLAGS_EDIT_NEGATIVE ) && nChar == _T( '-' ) )
{
BOOL bNegative = FALSE;
@ -119,12 +118,12 @@ public:
SetWindowText(WindowText.c_str());
// restore select position
// Restore select position
SetSel( bNegative ? nStartChar - 1 : nStartChar + 1, bNegative ? nEndChar - 1 : nEndChar + 1 );
return FALSE;
}
// construct new value string using entered character
// Construct new value string using entered character
std::wstring strNewValue = WindowText.substr(0, nStartChar ) + nChar + WindowText.substr(WindowText.length() - nEndChar );
int nGreaterThan = 0;
@ -183,18 +182,18 @@ public:
break;
}
// invalid if text contains more than one '>', '<', '=' or '.'
// Invalid if text contains more than one '>', '<', '=' or '.'
if ( nGreaterThan > 1 || nLessThan > 1 || nEquals > 1 || nDecimalPoint > 1 )
return FALSE;
}
// invalid if text contains '=>' or '=<'
// Invalid if text contains '=>' or '=<'
if ( nGreaterIndex != -1 && nEqualIndex != -1 && nGreaterIndex > nEqualIndex )
return FALSE;
if ( nLessIndex != -1 && nEqualIndex != -1 && nLessIndex > nEqualIndex )
return FALSE;
// invalid if digits exist before operator
// Invalid if digits exist before operator
if ( nDigitIndex != -1 && nGreaterIndex != -1 && nGreaterIndex > nDigitIndex )
return FALSE;
if ( nDigitIndex != -1 && nLessIndex != -1 && nLessIndex > nDigitIndex )
@ -234,7 +233,7 @@ public:
listNotify.m_lpszItemText = strValue.c_str();
listNotify.m_lpItemDate = NULL;
// forward notification to parent
// Forward notification to parent
FORWARD_WM_NOTIFY( wndParent, listNotify.m_hdrNotify.idFrom, &listNotify.m_hdrNotify, ::SendMessage );
}

View File

@ -1,4 +1,3 @@
#pragma once
#include "DataArray.h"

View File

@ -45,12 +45,12 @@ public:
if ( CWindowImpl< CTitleTip >::Create( hWndParent, Area, NULL, WS_POPUP, WS_EX_TOOLWINDOW | WS_EX_TOPMOST ) == NULL )
return FALSE;
// create the tooltip
// Create the tooltip
if ( !m_ttToolTip.Create( m_hWnd ) )
return FALSE;
m_ttToolTip.SetMaxTipWidth( SHRT_MAX );
// get system message font
// Get system message font
WTL::CLogFont logFont;
logFont.SetMessageBoxFont();
if ( !m_fntTitleFont.IsNull() )
@ -75,12 +75,12 @@ public:
CRect rcTextExtent( rcRect );
// calculate item text extent...
// Calculate item text extent
dcClient.DrawTextW( strItemText.ToUTF16().c_str(), (int)strItemText.length(), rcTextExtent, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_CALCRECT );
dcClient.SelectFont( hOldFont );
// do not show titletip if entire text is visible
// Do not show title tip if entire text is visible
if ( rcTextExtent.Width() <= rcRect.Width() - 1 )
return FALSE;
@ -92,7 +92,7 @@ public:
m_ttToolTip.AddTool( m_hWnd, (LPCTSTR)m_strToolTip. substr(0,SHRT_MAX).c_str() );
}
// show titletip at new location
// Show title tip at new location
if ( !SetWindowPos( NULL, rcRect.left - 4, rcRect.top, rcTextExtent.Width() + 11, rcRect.Height(), SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOCOPYBITS ) )
return FALSE;
@ -147,7 +147,7 @@ public:
CWindow wndParent( m_hWndParent );
UINT nHitTest = (UINT)wndParent.SendMessage( WM_NCHITTEST, 0, MAKELPARAM( ptMouse.x, ptMouse.y ) );
// forward notifcation through to parent
// Forward notification through to parent
if ( nHitTest == HTCLIENT )
{
wndParent.ScreenToClient( &ptMouse );

View File

@ -31,7 +31,7 @@ bool CEditNumber32::IsHexConvertableText(LPTSTR _text)
}
}
if (!bPaste) { return bPaste; }
//Check
// Check
unsigned int i = 0;
if (wcslen(_text) >= 2)
{
@ -133,7 +133,7 @@ LRESULT CEditNumber32::OnValidateValue(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
LRESULT CEditNumber32::OnPaste(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
//Paste
// Paste
bHandled = false;
if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
@ -151,7 +151,7 @@ LRESULT CEditNumber32::OnPaste(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam
if (hglb != NULL)
{
LPTSTR lptstr = (LPTSTR)GlobalLock(hglb);
//Check invalid hex string
// Check invalid hex string
if (!IsHexConvertableText(lptstr))
{
bHandled = true;
@ -194,7 +194,7 @@ LRESULT CEditNumber32::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
{
if (wParam == 8 && (second == L'x' || second == L'X') && head == L'0' && end == 1)
{
//does not allow to delete '0' before x
// Does not allow to delete '0' before x
bHandled = true;
}
else {
@ -205,7 +205,7 @@ LRESULT CEditNumber32::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
if (second == L'x' || second == L'X')
{
//does not allow to change head except select includes first and second
// Does not allow to change head except select includes first and second
if (start <= 1 && end <= 1)
{
bHandled = true;
@ -338,4 +338,4 @@ void CEditNumber32::SetValue(uint32_t Value, DisplayMode Display)
text.Format("%s%0*X",(Display & DisplayMode::ShowHexIdent) == DisplayMode::ShowHexIdent ? "0x" : "", (Display & DisplayMode::ZeroExtend) == DisplayMode::ZeroExtend ? 8 : 0, Value);
}
SetWindowText(text.ToUTF16().c_str());
}
}

View File

@ -13,4 +13,4 @@ std::string GetCWindowText(const CWindow & window)
WindowText.resize(nLen + 1);
window.GetWindowText((wchar_t *)WindowText.c_str(), nLen + 1);
return stdstr().FromUTF16(WindowText.c_str());
}
}

View File

@ -2,4 +2,3 @@
#include <string>
std::string GetCWindowText(const CWindow & window);

View File

@ -205,7 +205,7 @@ void CHexEditCtrl::Draw(void)
m_bShowHotAddress = false;
int64_t addrDelta = (int64_t)m_BaseAddress - (int64_t)m_DrawnBaseAddress;
// scroll optimization
// Scroll optimization
if ((addrDelta % m_NumBytesPerRow) == 0 && abs(addrDelta) < (m_NumVisibleBytes - m_NumBytesPerRow))
{
int rowDelta = (int)(addrDelta / m_NumBytesPerRow);
@ -283,10 +283,10 @@ void CHexEditCtrl::Draw(void)
if (IsSelected(address))
{
// override owner-provided colors if selected
// Override owner-provided colors if selected
if (newByte->bkColor != BKCOLOR_DEFAULT)
{
// blend owner color with selection color if bkcolor isn't default
// Blend owner color with selection color if bkcolor isn't default
newByte->bkColor = BlendColor(BKCOLOR_SEL_FOCUSED, newByte->bkColor);
newByte->color = COLOR_SEL_FOCUSED;
}
@ -302,14 +302,14 @@ void CHexEditCtrl::Draw(void)
newByte->bkColor = BlendColor(BKCOLOR_HOT, newByte->bkColor);
}
// redraw cell if value or colors have changed
// Redraw cell if value or colors have changed
if (*newByte != *oldByte)
{
CRect rcHex, rcAscii;
GetHexCellPos(startCellIndex + i, &rcHex);
GetAsciiCellPos(startCellIndex + i, &rcAscii);
// check if a similar HXBYTEINFO has already been drawn
// Check if a similar HXBYTEINFO has already been drawn
std::unordered_map<HXBYTEINFO, HXRECTPAIR>::const_iterator drawnByte = drawnByteRects.find(*newByte);
if (drawnByte != drawnByteRects.end())
@ -390,7 +390,7 @@ void CHexEditCtrl::HitTest(int x, int y, HXHITTEST* pht)
int headerHeight = m_CharHeight;
// clamp row
// Clamp row
int row = (y - headerHeight) / m_CharHeight;
row = max(0, row);
row = min(m_NumVisibleRows - 1, row);
@ -410,8 +410,8 @@ void CHexEditCtrl::HitTest(int x, int y, HXHITTEST* pht)
int groupCharIdx = (x - groupX) / (m_CharWidth);
uint32_t address = SatAdd32(rowAddress, nGroup * m_NumBytesPerGroup + groupCharIdx / 2);
pht->hexAddress = address;
pht->hexCellSide = (groupCharIdx & 1) ? HX_RIGHT : HX_LEFT; // todo fix for wrap
pht->asciiAddress = address; // approximate
pht->hexCellSide = (groupCharIdx & 1) ? HX_RIGHT : HX_LEFT; // TODO: Fix for wrap
pht->asciiAddress = address; // Approximate
pht->asciiCellSide = HX_LEFT;
}
else if (x >= m_AsciiColumnRect.left && x < m_AsciiColumnRect.right)
@ -425,12 +425,12 @@ void CHexEditCtrl::HitTest(int x, int y, HXHITTEST* pht)
int idx = (asciiX / m_CharWidth);
pht->asciiAddress = SatAdd32(rowAddress, idx);
pht->asciiCellSide = ((asciiX % m_CharWidth) > (m_CharWidth / 2)) ? HX_RIGHT : HX_LEFT;
pht->hexAddress = SatAdd32(rowAddress, (m_NumBytesPerRow - 1)); // approximate
pht->hexAddress = SatAdd32(rowAddress, (m_NumBytesPerRow - 1)); // Approximate
pht->hexCellSide = HX_RIGHT;
}
else if (x < m_HexDataColumnRect.left)
{
// approximate
// Approximate
pht->hexAddress = rowAddress;
pht->hexCellSide = HX_LEFT;
pht->asciiAddress = rowAddress;
@ -438,7 +438,7 @@ void CHexEditCtrl::HitTest(int x, int y, HXHITTEST* pht)
}
else if (x >= m_AsciiColumnRect.right)
{
// approximate
// Approximate
pht->hexAddress = SatAdd32(rowAddress, (m_NumBytesPerRow - 1));
pht->hexCellSide = HX_RIGHT;
pht->asciiAddress = SatAdd32(rowAddress, (m_NumBytesPerRow - 1));
@ -474,7 +474,7 @@ bool CHexEditCtrl::UpdateCaretUI(bool bEnsureVisible, bool bTop)
{
if ((int)((m_RealSelEndAddress - m_BaseAddress) % m_NumBytesPerRow) == m_NumBytesPerRow - 1)
{
// left-to-right selection ends on the end of a row
// Left-to-right selection ends on the end of a row
index--;
xoffs = m_CharWidth;
}
@ -488,13 +488,13 @@ bool CHexEditCtrl::UpdateCaretUI(bool bEnsureVisible, bool bTop)
{
if ((int)((m_RealSelEndAddress - m_BaseAddress) % m_NumBytesPerRow) == m_NumBytesPerRow - 1)
{
// left-to-right selection ends on the end of a row
// Left-to-right selection ends on the end of a row
index--;
xoffs = m_CharWidth * 2;
}
else if ((int)((m_RealSelEndAddress - m_BaseAddress) % m_NumBytesPerGroup) == m_NumBytesPerGroup - 1)
{
// left-to-right selection ends on the end of a group
// Left-to-right selection ends on the end of a group
xoffs = -m_CharWidth;
}
}
@ -516,7 +516,7 @@ void CHexEditCtrl::Text(int x, int y, const char *text, COLORREF bg, COLORREF fg
COLORREF orgBg = ::SetBkColor(m_BackDC, bg);
COLORREF orgFg = ::SetTextColor(m_BackDC, fg);
::DrawText(m_BackDC, textOuput.c_str(), -1, &rc, DT_TOP | DT_NOPREFIX | DT_CALCRECT);
rc.right = rc.left + calcWidth; // just in case
rc.right = rc.left + calcWidth; // Just in case
::DrawText(m_BackDC, textOuput.c_str(), -1, &rc, DT_TOP | DT_NOPREFIX);
InvalidateRect(&rc, false);
::SetBkColor(m_BackDC, orgBg);
@ -590,7 +590,7 @@ void CHexEditCtrl::DrawAddressColumn()
}
else
{
// wrapped
// Wrapped
Text(0, y, " ", BKCOLOR_ADDR, COLOR_ADDR, &rcAddress);
}
}
@ -870,7 +870,7 @@ void CHexEditCtrl::OnLButtonDblClk(UINT /*nFlags*/, CPoint point)
if (m_FocusedColumn == HX_COL_HEXDATA)
{
// select word
// Select word
uint32_t offset = (ht.hexAddress - m_BaseAddress);
uint32_t wordOffset = offset - (offset % m_NumBytesPerGroup);
uint32_t wordAddress = m_BaseAddress + wordOffset;
@ -885,7 +885,7 @@ void CHexEditCtrl::OnLButtonDblClk(UINT /*nFlags*/, CPoint point)
}
if (m_FocusedColumn == HX_COL_ASCII)
{
// select row
// Select row
uint32_t offset = (ht.asciiAddress - m_BaseAddress);
uint32_t rowOffset = (ht.asciiAddress - m_BaseAddress) - (offset % m_NumBytesPerRow);
uint32_t rowAddress = m_BaseAddress + rowOffset;
@ -1362,7 +1362,7 @@ void CHexEditCtrl::OnKeyDown(UINT nChar, UINT /*nRepCnt*/, UINT /*nFlags*/)
UpdateCaretUI(true);
}
else if (nChar == VK_NEXT || nChar == VK_PRIOR) // page down, page up
else if (nChar == VK_NEXT || nChar == VK_PRIOR) // Page down, page up
{
int delta = (nChar == VK_NEXT) ? m_NumVisibleBytes : -m_NumVisibleBytes;
@ -1437,11 +1437,11 @@ void CHexEditCtrl::OnKeyDown(UINT nChar, UINT /*nRepCnt*/, UINT /*nFlags*/)
int CHexEditCtrl::GetSelDirection(void)
{
if (m_SelStartAddress < m_SelEndAddress) return 1; // right
if (m_SelStartAddress > m_SelEndAddress) return -1; // left
if (m_SelStartCellSide == m_SelEndCellSide) return 0; // no selection
if (m_SelStartCellSide == HX_LEFT && m_SelEndCellSide == HX_RIGHT) return 1; // right (single byte)
if (m_SelStartCellSide == HX_RIGHT && m_SelEndCellSide == HX_LEFT) return -1; // left (single byte)
if (m_SelStartAddress < m_SelEndAddress) return 1; // Right
if (m_SelStartAddress > m_SelEndAddress) return -1; // Left
if (m_SelStartCellSide == m_SelEndCellSide) return 0; // No selection
if (m_SelStartCellSide == HX_LEFT && m_SelEndCellSide == HX_RIGHT) return 1; // Right (single byte)
if (m_SelStartCellSide == HX_RIGHT && m_SelEndCellSide == HX_LEFT) return -1; // Left (single byte)
return 0;
}

View File

@ -146,7 +146,6 @@ private:
TParamList m_ParamList;
};
typedef CModifiedComboBoxT<WPARAM> CModifiedComboBox;

View File

@ -84,4 +84,4 @@ void CModifiedEditBox::SetTextField(HWND hWnd)
{
::SendMessage(m_TextField, WM_SETFONT, (WPARAM)m_BoldFont, 0);
}
}
}

View File

@ -33,4 +33,3 @@ public:
return m_bString;
}
};

View File

@ -5,7 +5,7 @@ BOOL CPartialGroupBox::Attach(HWND hWnd)
ATLASSUME(m_hWnd == NULL);
ATLASSERT(::IsWindow(hWnd));
// Allocate the thunk structure here, where we can fail gracefully.
// Allocate the thunk structure here, where we can fail gracefully
BOOL result = m_thunk.Init(GetWindowProc(), this);
if (result == FALSE)
@ -43,7 +43,7 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
{
CPaintDC dc(m_hWnd);
//paint groupbox manually
// Paint group box manually
CRect controlrect;
GetClientRect(controlrect);
//::MapWindowPoints(HWND_DESKTOP, GetParent(), (LPPOINT)(LPRECT)controlrect, (sizeof(RECT)/sizeof(POINT)));
@ -102,7 +102,7 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
dc.FillRect(fontrect, GetSysColor(COLOR_BTNFACE));
fontrect.DeflateRect(2, 0);
//Draw Caption
// Draw caption
dc.SetBkMode(OPAQUE);
dc.SetBkColor(GetSysColor(COLOR_BTNFACE));

View File

@ -2,7 +2,6 @@
#include "stdafx.h"
typedef struct {
WORD ctrlId;
char* text;
@ -55,4 +54,4 @@ public:
#define BEGIN_TOOLTIP_MAP() static const _ToolTipMap* _GetToolTipMap() { static const _ToolTipMap map[] = {
#define TOOLTIP(ctrlId, text) { ctrlId, text },
#define END_TOOLTIP_MAP() { 0 } }; return map; }
#define END_TOOLTIP_MAP() { 0 } }; return map; }

View File

@ -29,4 +29,4 @@ private:
BITMAP m_bmInfo;
CBitmap m_hBitmap;
CBrush m_BackgroundBrush;
};
};