diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DataArray.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DataArray.h index 3c31d53eb..e39fe6ba3 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DataArray.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DataArray.h @@ -28,6 +28,7 @@ // template class helpers with functions for comparing elements // override if using complex types without operator== + template 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) diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DragDrop.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DragDrop.h index 8402a5da9..2d2513136 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/DragDrop.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/DragDrop.h @@ -1,4 +1,3 @@ - #pragma once #include #include @@ -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(); diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCombo.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCombo.h index 710d8ce55..ca44769dc 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCombo.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCombo.h @@ -1,4 +1,3 @@ - #pragma once #include "ListTypes.h" #include @@ -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 ); } diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCtrl.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCtrl.h index 57f6f1a6d..b1e316c90 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCtrl.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListCtrl.h @@ -1,11 +1,6 @@ -///////////////////////////////////////////////////////////////////////////// -// -// CListCtrl - A WTL list control with Windows Vista style item selection. -// +// CListCtrl - A WTL list control with Windows Vista style item selection // Revision: 1.5 // Last modified: 2nd November 2016 -// -///////////////////////////////////////////////////////////////////////////// #pragma once @@ -103,7 +98,7 @@ public: { if (m_wndItemEdit.IsWindow()) { - // patch memory window crash + // Patch memory window crash m_wndItemEdit.UnsubclassWindow(); } } @@ -224,7 +219,7 @@ public: BOOL Initialise() { - // load list images + // Load list images if ( !m_ilListItems.CreateFromImage( IDB_LISTITEMS, 16, 0, RGB( 255, 0, 255 ), IMAGE_BITMAP, LR_CREATEDIBSECTION ) ) return FALSE; @@ -233,20 +228,20 @@ public: if ( m_curHyperLink.LoadCursor( IDC_HYPERLINK ) == NULL ) return FALSE; - // load interface settings + // Load interface settings if ( !LoadSettings() ) return FALSE; - // give control a static border + // Give control a static border ModifyStyle( WS_BORDER, WS_CLIPCHILDREN ); ModifyStyleEx( WS_EX_CLIENTEDGE, WS_EX_STATICEDGE, SWP_FRAMECHANGED ); - // register drag drop + // Register drag drop m_oleDragDrop.Register( this ); m_oleDragDrop.AddTargetFormat( m_nHeaderClipboardFormat ); m_oleDragDrop.AddSourceFormat( m_nHeaderClipboardFormat ); - // create the tooltip + // Create the tooltip if ( !m_ttToolTip.Create( m_hWnd ) ) return FALSE; m_ttToolTip.SetMaxTipWidth( SHRT_MAX ); @@ -282,12 +277,12 @@ public: m_nHeaderClipboardFormat = (CLIPFORMAT)RegisterClipboardFormat( _T( "HEADERCLIPBOARDFORMAT" ) ); - // get number of lines to scroll + // Get number of lines to scroll #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) SystemParametersInfo( SPI_GETWHEELSCROLLLINES, 0, &m_nMouseWheelScroll, 0 ); #endif - // get system message font + // Get system message font CLogFont logFont; logFont.SetMessageBoxFont(); if ( !m_fntListFont.IsNull() ) @@ -295,7 +290,7 @@ public: if ( m_fntListFont.CreateFontIndirect( &logFont ) == NULL ) return FALSE; - // get system underline font + // Get system underline font logFont.lfUnderline = BYTE(TRUE); if ( !m_fntUnderlineFont.IsNull() ) m_fntUnderlineFont.DeleteObject(); @@ -312,20 +307,20 @@ public: dcClient.SelectFont( hOldFont ); - // has system font changed + // Has system font changed if ( m_nItemHeight != sizeExtent.cy + ITEM_HEIGHT_MARGIN ) { m_nItemHeight = sizeExtent.cy + ITEM_HEIGHT_MARGIN; m_nHeaderHeight = m_nItemHeight; - // create drop arrows window + // Create drop arrows window if ( m_wndDropArrows.IsWindow() ) m_wndDropArrows.DestroyWindow(); if ( !m_wndDropArrows.Create( m_hWnd, m_nHeaderHeight, TRUE ) ) return FALSE; } - // create titletip window + // Create title tip window if ( m_wndTitleTip.IsWindow() ) m_wndTitleTip.DestroyWindow(); if ( !m_wndTitleTip.Create( m_hWnd ) ) @@ -411,7 +406,7 @@ public: void AddColumn( CListColumn& listColumn ) { - // minimum column width + // Minimum column width if ( listColumn.m_strText.empty() && listColumn.m_nImage != ITEM_IMAGE_NONE ) { CSize sizeIcon; @@ -420,10 +415,10 @@ public: listColumn.m_nFlags |= ITEM_FLAGS_CENTRE; } - // correct incompatible flag mask values + // Correct incompatible flag mask values listColumn.m_nFlags = ValidateFlags( listColumn.m_nFlags ); - // initial data index + // Initial data index listColumn.m_nIndex = GetColumnCount(); m_aColumns.Add( listColumn ); @@ -491,7 +486,7 @@ public: if ( nColumn < 0 || nColumn >= GetColumnCount() ) return FALSE; - // set new column size if not fixed + // Set new column size if not fixed if ( !m_aColumns[ nColumn ].m_bFixed ) { m_aColumns[ nColumn ].m_nWidth = nWidth; @@ -586,7 +581,7 @@ public: rcColumn.left += nWidth; } - // offset column by scroll position + // Offset column by scroll position rcColumn.OffsetRect( -GetScrollPos( SB_HORZ ), 0 ); return TRUE; @@ -614,13 +609,13 @@ public: int GetItemCount() { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return 0; } stdstr GetItemText( int nItem, int nSubItem ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return _T( "" ); } @@ -634,7 +629,7 @@ public: if ( strItemText.empty() ) return FALSE; - // get date-time from item text: yyyymmddhhmmss + // Get date-time from item text: yyyymmddhhmmss stItemDate.wYear = (WORD)_ttoi( strItemText.substr(0, 4 ).c_str() ); stItemDate.wMonth = (WORD)_ttoi( strItemText.substr( 4, 2 ).c_str() ); stItemDate.wDay = (WORD)_ttoi( strItemText.substr( 6, 2 ).c_str() ); @@ -648,27 +643,27 @@ public: int GetItemImage( int nItem, int nSubItem ) { - return ITEM_IMAGE_NONE; // may be implemented in a derived class + return ITEM_IMAGE_NONE; // May be implemented in a derived class } UINT GetItemFormat( int nItem, int nSubItem ) { - return GetColumnFormat( IndexToOrder( nSubItem ) ); // may be implemented in a derived class + return GetColumnFormat( IndexToOrder( nSubItem ) ); // May be implemented in a derived class } UINT GetItemFlags( int nItem, int nSubItem ) { - return GetColumnFlags( IndexToOrder( nSubItem ) ); // may be implemented in a derived class + return GetColumnFlags( IndexToOrder( nSubItem ) ); // May be implemented in a derived class } BOOL GetItemComboList( int nItem, int nSubItem, CListArray < stdstr >& aComboList ) { - return GetColumnComboList( IndexToOrder( nSubItem ), aComboList ); // may be implemented in a derived class + return GetColumnComboList( IndexToOrder( nSubItem ), aComboList ); // May be implemented in a derived class } HFONT GetItemFont( int /*nItem*/, int /*nSubItem*/ ) { - return m_fntListFont; // may be implemented in a derived class + return m_fntListFont; // May be implemented in a derived class } BOOL GetItemColours( int nItem, int nSubItem, COLORREF& rgbBackground, COLORREF& rgbText ) @@ -680,23 +675,23 @@ public: stdstr virtual GetItemToolTip( int /*nItem*/, int /*nSubItem*/ ) { - return _T( "" ); // may be implemented in a derived class + return _T( "" ); // May be implemented in a derived class } stdstr virtual GetHeaderToolTip(int /*column*/) { - return _T(""); //implemented by child class + return _T(""); // Implemented by child class } BOOL SetItemText( int nItem, int nSubItem, LPCTSTR lpszText ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return FALSE; } BOOL SetItemComboIndex( int nItem, int nSubItem, int nIndex ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return FALSE; } @@ -704,7 +699,7 @@ public: { T* pT = static_cast(this); - // set date-time in format (yyyymmddhhmmss) + // Set date-time in format (yyyymmddhhmmss) stdstr strFormatDate; strFormatDate.Format( _T( "%04d%02d%02d%02d%02d%02d" ), stItemDate.wYear, stItemDate.wMonth, stItemDate.wDay, stItemDate.wHour, stItemDate.wMinute, stItemDate.wSecond ); @@ -730,42 +725,42 @@ public: BOOL SetItemImage( int nItem, int nSubItem, int nImage ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return FALSE; } BOOL SetItemFormat( int nItem, int nSubItem, UINT nFormat, UINT nFlags = ITEM_FLAGS_NONE ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return FALSE; } BOOL SetItemFormat( int nItem, int nSubItem, UINT nFormat, UINT nFlags, CListArray < stdstr >& aComboList ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return FALSE; } BOOL SetItemFont( int nItem, int nSubItem, HFONT hFont ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return FALSE; } BOOL SetItemColours( int nItem, int nSubItem, COLORREF rgbBackground, COLORREF rgbText ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return FALSE; } void ReverseItems() { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class } void SortItems( int nColumn, BOOL bAscending ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class } BOOL GetItemRect( int nItem, int nSubItem, CRect& rcItem ) @@ -779,7 +774,7 @@ public: CRect rcClient; GetClientRect( rcClient ); - // calculate item rect based on scroll position + // Calculate item rect based on scroll position rcItem = rcClient; rcItem.top = ( m_bShowHeader ? m_nHeaderHeight : 0 ) + ( ( nItem - nTopItem ) * m_nItemHeight ); rcItem.bottom = rcItem.top + m_nItemHeight; @@ -831,10 +826,10 @@ public: GetClientRect( rcClient ); rcClient.top = ( m_bShowHeader ? m_nHeaderHeight : 0 ); - // calculate number of items per control height (include partial item) + // Calculate number of items per control height (include partial item) div_t divHeight = div( rcClient.Height(), m_nItemHeight ); - // round up to nearest item count + // Round up to nearest item count return max( bPartial && divHeight.rem > 0 ? divHeight.quot + 1 : divHeight.quot, 1 ); } @@ -846,11 +841,11 @@ public: if ( nItem < nTopItem || nItem >= pT->GetItemCount() ) return FALSE; - // check whether item is visible + // Check whether item is visible if ( nItem < nTopItem || nItem >= nTopItem + GetCountPerPage( bPartial ) ) return FALSE; - // check whether subitem is visible + // Check whether subitem is visible if ( m_bFocusSubItem && nSubItem != NULL_SUBITEM ) { CRect rcColumn; @@ -886,7 +881,7 @@ public: { int nScrollItem = NULL_ITEM; - // scroll list up/down to include item + // Scroll list up/down to include item if ( rcItem.top < rcClient.top || rcItem.Height() > rcClient.Height() ) nScrollItem = nItem; else if ( rcItem.bottom > rcClient.bottom ) @@ -906,7 +901,7 @@ public: int nScrollPos = 0; - // scroll list left/right to include subitem + // Scroll list left/right to include subitem if ( rcColumn.Width() > rcClient.Width() || rcColumn.left < 0 ) nScrollPos = rcColumn.left; else if ( rcColumn.right > rcClient.right ) @@ -954,11 +949,11 @@ public: infoScroll.nMax = ( pT->GetItemCount() * m_nItemHeight ) + ( m_bShowHeader ? m_nHeaderHeight : 0 ); infoScroll.nPage = rcClient.Height() - ( m_bShowHeader ? m_nHeaderHeight : 0 ); - // are we within client range? + // Are we within client range? if ( (UINT)infoScroll.nMax <= infoScroll.nPage + ( m_bShowHeader ? m_nHeaderHeight : 0 ) ) infoScroll.nMax = 0; - // set vertical scroll bar + // Set vertical scroll bar m_bEnableVertScroll = SetScrollInfo( SB_VERT, &infoScroll, TRUE ) ? ( infoScroll.nMax > 0 ) : FALSE; } @@ -967,11 +962,11 @@ public: infoScroll.nMax = GetTotalWidth( bRecalc ); infoScroll.nPage = rcClient.Width(); - // are we within client range? + // Are we within client range? if ( infoScroll.nPage >= (UINT)infoScroll.nMax ) infoScroll.nMax = 0; - // set horizontal scroll bar + // Set horizontal scroll bar m_bEnableHorizScroll = SetScrollInfo( SB_HORZ, &infoScroll, TRUE ) ? ( infoScroll.nMax > (int)infoScroll.nPage ) : FALSE; } } @@ -1008,10 +1003,10 @@ public: BOOL bNewSelect = !( bSelectRange || ( nFlags & MK_CONTROL ) ); BOOL bEnsureVisible = FALSE; - // are we starting a new select sequence? + // Are we starting a new select sequence? if ( bNewSelect || bSelectRange ) { - // are we simply reselecting the same item? + // Are we simply reselecting the same item? if ( m_setSelectedItems.size() == 1 && *m_setSelectedItems.begin() == nItem ) { bSelectItem = FALSE; @@ -1022,14 +1017,14 @@ public: else m_setSelectedItems.clear(); } - else // we adding to or removing from select sequence + else // We adding to or removing from select sequence { if ( m_bSingleSelect ) m_setSelectedItems.clear(); set < int >::iterator posSelectedItem = m_setSelectedItems.find( nItem ); - // is this item already selected? + // Is this item already selected? if ( posSelectedItem != m_setSelectedItems.end() ) { bSelectItem = FALSE; @@ -1040,7 +1035,7 @@ public: } } - // are we adding this item to the select sequence? + // Are we adding this item to the select sequence? if ( bSelectItem ) { bEnsureVisible = TRUE; @@ -1062,11 +1057,11 @@ public: m_nFocusItem = nItem; m_nFocusSubItem = m_setSelectedItems.size() > 1 ? NULL_SUBITEM : nSubItem; - // notify parent of selected item + // Notify parent of selected item NotifyParent( m_nFocusItem, m_nFocusSubItem, LCN_SELECTED ); } - // start visible timer (scrolls list to partially hidden item) + // Start visible timer (scrolls list to partially hidden item) if ( !IsItemVisible( nItem, m_setSelectedItems.size() > 1 ? NULL_SUBITEM : nSubItem, FALSE ) ) SetTimer( ITEM_VISIBLE_TIMER, ITEM_VISIBLE_PERIOD ); else if ( m_nFocusItem != NULL_ITEM && m_nFocusSubItem != NULL_SUBITEM ) @@ -1110,7 +1105,7 @@ public: BOOL HitTestHeader( CPoint point, int& nColumn, UINT& nFlags ) { - // reset hittest flags + // Reset hittest flags nFlags = HITTEST_FLAG_NONE; if ( !m_bShowHeader ) @@ -1120,35 +1115,35 @@ public: if ( !GetClientRect( rcClient ) ) return FALSE; - // are we over the header? + // Are we over the header? if ( point.y < rcClient.top || point.y > m_nHeaderHeight ) return FALSE; int nDividerPos = 0; int nColumnCount = GetColumnCount(); - // get hit-test subitem + // Get hit-test subitem for ( nColumn = 0; nColumn < nColumnCount; nColumn++ ) { int nColumnWidth = GetColumnWidth( nColumn ); nDividerPos += nColumnWidth; - // offset divider position with current scroll position + // Offset divider position with current scroll position int nRelativePos = nDividerPos - GetScrollPos( SB_HORZ ); - // are we over the divider zone? + // Are we over the divider zone? if ( point.x >= nRelativePos - DRAG_HEADER_OFFSET - 1 && point.x <= nRelativePos + DRAG_HEADER_OFFSET ) { nFlags |= HITTEST_FLAG_HEADER_DIVIDER; - // are we to the left of the divider (or over last column divider)? + // Are we to the left of the divider (or over last column divider)? if ( ( point.x >= nRelativePos - DRAG_HEADER_OFFSET - 1 && point.x < nRelativePos ) || nColumn + 1 >= nColumnCount - 1 ) { nFlags |= HITTEST_FLAG_HEADER_LEFT; return TRUE; } - // find last zero-length column after this column + // Find last zero-length column after this column for ( int nNextColumn = nColumn + 1; nNextColumn < nColumnCount; nNextColumn++ ) { if ( GetColumnWidth( nNextColumn ) > 0 ) @@ -1161,7 +1156,7 @@ public: return TRUE; } - // are we over a column? + // Are we over a column? if ( point.x > nRelativePos - nColumnWidth && point.x < nRelativePos ) return TRUE; } @@ -1173,11 +1168,11 @@ public: { T* pT = static_cast(this); - // are we over the header? + // Are we over the header? if ( point.y < ( m_bShowHeader ? m_nHeaderHeight : 0 ) ) return FALSE; - // calculate hit test item + // Calculate hit test item nItem = GetTopItem() + (int)( ( point.y - ( m_bShowHeader ? m_nHeaderHeight : 0 ) ) / m_nItemHeight ); if ( nItem < 0 || nItem >= pT->GetItemCount() ) @@ -1186,16 +1181,16 @@ public: int nTotalWidth = 0; int nColumnCount = GetColumnCount(); - // get hit-test subitem + // Get hit-test subitem for ( nSubItem = 0; nSubItem < nColumnCount; nSubItem++ ) { int nColumnWidth = GetColumnWidth( nSubItem ); nTotalWidth += nColumnWidth; - // offset position with current scroll position + // Offset position with current scroll position int nRelativePos = nTotalWidth - GetScrollPos( SB_HORZ ); - // are we over a subitem? + // Are we over a subitem? if ( point.x > nRelativePos - nColumnWidth && point.x < nRelativePos ) return TRUE; } @@ -1214,7 +1209,7 @@ public: CClientDC dcClient( m_hWnd ); HFONT hOldFont = dcClient.SelectFont( m_fntListFont ); - // set to column text width if zero-length + // Set to column text width if zero-length CSize sizeExtent; if ( !dcClient.GetTextExtent( listColumn.m_strText.c_str(), -1, &sizeExtent ) ) return FALSE; @@ -1225,7 +1220,7 @@ public: if ( !m_ilItemImages.IsNull() ) m_ilItemImages.GetIconSize( sizeIcon ); - // calculate maximum column width required + // Calculate maximum column width required for ( int nItem = 0; nItem < pT->GetItemCount(); nItem++ ) { if ( !dcClient.GetTextExtent( pT->GetItemText( nItem, listColumn.m_nIndex ), -1, &sizeExtent ) ) @@ -1254,21 +1249,21 @@ public: if ( bColumnScroll ) { - // have we finished scrolling list to accommodate new column size? + // Have we finished scrolling list to accommodate new column size? if ( !m_bColumnSizing || !m_bEnableHorizScroll || nCurrentPos - m_nStartScrollPos > 0 ) { KillTimer( RESIZE_COLUMN_TIMER ); - // reset resize start point + // Reset resize start point m_nStartPos = nCurrentPos; m_bResizeTimer = FALSE; } else if ( nCurrentPos < m_nStartPos && GetScrollPos( SB_HORZ ) >= nScrollLimit ) { - // reset start column size + // Reset start column size m_nStartSize = max( GetColumnWidth( m_nColumnSizing ) + ( nCurrentPos - m_nStartScrollPos ), 0 ); - // resize column + // Resize column SetColumnWidth( m_nColumnSizing, m_nStartSize ); } } @@ -1276,24 +1271,24 @@ public: { int nColumnSize = max( m_nStartSize + ( nCurrentPos - m_nStartPos ), 0 ); - // are we scrolled fully to the right and wanting to reduce the size of a column? + // Are we scrolled fully to the right and wanting to reduce the size of a column? if ( m_bEnableHorizScroll && GetScrollPos( SB_HORZ ) >= nScrollLimit && nColumnSize < GetColumnWidth( m_nColumnSizing ) ) { if ( !m_bResizeTimer ) { - // only start the scroll timer once + // Only start the scroll timer once m_bResizeTimer = TRUE; - // set new start scroll position + // Set new start scroll position m_nStartScrollPos = nCurrentPos; - // start column resize / scroll timer + // Start column resize / scroll timer SetTimer( RESIZE_COLUMN_TIMER, RESIZE_COLUMN_PERIOD ); } } else { - // resizing is done in scroll timer (if started) + // Resizing is done in scroll timer (if started) if ( !m_bResizeTimer ) SetColumnWidth( m_nColumnSizing, nColumnSize ); } @@ -1315,7 +1310,7 @@ public: if ( !GetColumn( m_nHighlightColumn, listColumn ) ) return; - // store drag column + // Store drag column m_nDragColumn = m_nHighlightColumn; CClientDC dcClient( m_hWnd ); @@ -1325,7 +1320,7 @@ public: int nContextState = dcHeader.SaveDC(); - // create drag header bitmap + // Create drag header bitmap CBitmapHandle bmpHeader; bmpHeader.CreateCompatibleBitmap( dcClient, rcHeaderItem.Width(), rcHeaderItem.Height() ); dcHeader.SelectBitmap( bmpHeader ); @@ -1338,10 +1333,10 @@ public: rcHeaderText.left += m_nHighlightColumn == 0 ? 4 : 3; rcHeaderText.OffsetRect( 0, 1 ); - // margin header text + // Margin header text rcHeaderText.DeflateRect( 4, 0, 5, 0 ); - // has this header item an associated image? + // Has this header item an associated image? if ( listColumn.m_nImage != ITEM_IMAGE_NONE ) { CSize sizeIcon; @@ -1355,7 +1350,7 @@ public: m_ilListItems.DrawEx( listColumn.m_nImage, dcHeader, rcHeaderImage, CLR_DEFAULT, CLR_DEFAULT, ILD_TRANSPARENT ); - // offset header text (for image) + // Offset header text (for image) rcHeaderText.left += sizeIcon.cx + 4; } @@ -1372,7 +1367,7 @@ public: else nFormat |= DT_LEFT; - // draw header text + // Draw header text if ( !listColumn.m_strText.empty() ) dcHeader.DrawText( listColumn.m_strText.c_str(), (int)listColumn.m_strText.length(), rcHeaderText, nFormat ); @@ -1388,10 +1383,10 @@ public: shDragImage.hbmpDragImage = bmpHeader; shDragImage.crColorKey = m_rgbBackground; - // start header drag operation + // Start header drag operation m_oleDragDrop.DoDragDrop( &shDragImage, DROPEFFECT_MOVE ); - // hide drop arrows after moving column + // Hide drop arrows after moving column m_wndDropArrows.Hide(); if ( m_bButtonDown ) @@ -1403,7 +1398,7 @@ public: m_ptSelectPoint = 0; } - // finish moving a column + // Finish moving a column if ( m_nHighlightColumn != NULL_COLUMN ) { m_nHighlightColumn = NULL_COLUMN; @@ -1422,7 +1417,7 @@ public: m_nHotColumn = NULL_COLUMN; UINT nHeaderFlags = HITTEST_FLAG_NONE; - // are we over the header? + // Are we over the header? if ( HitTestHeader( point, m_nHotColumn, nHeaderFlags ) ) { CRect rcColumn; @@ -1445,13 +1440,13 @@ public: CRect rcColumn; int nColumnCount = GetColumnCount(); - // set closest divider position + // Set closest divider position if ( GetColumnRect( m_nHotDivider < nColumnCount ? m_nHotDivider : nColumnCount - 1, rcColumn ) ) ptDivider.x = m_nHotDivider < nColumnCount ? rcColumn.left : rcColumn.right; ClientToScreen( &ptDivider ); - // track drop window + // Track drop window m_wndDropArrows.Show( ptDivider ); return TRUE; } @@ -1474,14 +1469,14 @@ public: if ( nSortIndex != m_nSortColumn ) { - // sort by new column + // Sort by new column m_bSortAscending = TRUE; m_nSortColumn = nSortIndex; pT->SortItems( m_nSortColumn, m_bSortAscending ); } else { - // toggle sort order if sorting same column + // Toggle sort order if sorting same column m_bSortAscending = !m_bSortAscending; pT->ReverseItems(); } @@ -1500,7 +1495,7 @@ public: BOOL DragItem() { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class return FALSE; } @@ -1519,22 +1514,22 @@ public: if ( m_rcGroupSelect.IsRectEmpty() ) return FALSE; - // select items in group + // Select items in group AutoSelect( point ); - // start auto scroll timer + // Start auto scroll timer SetTimer( ITEM_AUTOSCROLL_TIMER, ITEM_SCROLL_PERIOD ); DWORD dwCurrentTick = GetTickCount(); - // timer messages are a low priority, therefore we need to simulate the timer when moving the mouse + // Timer messages are a low priority, therefore we need to simulate the timer when moving the mouse if ( ( dwCurrentTick - m_dwScrollTick ) > ITEM_SCROLL_PERIOD - 10 ) { if ( AutoScroll( point ) ) m_dwScrollTick = dwCurrentTick; } - // redraw list immediately + // Redraw list immediately return RedrawWindow(); } @@ -1625,7 +1620,7 @@ public: } } - // was scrolling performed? + // Was scrolling performed? return bAutoScroll; } @@ -1633,11 +1628,11 @@ public: { T* pT = static_cast(this); - // any scroll required? + // Any scroll required? if ( nBeginItem == nEndItem ) return FALSE; - // calculate scroll offset + // Calculate scroll offset m_nScrollOffset = abs( nEndItem - nBeginItem ) * m_nItemHeight; m_nScrollUnit = min( max( m_nScrollOffset / m_nItemHeight, ITEM_SCROLL_UNIT_MIN ), ITEM_SCROLL_UNIT_MAX ); m_nScrollDelta = ( m_nScrollOffset - m_nScrollUnit ) / m_nScrollUnit; @@ -1667,7 +1662,7 @@ public: rcItem.top = 0; rcItem.bottom = rcItem.top; - // draw all visible items into bitmap + // Draw all visible items into bitmap for ( int nItem = min( nBeginItem, nEndItem ); nItem < pT->GetItemCount(); rcItem.top = rcItem.bottom, nItem++ ) { rcItem.bottom = rcItem.top + m_nItemHeight; @@ -1675,7 +1670,7 @@ public: if ( rcItem.top > rcScrollList.bottom ) break; - // may be implemented in a derived class + // May be implemented in a derived class pT->DrawItem( dcScrollList.m_hDC, nItem, rcItem ); } @@ -1683,7 +1678,7 @@ public: ScrollList(); - // start scrolling timer + // Start scrolling timer SetTimer( ITEM_SCROLL_TIMER, ITEM_SCROLL_PERIOD ); return TRUE; @@ -1725,7 +1720,7 @@ public: CSize sizScrollBitmap; m_bmpScrollList.GetSize( sizScrollBitmap ); - // draw scrolled list + // Draw scrolled list dcClient.BitBlt( 0, rcClient.top, rcClient.Width(), rcClient.Height(), dcScrollList, 0, m_bScrollDown ? ( sizScrollBitmap.cy - ( GetCountPerPage() * m_nItemHeight ) - m_nScrollOffset ) : m_nScrollOffset, SRCCOPY ); dcScrollList.SelectBitmap( hOldBitmap ); @@ -1790,7 +1785,7 @@ public: if ( stFormatDate.wYear == 0 ) return _T( "" ); - // format date to local format + // Format date to local format TCHAR szDateFormat[ DATE_STRING ]; return GetDateFormat( LOCALE_USER_DEFAULT, DATE_SHORTDATE, &stFormatDate, NULL, szDateFormat, DATE_STRING ) == 0 ? _T( "" ) : szDateFormat; } @@ -1802,7 +1797,7 @@ public: stFormatTime.wMonth = 0; stFormatTime.wDay = 0; - // format time to local format + // Format time to local format TCHAR szTimeFormat[ DATE_STRING ]; return GetTimeFormat( LOCALE_USER_DEFAULT, 0, &stFormatTime, NULL, szTimeFormat, DATE_STRING ) == 0 ? _T( "" ) : szTimeFormat; } @@ -1821,7 +1816,7 @@ public: listNotify.m_lpszItemText = NULL; listNotify.m_lpItemDate = NULL; - // forward notification to parent + // Forward notification to parent FORWARD_WM_NOTIFY( pT->GetParent(), listNotify.m_hdrNotify.idFrom, &listNotify.m_hdrNotify, ::SendMessage ); } @@ -1829,11 +1824,11 @@ public: { T* pT = static_cast(this); - // do not show titletip if editing + // Do not show title tip if editing if ( m_bEditItem ) return FALSE; - // is titletip already shown for this item? + // Is title tip already shown for this item? if ( nItem == m_nTitleTipItem && nSubItem == m_nTitleTipSubItem ) return FALSE; @@ -1851,7 +1846,7 @@ public: // rcItemText.left += nSubItem == 0 ? 4 : 3; // rcItemText.DeflateRect( 4, 0 ); - // offset item text (for image) + // Offset item text (for image) if ( !m_ilItemImages.IsNull() && pT->GetItemImage( nItem, nIndex ) != ITEM_IMAGE_NONE ) { CSize sizeIcon; @@ -1859,7 +1854,7 @@ public: rcItemText.left += sizeIcon.cx + 4; } - // is current cursor position over item text (not over an icon)? + // Is current cursor position over item text (not over an icon)? if ( !rcItemText.PtInRect( point ) ) return FALSE; @@ -1869,7 +1864,7 @@ public: { case ITEM_FORMAT_CHECKBOX: case ITEM_FORMAT_CHECKBOX_3STATE: - case ITEM_FORMAT_PROGRESS: break; // no titletip for checkboxes or progress + case ITEM_FORMAT_PROGRESS: break; // No title tip for checkboxes or progress case ITEM_FORMAT_DATETIME: { SYSTEMTIME stItemDate; if ( !GetItemDate( nItem, nIndex, stItemDate ) ) @@ -1998,10 +1993,10 @@ public: void OnSize( UINT /*nType*/, CSize /*size*/ ) { - // stop any pending scroll + // Stop any pending scroll EndScroll(); - // end any pending edit + // End any pending edit if ( m_bEditItem ) SetFocus(); @@ -2011,10 +2006,10 @@ public: void OnHScroll( int nSBCode, short /*nPos*/, HWND /*hScrollBar*/ ) { - // stop any pending scroll + // Stop any pending scroll EndScroll(); - // end any pending edit + // End any pending edit if ( m_bEditItem ) SetFocus(); @@ -2046,11 +2041,11 @@ public: infoScroll.cbSize = sizeof( SCROLLINFO ); infoScroll.fMask = SIF_TRACKPOS; - // get 32-bit scroll position + // Get 32-bit scroll position if ( !GetScrollInfo( SB_HORZ, &infoScroll ) ) return; - // has scroll position changed? + // Has scroll position changed? if ( infoScroll.nTrackPos == nScrollPos ) return; @@ -2068,7 +2063,7 @@ public: { T* pT = static_cast(this); - // end any pending edit + // End any pending edit if ( m_bEditItem ) SetFocus(); @@ -2104,11 +2099,11 @@ public: infoScroll.cbSize = sizeof( SCROLLINFO ); infoScroll.fMask = SIF_TRACKPOS; - // get 32-bit scroll position + // Get 32-bit scroll position if ( !GetScrollInfo( SB_VERT, &infoScroll ) ) return; - // has scroll position changed? + // Has scroll position changed? if ( infoScroll.nTrackPos == nScrollPos ) return; @@ -2120,7 +2115,7 @@ public: default: return; } - // store original top item before scrolling + // Store original top item before scrolling int nTopItem = GetTopItem(); ResetScrollBars( SB_VERT, nScrollPos, FALSE ); @@ -2156,7 +2151,8 @@ public: { T* pT = static_cast(this); - // We have a bug here with setcapture() and the tooltip notiying the parent with mouse messages. + // TODO: Fix? + // We have a bug here with setcapture() and the tooltip notifying the parent with mouse messages. // Hard to explain, but what I think happens is that this click is sent by the tooltip, which then // releases capture, so it gets no more mouse events, thus not receiving the actual double click // on the tool tip, and what results is two single clicks for this parent control. @@ -2169,18 +2165,18 @@ public: m_ptDownPoint = point; m_ptSelectPoint = CPoint( point.x + GetScrollPos( SB_HORZ ), point.y + GetScrollPos( SB_VERT ) ); - // stop any pending scroll + // Stop any pending scroll EndScroll(); SetFocus(); - // capture all mouse input + // Capture all mouse input SetCapture(); int nColumn = NULL_COLUMN; UINT nHeaderFlags = HITTEST_FLAG_NONE; - // are we over the header? + // Are we over the header? if ( HitTestHeader( point, nColumn, nHeaderFlags ) ) { CListColumn listColumn; @@ -2191,7 +2187,7 @@ public: { SetCursor( m_curDivider ); - // begin column resizing + // Begin column resizing m_bColumnSizing = TRUE; m_nColumnSizing = nColumn; m_nStartSize = listColumn.m_nWidth; @@ -2216,14 +2212,14 @@ public: } else { - // do not begin group select from first columns + // Do not begin group select from first columns if ( !( nFlags & MK_SHIFT ) && !( nFlags & MK_CONTROL ) && nSubItem != 0 ) { m_bBeginSelect = TRUE; m_nFirstSelected = nItem; } - // only select item if not already selected + // Only select item if not already selected if ( ( nFlags & MK_SHIFT ) || ( nFlags & MK_CONTROL ) || !IsSelected( nItem ) || m_setSelectedItems.size() <= 1 ) SelectItem( nItem, nSubItem, nFlags ); @@ -2271,10 +2267,10 @@ public: if ( m_bButtonDown ) ReleaseCapture(); - // finish resizing or selecting a column + // Finish resizing or selecting a column if ( m_bColumnSizing || m_nHighlightColumn != NULL_COLUMN ) { - // are we changing the sort order? + // Are we changing the sort order? if ( !m_bColumnSizing && m_nHighlightColumn != NULL_COLUMN && m_bSortEnabled) // Changed by Rowan 05/12/2006 //if ( !m_bColumnSizing && m_nHighlightColumn != NULL_COLUMN) SortColumn( m_nHighlightColumn ); @@ -2293,7 +2289,7 @@ public: m_ptDownPoint = 0; m_ptSelectPoint = 0; - // have we finished a group select? + // Have we finished a group select? if ( m_bGroupSelect ) { m_bGroupSelect = FALSE; @@ -2304,11 +2300,11 @@ public: int nItem = NULL_ITEM; int nSubItem = NULL_SUBITEM; - // de-select item if current item is selected + // Deselect item if current item is selected if ( HitTest( point, nItem, nSubItem ) && IsSelected( nItem ) && m_setSelectedItems.size() > 1 && !( nFlags & MK_SHIFT ) && !( nFlags & MK_CONTROL ) ) SelectItem( nItem, nSubItem, nFlags ); - // notify parent of left-click item + // Notify parent of left-click item NotifyParent( nItem, nSubItem, LCN_LEFTCLICK ); } } @@ -2318,13 +2314,13 @@ public: HideTitleTip( FALSE ); - // handle double-clicks (for drawing) + // Handle double-clicks (for drawing) SendMessage( WM_LBUTTONDOWN, 0, MAKELPARAM( point.x, point.y ) ); int nColumn = NULL_COLUMN; UINT nHeaderFlags = HITTEST_FLAG_NONE; - // resize column if double-click on a divider + // Resize column if double-click on a divider if ( HitTestHeader( point, nColumn, nHeaderFlags ) && ( nHeaderFlags & HITTEST_FLAG_HEADER_DIVIDER ) ) AutoSizeColumn( nColumn ); @@ -2335,13 +2331,13 @@ public: //WriteTraceF(TraceInfo, "List Ctrl Double Click, Item: %d", nItem); - // notify parent of double-clicked item + // Notify parent of double-clicked item NotifyParent( nItem, nSubItem, LCN_DBLCLICK ); } void OnRButtonDown( UINT nFlags, CPoint point ) { - // stop any pending scroll + // Stop any pending scroll EndScroll(); SetFocus(); @@ -2353,7 +2349,7 @@ public: if (m_bRightClickSelect) { - // only select item if not already selected (de-select in OnLButtonUp) + // Only select item if not already selected (deselect in OnLButtonUp) if (HitTest(point, nItem, nSubItem) && !IsSelected(nItem)) SelectItem(nItem, nSubItem, nFlags); } @@ -2367,7 +2363,7 @@ public: if ( !HitTest( point, nItem, nSubItem ) ) ResetSelected(); - // notify parent of right-click item + // Notify parent of right-click item NotifyParent( nItem, nSubItem, LCN_RIGHTCLICK ); } @@ -2392,27 +2388,27 @@ public: trkMouse.dwFlags = TME_LEAVE; trkMouse.hwndTrack = m_hWnd; - // notify when the mouse leaves button + // Notify when the mouse leaves button _TrackMouseEvent( &trkMouse ); } if ( m_bButtonDown ) { - // are we resizing a column? + // Are we resizing a column? if ( m_bColumnSizing ) { ResizeColumn(); return; } - // are we beginning to drag a column? + // Are we beginning to drag a column? if ( m_nHighlightColumn != NULL_COLUMN && ( point.x < m_ptDownPoint.x - DRAG_HEADER_OFFSET || point.x > m_ptDownPoint.x + DRAG_HEADER_OFFSET || point.y < m_ptDownPoint.y - DRAG_HEADER_OFFSET || point.y > m_ptDownPoint.y + DRAG_HEADER_OFFSET ) ) { DragColumn(); return; } - // are we beginning a group select or dragging an item? + // Are we beginning a group select or dragging an item? if ( point.x < m_ptDownPoint.x - DRAG_ITEM_OFFSET || point.x > m_ptDownPoint.x + DRAG_ITEM_OFFSET || point.y < m_ptDownPoint.y - DRAG_ITEM_OFFSET || point.y > m_ptDownPoint.y + DRAG_ITEM_OFFSET ) { if ( m_bBeginSelect || !m_bDragDrop ) @@ -2424,11 +2420,11 @@ public: if ( HitTest( point, nItem, nSubItem ) ) { - // select the drag item (if not already selected) + // Select the drag item (if not already selected) if ( !IsSelected( nItem ) ) SelectItem( nItem, nSubItem, nFlags ); - // begin drag item operation + // Begin drag item operation pT->DragItem(); } } @@ -2445,7 +2441,7 @@ public: int nColumn = NULL_COLUMN; UINT nHeaderFlags = HITTEST_FLAG_NONE; - // are we over the header? + // Are we over the header? BOOL bHitTestHeader = HitTestHeader( point, nColumn, nHeaderFlags ); if ( bHitTestHeader ) @@ -2456,7 +2452,7 @@ public: SetCursor( m_curDivider ); else { - // get tooltip for this item + // Get tooltip for this item stdstr strToolTip = pT->GetHeaderToolTip(nColumn); if(!strToolTip.empty()) { @@ -2478,7 +2474,7 @@ public: { if ( m_nHotItem != NULL_ITEM && m_nHotSubItem != NULL_SUBITEM ) { - // redraw old hot item + // Redraw old hot item int nIndex = GetColumnIndex( m_nHotSubItem ); if ( pT->GetItemFormat( m_nHotItem, nIndex ) == ITEM_FORMAT_HYPERLINK && !( pT->GetItemFlags( m_nHotItem, nIndex ) & ITEM_FLAGS_READ_ONLY ) ) InvalidateItem( m_nHotItem, m_nHotSubItem ); @@ -2493,10 +2489,10 @@ public: } else { - // has the hot item changed? + // Has the hot item changed? if ( nItem != m_nHotItem || nSubItem != m_nHotSubItem ) { - // redraw old hot item + // Redraw old hot item int nIndex = GetColumnIndex( m_nHotSubItem ); if ( pT->GetItemFormat( m_nHotItem, nIndex ) == ITEM_FORMAT_HYPERLINK && !( pT->GetItemFlags( m_nHotItem, nIndex ) & ITEM_FLAGS_READ_ONLY ) ) InvalidateItem( m_nHotItem, m_nHotSubItem ); @@ -2511,14 +2507,14 @@ public: UINT nItemFormat = pT->GetItemFormat( m_nHotItem, nIndex ); UINT nItemFlags = pT->GetItemFlags( m_nHotItem, nIndex ); - // draw new hot hyperlink item + // Draw new hot hyperlink item if ( nItemFormat == ITEM_FORMAT_HYPERLINK && !( nItemFlags & ITEM_FLAGS_READ_ONLY ) ) { InvalidateItem( m_nHotItem, m_nHotSubItem ); SetCursor( m_curHyperLink ); } - // get tooltip for this item + // Get tooltip for this item stdstr strToolTip = pT->GetItemToolTip( m_nHotItem, nIndex ); CRect rcSubItem; @@ -2533,7 +2529,7 @@ public: m_ttToolTip.DelTool( m_hWnd, TOOLTIP_TOOL_ID ); } - // show titletips for this item + // Show title tips for this item ShowTitleTip( point, m_nHotItem, m_nHotSubItem ); } } @@ -2561,7 +2557,7 @@ public: { HideTitleTip(); - // end any pending edit + // End any pending edit if ( m_bEditItem ) SetFocus(); @@ -2591,11 +2587,11 @@ public: int nFocusItem = NULL_ITEM; int nFocusSubItem = NULL_SUBITEM; - // get current focus item + // Get current focus item if ( !GetFocusItem( nFocusItem, nFocusSubItem ) ) break; - // make sure current focus item is visible before editing + // Make sure current focus item is visible before editing if ( !EditItem( nFocusItem, nFocusSubItem ) ) break; } @@ -2608,7 +2604,7 @@ public: CPoint ptMouse( GET_X_LPARAM( dwPoint ), GET_Y_LPARAM( dwPoint ) ); ScreenToClient( &ptMouse ); - // automatically scroll when group selecting + // Automatically scroll when group selecting AutoScroll( ptMouse ); AutoSelect( ptMouse ); } @@ -2623,7 +2619,7 @@ public: { T* pT = static_cast(this); - // stop any pending scroll + // Stop any pending scroll EndScroll(); BOOL bCtrlKey = ( ( GetKeyState( VK_CONTROL ) & 0x8000 ) != 0 ); @@ -2709,7 +2705,7 @@ public: stdstr strStart; strStart += nChar; - // has there been another keypress since last search period? + // Has there been another keypress since last search period? if ( ( dwCurrentTick - m_dwSearchTick ) < SEARCH_PERIOD ) { if ( m_strSearchString.substr(0, 1 ) != strStart ) @@ -2717,7 +2713,7 @@ public: stdstr strFocusText = pT->GetItemText( nFocusItem, nSortIndex ); - // are we continuing to type characters under current focus item? + // Are we continuing to type characters under current focus item? if ( m_strSearchString.length() > 1 && _tcsicmp(m_strSearchString.c_str(),strFocusText.substr(0, m_strSearchString.length() ).c_str() ) == 0 ) { m_dwSearchTick = GetTickCount(); @@ -2733,7 +2729,7 @@ public: m_dwSearchTick = GetTickCount(); - // scan for next search string + // Scan for next search string for ( int nFirst = nStartItem; nFirst < pT->GetItemCount(); nFirst++ ) { stdstr strItemText = pT->GetItemText( nFirst, nSortIndex ); @@ -2746,7 +2742,7 @@ public: } } - // re-scan from top if not found search string + // Rescan from top if not found search string for ( int nSecond = 0; nSecond < pT->GetItemCount(); nSecond++ ) { stdstr strItemText = pT->GetItemText( nSecond, nSortIndex ); @@ -2799,7 +2795,7 @@ public: switch ( pListNotify->m_nExitChar ) { - case VK_ESCAPE: break; // do nothing + case VK_ESCAPE: break; // Do nothing case VK_DELETE: pT->SetItemText( pListNotify->m_nItem, nIndex, _T( "" ) ); NotifyParent( pListNotify->m_nItem, pListNotify->m_nSubItem, LCN_MODIFIED ); break; @@ -2833,7 +2829,7 @@ public: if ( lpDragHeader == NULL ) return DROPEFFECT_NONE; - // dragged column must originate from this control + // Dragged column must originate from this control if ( *( (HWND*)lpDragHeader ) == m_hWnd ) dwEffect = DropColumn( point ) ? DROPEFFECT_MOVE : DROPEFFECT_NONE; @@ -2853,7 +2849,7 @@ public: if ( lpDragHeader == NULL ) return DROPEFFECT_NONE; - // dragged column must originate from this control + // Dragged column must originate from this control if ( *( (HWND*)lpDragHeader ) == m_hWnd ) dwEffect = DropColumn( point ) ? DROPEFFECT_MOVE : DROPEFFECT_NONE; @@ -2873,7 +2869,7 @@ public: if ( !GetColumn( m_nDragColumn, listColumn ) ) return FALSE; - // move column to new position + // Move column to new position m_aColumns.RemoveAt( m_nDragColumn ); m_aColumns.InsertAt( ( m_nDragColumn < m_nHotColumn ? ( m_nHotDivider == 0 ? 0 : m_nHotDivider - 1 ) : m_nHotDivider ), listColumn ); Invalidate(); @@ -2882,7 +2878,7 @@ public: return TRUE; } - // not supported + // Not supported return FALSE; } @@ -2903,7 +2899,7 @@ public: if ( lpDragHeader == NULL ) return FALSE; - // store this window handle + // Store this window handle *( (HWND*)lpDragHeader ) = m_hWnd; GlobalUnlock( pStgMedium->hGlobal ); @@ -2953,13 +2949,13 @@ public: if ( m_bTileBackground ) { - // calculate tile image maximum rows and columns + // Calculate tile image maximum rows and columns div_t divRows = div( (int)rcClient.Height(), (int)sizBackground.cy ); int nTileRows = divRows.rem > 0 ? divRows.quot + 1 : divRows.quot; div_t divColumns = div( (int)rcClient.Width(), (int)sizBackground.cx ); int nTileColumns = divColumns.rem > 0 ? divColumns.quot + 1 : divColumns.quot; - // draw tiled background image + // Draw tiled background image for ( int nRow = 0; nRow <= nTileRows; nRow++ ) { for ( int nColumn = 0; nColumn <= nTileColumns; nColumn++ ) @@ -2970,21 +2966,21 @@ public: { CRect rcCentreImage( rcClient ); - // horizontally centre image if smaller than the client width + // Horizontally center image if smaller than the client width if ( sizBackground.cx < rcClient.Width() ) { rcCentreImage.left = ( rcClient.Width() / 2 ) - (int)( sizBackground.cx / 2 ); rcCentreImage.right = rcCentreImage.left + sizBackground.cx; } - // vertically centre image if smaller than the client height + // Vertically center image if smaller than the client height if ( sizBackground.cy + 16 < rcClient.Height() ) { rcCentreImage.top = ( rcClient.Height() / 2 ) - (int)( ( sizBackground.cy + 16 ) / 2 ); rcCentreImage.bottom = rcCentreImage.top + sizBackground.cy; } - // draw centred background image + // Draw centered background image dcPaint.BitBlt( rcCentreImage.left, rcCentreImage.top, rcCentreImage.Width(), rcCentreImage.Height(), dcBackgroundImage, 0, 0, SRCCOPY ); } @@ -3035,7 +3031,7 @@ public: if ( rcHeaderItem.left > rcClip.right ) break; - // draw header and divider + // Draw header and divider if ( nColumn == m_nHighlightColumn ) { dcPaint.SetBkColor( m_rgbHeaderHighlight ); @@ -3061,15 +3057,15 @@ public: if(listColumn.m_nImage == ITEM_IMAGE_NONE ) { - // offset text bounding rectangle to account for sorting arrow + // Offset text bounding rectangle to account for sorting arrow if ( bShowArrow && !listColumn.m_bFixed && listColumn.m_nIndex == m_nSortColumn ) rcHeaderText.right -= 15; } - // margin header text + // Margin header text rcHeaderText.DeflateRect( 4, 0, 5, 0 ); - // has this header item an associated image? + // Has this header item an associated image? if ( listColumn.m_nImage != ITEM_IMAGE_NONE ) { CSize sizeIcon; @@ -3086,7 +3082,7 @@ public: else m_ilListItems.DrawEx( listColumn.m_nImage, dcPaint, rcHeaderImage, CLR_DEFAULT, CLR_DEFAULT, ILD_TRANSPARENT ); - // offset header text (for image) + // Offset header text (for image) rcHeaderText.left += sizeIcon.cx + 4; } @@ -3103,11 +3099,11 @@ public: else nFormat |= DT_LEFT; - // draw header text + // Draw header text if ( !rcHeaderText.IsRectEmpty() && !listColumn.m_strText.empty() ) dcPaint.DrawText( listColumn.m_strText.c_str(), (int)listColumn.m_strText.length(), rcHeaderText, nFormat ); - // draw sorting arrow + // Draw sorting arrow if ( bShowArrow && !listColumn.m_bFixed && listColumn.m_nIndex == m_nSortColumn ) { CSize sizeIcon; @@ -3123,7 +3119,7 @@ public: } } - // draw a frame around all header columns + // Draw a frame around all header columns if ( nHeaderWidth > 0 ) dcPaint.Draw3dRect( CRect( rcHeader.left, rcHeader.top, rcHeader.right + 2, rcHeader.bottom ), m_rgbHeaderBorder, m_rgbHeaderShadow ); @@ -3187,7 +3183,7 @@ public: rcItem.top = ( m_bShowHeader ? m_nHeaderHeight : 0 ); rcItem.bottom = rcItem.top; - // draw all visible items + // Draw all visible items for ( int nItem = GetTopItem(); nItem < pT->GetItemCount(); rcItem.top = rcItem.bottom, nItem++ ) { rcItem.bottom = rcItem.top + m_nItemHeight; @@ -3197,7 +3193,7 @@ public: if ( rcItem.top > rcClip.bottom || rcItem.left > rcClip.right ) break; - // may be implemented in a derived class + // May be implemented in a derived class pT->DrawItem( dcPaint, nItem, rcItem ); } } @@ -3217,7 +3213,7 @@ public: BOOL bSelectedItem = IsSelected( nItem ); //BOOL bControlFocus = ( GetFocus() == m_hWnd || m_bEditItem ); - // draw selected background + // Draw selected background if ( bSelectedItem ) { dcPaint.SetBkColor( m_rgbSelectedItem ); @@ -3245,7 +3241,7 @@ public: UINT nItemFormat = pT->GetItemFormat( nItem, listColumn.m_nIndex ); UINT nItemFlags = pT->GetItemFlags( nItem, listColumn.m_nIndex ); - // custom draw subitem format + // Custom draw subitem format if ( nItemFormat == ITEM_FORMAT_CUSTOM ) { pT->DrawCustomItem( dcPaint, nItem, nSubItem, rcSubItem ); @@ -3288,7 +3284,7 @@ public: //rcItemText.left += nSubItem == 0 ? 4 : 3; //rcItemText.DeflateRect( 4, 0 ); - // draw subitem image if supplied + // Draw subitem image if supplied if ( !m_ilItemImages.IsNull() && nItemImage != ITEM_IMAGE_NONE && ( !m_bEditItem || ( m_bEditItem && !bFocusSubItem ) ) ) { CSize sizeIcon; @@ -3302,7 +3298,7 @@ public: m_ilItemImages.DrawEx( nItemImage, dcPaint, rcItemImage, CLR_DEFAULT, CLR_DEFAULT, ILD_TRANSPARENT ); - // offset item text (for image) + // Offset item text (for image) rcItemText.left += sizeIcon.cx + 4; } @@ -3373,10 +3369,10 @@ public: CRect rcProgress( rcSubItem ); rcProgress.DeflateRect( 3, 2 ); - // draw progress border + // Draw progress border DrawRoundRect( dcPaint, rcProgress, m_rgbHeaderShadow, m_rgbHeaderBackground ); - // fill progress bar area + // Fill progress bar area rcProgress.DeflateRect( 3, 3 ); rcProgress.right = rcProgress.left + (int)( (double)rcProgress.Width() * ( ( max( min( atof( strItemText ), 100 ), 0 ) ) / 100.0 ) ); DrawGradient( dcPaint, rcProgress, m_rgbProgressTop, m_rgbProgressBottom ); @@ -3387,7 +3383,7 @@ public: dcPaint.SelectFont( m_fntUnderlineFont ); dcPaint.SetTextColor( m_rgbHyperLink ); } - default: // draw item text + default: // Draw item text { size_t len = strlen(strItemText); if ( len > 0 ) @@ -3415,7 +3411,7 @@ public: GetClientRect( rcClient ); rcClient.top = ( m_bShowHeader ? m_nHeaderHeight : 0 ); - // limit box to list client area if scrolled to limits + // Limit box to list client area if scrolled to limits if ( nHorzScroll > ( GetTotalWidth() - rcClient.Width() ) ) rcGroupSelect.right = min( rcClient.right, rcGroupSelect.right ); if ( nHorzScroll == 0 ) @@ -3425,7 +3421,7 @@ public: if ( nVertScroll == 0 ) rcGroupSelect.top = max( rcClient.top, rcGroupSelect.top ); - // limit bitmap to client area + // Limit bitmap to client area CRect rcSelectArea( rcGroupSelect ); rcSelectArea.IntersectRect( rcSelectArea, rcClient ); @@ -3438,7 +3434,7 @@ public: bmpBackground.CreateCompatibleBitmap( dcPaint, rcSelectArea.Width(), rcSelectArea.Height() ); dcBackground.SelectBitmap( bmpBackground ); - // take a copy of existing backgroud + // Take a copy of existing background dcBackground.BitBlt( 0, 0, rcSelectArea.Width(), rcSelectArea.Height(), dcPaint, rcSelectArea.left, rcSelectArea.top, SRCCOPY ); CDC dcGroupSelect; @@ -3450,7 +3446,7 @@ public: bmpGroupSelect.CreateCompatibleBitmap( dcPaint, rcSelectArea.Width(), rcSelectArea.Height() ); dcGroupSelect.SelectBitmap( bmpGroupSelect ); - // draw group select box + // Draw group select box dcGroupSelect.SetBkColor( m_rgbItemFocus ); dcGroupSelect.ExtTextOut( 0, 0, ETO_OPAQUE, CRect( CPoint( 0 ), rcSelectArea.Size() ), _T( "" ), 0, NULL ); @@ -3460,13 +3456,13 @@ public: blendFunction.SourceConstantAlpha = 180; blendFunction.AlphaFormat = 0; - // blend existing background with selection box + // Blend existing background with selection box dcGroupSelect.AlphaBlend( 0, 0, rcSelectArea.Width(), rcSelectArea.Height(), dcBackground, 0, 0, rcSelectArea.Width(), rcSelectArea.Height(), blendFunction ); - // draw blended selection box + // Draw blended selection box dcPaint.BitBlt( rcSelectArea.left, rcSelectArea.top, rcSelectArea.Width(), rcSelectArea.Height(), dcGroupSelect, 0, 0, SRCCOPY ); - // draw selection box frame + // Draw selection box frame CBrush bshSelectFrame; bshSelectFrame.CreateSolidBrush( m_rgbItemText ); dcPaint.FrameRect( rcGroupSelect, bshSelectFrame ); @@ -3477,7 +3473,7 @@ public: void DrawCustomItem( CDCHandle dcPaint, int /*nItem*/, int /*nSubItem*/, CRect& /*rcSubItem*/ ) { - ATLASSERT( FALSE ); // must be implemented in a derived class + ATLASSERT( FALSE ); // Must be implemented in a derived class } }; @@ -3551,7 +3547,7 @@ public: for ( int nSubItem = 0; nSubItem < GetColumnCount(); nSubItem++ ) listItem.m_aSubItems.Add( listSubItem ); - // set item details for first subitem + // Set item details for first subitem listItem.m_aSubItems[ 0 ].m_strText = lpszText; listItem.m_aSubItems[ 0 ].m_nImage = nImage; @@ -3574,7 +3570,7 @@ public: for ( int nSubItem = 0; nSubItem < GetColumnCount(); nSubItem++ ) listItem.m_aSubItems.Add( listSubItem ); - // set item details for first subitem + // Set item details for first subitem listItem.m_aSubItems[ 0 ].m_strText = lpszText; listItem.m_aSubItems[ 0 ].m_nImage = nImage; diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListDate.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListDate.h index b5a1e9531..980e649ad 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListDate.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListDate.h @@ -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 ); } diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListEdit.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListEdit.h index c630c4a77..d82968ba2 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListEdit.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListEdit.h @@ -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 ); } diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListTypes.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListTypes.h index 240df57e3..74fd47be4 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListTypes.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/ListTypes.h @@ -1,4 +1,3 @@ - #pragma once #include "DataArray.h" diff --git a/Source/Project64/UserInterface/WTLControls/ClistCtrl/TitleTip.h b/Source/Project64/UserInterface/WTLControls/ClistCtrl/TitleTip.h index a807efa8d..e299d2359 100644 --- a/Source/Project64/UserInterface/WTLControls/ClistCtrl/TitleTip.h +++ b/Source/Project64/UserInterface/WTLControls/ClistCtrl/TitleTip.h @@ -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 ); diff --git a/Source/Project64/UserInterface/WTLControls/EditNumber32.cpp b/Source/Project64/UserInterface/WTLControls/EditNumber32.cpp index 15d7960b3..ea895ebc7 100644 --- a/Source/Project64/UserInterface/WTLControls/EditNumber32.cpp +++ b/Source/Project64/UserInterface/WTLControls/EditNumber32.cpp @@ -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()); -} \ No newline at end of file +} diff --git a/Source/Project64/UserInterface/WTLControls/GetCWindowText.cpp b/Source/Project64/UserInterface/WTLControls/GetCWindowText.cpp index 8f96c6697..79596a025 100644 --- a/Source/Project64/UserInterface/WTLControls/GetCWindowText.cpp +++ b/Source/Project64/UserInterface/WTLControls/GetCWindowText.cpp @@ -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()); -} \ No newline at end of file +} diff --git a/Source/Project64/UserInterface/WTLControls/GetCWindowText.h b/Source/Project64/UserInterface/WTLControls/GetCWindowText.h index 30240b528..af711da02 100644 --- a/Source/Project64/UserInterface/WTLControls/GetCWindowText.h +++ b/Source/Project64/UserInterface/WTLControls/GetCWindowText.h @@ -2,4 +2,3 @@ #include std::string GetCWindowText(const CWindow & window); - diff --git a/Source/Project64/UserInterface/WTLControls/HexEditCtrl.cpp b/Source/Project64/UserInterface/WTLControls/HexEditCtrl.cpp index 7c1a8532a..308e6517b 100644 --- a/Source/Project64/UserInterface/WTLControls/HexEditCtrl.cpp +++ b/Source/Project64/UserInterface/WTLControls/HexEditCtrl.cpp @@ -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::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; } diff --git a/Source/Project64/UserInterface/WTLControls/ModifiedComboBox.h b/Source/Project64/UserInterface/WTLControls/ModifiedComboBox.h index 7a6125680..ff5b17e2b 100644 --- a/Source/Project64/UserInterface/WTLControls/ModifiedComboBox.h +++ b/Source/Project64/UserInterface/WTLControls/ModifiedComboBox.h @@ -146,7 +146,6 @@ private: TParamList m_ParamList; - }; typedef CModifiedComboBoxT CModifiedComboBox; diff --git a/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.cpp b/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.cpp index bab5c3d24..7177a3837 100644 --- a/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.cpp +++ b/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.cpp @@ -84,4 +84,4 @@ void CModifiedEditBox::SetTextField(HWND hWnd) { ::SendMessage(m_TextField, WM_SETFONT, (WPARAM)m_BoldFont, 0); } -} \ No newline at end of file +} diff --git a/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.h b/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.h index b21fcd947..4199bfc99 100644 --- a/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.h +++ b/Source/Project64/UserInterface/WTLControls/ModifiedEditBox.h @@ -33,4 +33,3 @@ public: return m_bString; } }; - diff --git a/Source/Project64/UserInterface/WTLControls/PartialGroupBox.cpp b/Source/Project64/UserInterface/WTLControls/PartialGroupBox.cpp index f61ee4b9e..7819e3591 100644 --- a/Source/Project64/UserInterface/WTLControls/PartialGroupBox.cpp +++ b/Source/Project64/UserInterface/WTLControls/PartialGroupBox.cpp @@ -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)); diff --git a/Source/Project64/UserInterface/WTLControls/TooltipDialog.h b/Source/Project64/UserInterface/WTLControls/TooltipDialog.h index c4026e132..fca8f600b 100644 --- a/Source/Project64/UserInterface/WTLControls/TooltipDialog.h +++ b/Source/Project64/UserInterface/WTLControls/TooltipDialog.h @@ -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; } \ No newline at end of file +#define END_TOOLTIP_MAP() { 0 } }; return map; } diff --git a/Source/Project64/UserInterface/WTLControls/wtl-BitmapPicture.h b/Source/Project64/UserInterface/WTLControls/wtl-BitmapPicture.h index 70177122d..a52717358 100644 --- a/Source/Project64/UserInterface/WTLControls/wtl-BitmapPicture.h +++ b/Source/Project64/UserInterface/WTLControls/wtl-BitmapPicture.h @@ -29,4 +29,4 @@ private: BITMAP m_bmInfo; CBitmap m_hBitmap; CBrush m_BackgroundBrush; -}; \ No newline at end of file +};