*
* @date Created: 2003-08-19
*/
-// ID line follows -- this is updated by SVN
-// $Id$
#include "stdafx.h"
#include "DirColsDlg.h"
#include <algorithm>
-#include "Merge.h"
#ifdef _DEBUG
#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
* @brief Default dialog constructor.
* @param [in] pParent Dialog's parent component (window).
*/
-CDirColsDlg::CDirColsDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CDirColsDlg::IDD, pParent)
+CDirColsDlg::CDirColsDlg(CWnd* pParent /*= nullptr*/)
+ : CTrDialog(CDirColsDlg::IDD, pParent)
, m_bReset(false)
{
}
*/
void CDirColsDlg::DoDataExchange(CDataExchange* pDX)
{
- CDialog::DoDataExchange(pDX);
+ CTrDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDirColsDlg)
DDX_Control(pDX, IDC_COLDLG_LIST, m_listColumns);
//}}AFX_DATA_MAP
}
-BEGIN_MESSAGE_MAP(CDirColsDlg, CDialog)
+BEGIN_MESSAGE_MAP(CDirColsDlg, CTrDialog)
//{{AFX_MSG_MAP(CDirColsDlg)
ON_BN_CLICKED(IDC_UP, OnUp)
ON_BN_CLICKED(IDC_DOWN, OnDown)
*/
void CDirColsDlg::InitList()
{
+ const int lpx = CClientDC(this).GetDeviceCaps(LOGPIXELSX);
+ auto pointToPixel = [lpx](int point) { return MulDiv(point, lpx, 72); };
+
// Show selection across entire row.
// Also enable infotips.
m_listColumns.SetExtendedStyle(LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);
- m_listColumns.InsertColumn(0, _T(""), LVCFMT_LEFT, 150);
+ m_listColumns.InsertColumn(0, _T(""), LVCFMT_LEFT, pointToPixel(148));
}
/**
*/
BOOL CDirColsDlg::OnInitDialog()
{
- theApp.TranslateDialog(m_hWnd);
- CDialog::OnInitDialog();
+ CTrDialog::OnInitDialog();
InitList();
LoadLists();
{
// Get current column data
String text = m_listColumns.GetItemText(index, 0);
- BOOL checked = m_listColumns.GetCheck(index);
+ bool checked = !!m_listColumns.GetCheck(index);
UINT state = m_listColumns.GetItemState(index, LVIS_SELECTED);
DWORD_PTR data = m_listColumns.GetItemData(index);
/**
* @brief Move selected items one position up or down.
- * @param [in] bUp If TRUE items are moved up,
- * if FALSE items are moved down.
+ * @param [in] bUp If `true` items are moved up,
+ * if `false` items are moved down.
*/
void CDirColsDlg::MoveSelectedItems(bool bUp)
{
int firstInd = -1;
POSITION pos = m_listColumns.GetFirstSelectedItemPosition();
- while (pos)
+ while (pos != nullptr)
{
int ind = m_listColumns.GetNextSelectedItem(pos);
int newInd = bUp ? ind - 1: ind + 1;
*/
void CDirColsDlg::OnUp()
{
- MoveSelectedItems(TRUE);
+ MoveSelectedItems(true);
}
/**
*/
void CDirColsDlg::OnDown()
{
- MoveSelectedItems(FALSE);
+ MoveSelectedItems(false);
}
/**
for (int i = 0; i < m_listColumns.GetItemCount(); i++)
{
- BOOL checked = m_listColumns.GetCheck(i);
+ bool checked = !!m_listColumns.GetCheck(i);
DWORD_PTR data = m_listColumns.GetItemData(i);
column & col1 = m_cols[data];
if (checked)
col1.phy_col = -1;
}
- CDialog::OnOK();
+ CTrDialog::OnOK();
}
/**
{
POSITION pos = m_listColumns.GetFirstSelectedItemPosition();
- if (pos)
+ if (pos != nullptr)
{
int ind = m_listColumns.GetNextSelectedItem(pos);
DWORD_PTR data = m_listColumns.GetItemData(ind);
ColumnArray::size_type j;
for (j = 0; j < m_cols.size(); j++)
{
- if (m_cols[j].log_col == data)
+ if (static_cast<DWORD_PTR>(m_cols[j].log_col) == data)
break;
}
- GetDlgItem(IDC_COLDLG_DESC)->SetWindowText(m_cols[j].desc.c_str());
+ SetDlgItemText(IDC_COLDLG_DESC, m_cols[j].desc);
// Disable Up/Down -buttons when first/last items are selected.
- if (ind == 0)
- GetDlgItem(IDC_UP)->EnableWindow(FALSE);
- else
- GetDlgItem(IDC_UP)->EnableWindow(TRUE);
-
- if (ind == m_listColumns.GetItemCount() - m_listColumns.GetSelectedCount())
- GetDlgItem(IDC_DOWN)->EnableWindow(FALSE);
- else
- GetDlgItem(IDC_DOWN)->EnableWindow(TRUE);
-
+ EnableDlgItem(IDC_UP, ind != 0);
+ EnableDlgItem(IDC_DOWN,
+ ind != m_listColumns.GetItemCount() - static_cast<int>(m_listColumns.GetSelectedCount()));
}
*pResult = 0;
}