Additional changes to r1207.

This commit is contained in:
Birunthan Mohanathas 2012-02-20 17:54:15 +00:00
parent 9683b8a8bf
commit 2b55ded523

View File

@ -605,7 +605,7 @@ void CDialogAbout::CTabSkins::Initialize()
// Add columns to the list view // Add columns to the list view
HWND item = GetDlgItem(m_Window, IDC_ABOUTMEASURES_ITEMS_LISTVIEW); HWND item = GetDlgItem(m_Window, IDC_ABOUTMEASURES_ITEMS_LISTVIEW);
ListView_SetExtendedListViewStyleEx(item, 0, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); ListView_SetExtendedListViewStyleEx(item, 0, LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
LVGROUP lvg; LVGROUP lvg;
lvg.cbSize = sizeof(LVGROUP); lvg.cbSize = sizeof(LVGROUP);
@ -752,26 +752,26 @@ void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
HWND item = GetDlgItem(m_Window, IDC_ABOUTMEASURES_ITEMS_LISTVIEW); HWND item = GetDlgItem(m_Window, IDC_ABOUTMEASURES_ITEMS_LISTVIEW);
SendMessage(item, WM_SETREDRAW, FALSE, 0); SendMessage(item, WM_SETREDRAW, FALSE, 0);
int count = ListView_GetItemCount(item); int count = ListView_GetItemCount(item);
int index = 0;
LVITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_GROUPID;
lvi.iSubItem = 0;
lvi.iItem = 0;
const std::list<CMeasure*>& measures = m_SkinWindow->GetMeasures(); const std::list<CMeasure*>& measures = m_SkinWindow->GetMeasures();
std::list<CMeasure*>::const_iterator j = measures.begin(); std::list<CMeasure*>::const_iterator j = measures.begin();
for ( ; j != measures.end(); ++j) for ( ; j != measures.end(); ++j)
{ {
const WCHAR* name = (*j)->GetName(); lvi.iGroupId = 0;
if (index < count) lvi.pszText = (WCHAR*)(*j)->GetName();
if (lvi.iItem < count)
{ {
ListView_SetItemText(item, index, 0, (WCHAR*)name); ListView_SetItem(item, &lvi);
} }
else else
{ {
LVITEM vitem; ListView_InsertItem(item, &lvi);
vitem.mask = LVIF_TEXT | LVIF_GROUPID;
vitem.iGroupId = 0;
vitem.iItem = index;
vitem.iSubItem = 0;
vitem.pszText = (WCHAR*)name;
ListView_InsertItem(item, &vitem);
} }
WCHAR buffer[256]; WCHAR buffer[256];
@ -781,38 +781,34 @@ void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
CMeasure::GetScaledValue(AUTOSCALE_ON, 1, (*j)->GetMaxValue(), buffer, _countof(buffer)); CMeasure::GetScaledValue(AUTOSCALE_ON, 1, (*j)->GetMaxValue(), buffer, _countof(buffer));
range += buffer; range += buffer;
ListView_SetItemText(item, index, 1, (WCHAR*)range.c_str()); ListView_SetItemText(item, lvi.iItem, 1, (WCHAR*)range.c_str());
ListView_SetItemText(item, index, 2, (WCHAR*)(*j)->GetStringValue(AUTOSCALE_OFF, 1, -1, false)); ListView_SetItemText(item, lvi.iItem, 2, (WCHAR*)(*j)->GetStringValue(AUTOSCALE_OFF, 1, -1, false));
++index; ++lvi.iItem;
} }
const auto& variables = m_SkinWindow->GetParser().GetVariables(); const auto& variables = m_SkinWindow->GetParser().GetVariables();
for (auto iter = variables.cbegin(); iter != variables.cend(); ++iter) for (auto iter = variables.cbegin(); iter != variables.cend(); ++iter)
{ {
const WCHAR* name = (*iter).first.c_str(); lvi.iGroupId = 1;
if (index < count) lvi.pszText = (WCHAR*)(*iter).first.c_str();
if (lvi.iItem < count)
{ {
ListView_SetItemText(item, index, 0, (WCHAR*)name); ListView_SetItem(item, &lvi);
} }
else else
{ {
LVITEM vitem; ListView_InsertItem(item, &lvi);
vitem.mask = LVIF_TEXT | LVIF_GROUPID;
vitem.iGroupId = 1;
vitem.iItem = index;
vitem.iSubItem = 0;
vitem.pszText = (WCHAR*)name;
ListView_InsertItem(item, &vitem);
} }
ListView_SetItemText(item, index, 2, (WCHAR*)(*iter).second.c_str()); ListView_SetItemText(item, lvi.iItem, 2, (WCHAR*)(*iter).second.c_str());
++index; ++lvi.iItem;
} }
// Delete unnecessary items // Delete unnecessary items
while (count > index) while (count > lvi.iItem)
{ {
ListView_DeleteItem(item, index); ListView_DeleteItem(item, lvi.iItem);
--count; --count;
} }