summaryrefslogtreecommitdiffstats
path: root/docs/release/src/osd/winui/picker.cpp
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2018-02-01 01:13:16 +1100
committer Robbbert <Robbbert@users.noreply.github.com>2018-02-01 01:13:16 +1100
commit73ce78f7b4d4c1ff8ed36f6fef61fc00a2e9135e (patch)
tree7a50841459d42fee5739652092d6629870f81e3e /docs/release/src/osd/winui/picker.cpp
parent6488544820bbf9bc96bd2f29bbc0a8b7c0b246fa (diff)
0.193 Release filestag193
Diffstat (limited to 'docs/release/src/osd/winui/picker.cpp')
-rw-r--r--docs/release/src/osd/winui/picker.cpp524
1 files changed, 223 insertions, 301 deletions
diff --git a/docs/release/src/osd/winui/picker.cpp b/docs/release/src/osd/winui/picker.cpp
index 894687b9a2f..300c63be467 100644
--- a/docs/release/src/osd/winui/picker.cpp
+++ b/docs/release/src/osd/winui/picker.cpp
@@ -1,36 +1,23 @@
// For licensing and usage information, read docs/winui_license.txt
+// MASTER
//****************************************************************************
// standard windows headers
#define _WIN32_IE 0x0501
#include <windows.h>
#include <windowsx.h>
-#include <shellapi.h>
#include <commctrl.h>
-#include <commdlg.h>
-#include <wingdi.h>
// standard C headers
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <time.h>
#include <tchar.h>
// MAME/MAMEUI headers
#include "picker.h"
#include "winui.h"
-#include "mui_util.h" // For dprintf
#include "mui_opts.h"
-#include "bitmask.h"
-#include "treeview.h" // For GetParentFound()
+#include "treeview.h"
-#ifdef __GNUC__
-#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
-#endif
-
// fix warning: cast does not match function type
#if defined(__GNUC__) && defined(ListView_GetHeader)
#undef ListView_GetHeader
@@ -87,15 +74,13 @@ struct PickerInfo
static struct PickerInfo *GetPickerInfo(HWND hWnd)
{
- LONG_PTR l;
- l = GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ LONG_PTR l = GetWindowLongPtr(hWnd, GWLP_USERDATA);
return (struct PickerInfo *) l;
}
-static LRESULT CallParentWndProc(WNDPROC pfnParentWndProc,
- HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+static LRESULT CallParentWndProc(WNDPROC pfnParentWndProc, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT rc;
@@ -111,40 +96,34 @@ static LRESULT CallParentWndProc(WNDPROC pfnParentWndProc,
static BOOL ListViewOnErase(HWND hWnd, HDC hDC)
{
- RECT rcClient;
- HRGN rgnBitmap;
- HPALETTE hPAL;
-
- int i, j;
- HDC htempDC;
- POINT ptOrigin;
- POINT pt = {0,0};
- HBITMAP hOldBitmap;
MYBITMAPINFO *pbmDesc = GetBackgroundInfo();
- HBITMAP hBackground = GetBackgroundBitmap();
- HPALETTE hPALbg = GetBackgroundPalette();
+ HBITMAP hBackground = GetBackgroundBitmap();
+ HPALETTE hPALbg = GetBackgroundPalette();
// this does not draw the background properly in report view
+ RECT rcClient;
GetClientRect(hWnd, &rcClient);
- htempDC = CreateCompatibleDC(hDC);
- hOldBitmap = (HBITMAP)SelectObject(htempDC, hBackground);
+ HDC htempDC = CreateCompatibleDC(hDC);
+ HBITMAP hOldBitmap = (HBITMAP)SelectObject(htempDC, hBackground);
- rgnBitmap = CreateRectRgnIndirect(&rcClient);
+ HRGN rgnBitmap = CreateRectRgnIndirect(&rcClient);
SelectClipRgn(hDC, rgnBitmap);
DeleteBitmap(rgnBitmap);
- hPAL = (!hPALbg) ? CreateHalftonePalette(hDC) : hPALbg;
+ HPALETTE hPAL = (!hPALbg) ? CreateHalftonePalette(hDC) : hPALbg;
if (GetDeviceCaps(htempDC, RASTERCAPS) & RC_PALETTE && hPAL != NULL)
{
- SelectPalette(htempDC, hPAL, FALSE);
+ SelectPalette(htempDC, hPAL, false);
RealizePalette(htempDC);
}
// Get x and y offset
+ POINT pt = {0,0};
MapWindowPoints(hWnd, GetTreeView(), &pt, 1);
+ POINT ptOrigin;
GetDCOrgEx(hDC, &ptOrigin);
ptOrigin.x -= pt.x;
ptOrigin.y -= pt.y;
@@ -152,11 +131,9 @@ static BOOL ListViewOnErase(HWND hWnd, HDC hDC)
ptOrigin.y = -GetScrollPos(hWnd, SB_VERT);
if (pbmDesc->bmWidth && pbmDesc->bmHeight)
- {
- for (i = ptOrigin.x; i < rcClient.right; i += pbmDesc->bmWidth)
- for (j = ptOrigin.y; j < rcClient.bottom; j += pbmDesc->bmHeight)
+ for (int i = ptOrigin.x; i < rcClient.right; i += pbmDesc->bmWidth)
+ for (int j = ptOrigin.y; j < rcClient.bottom; j += pbmDesc->bmHeight)
BitBlt(hDC, i, j, pbmDesc->bmWidth, pbmDesc->bmHeight, htempDC, 0, 0, SRCCOPY);
- }
SelectObject(htempDC, hOldBitmap);
DeleteDC(htempDC);
@@ -167,31 +144,29 @@ static BOOL ListViewOnErase(HWND hWnd, HDC hDC)
hPAL = 0;
}
- return TRUE;
+ return true;
}
static BOOL ListViewNotify(HWND hWnd, LPNMHDR lpNmHdr)
{
- RECT rcClient;
- DWORD dwPos;
- POINT pt;
-
// This code is for using bitmap in the background
// Invalidate the right side of the control when a column is resized
if (lpNmHdr->code == HDN_ITEMCHANGINGA || lpNmHdr->code == HDN_ITEMCHANGINGW)
{
- dwPos = GetMessagePos();
+ DWORD dwPos = GetMessagePos();
+ POINT pt;
pt.x = LOWORD(dwPos);
pt.y = HIWORD(dwPos);
+ RECT rcClient;
GetClientRect(hWnd, &rcClient);
ScreenToClient(hWnd, &pt);
rcClient.left = pt.x;
- InvalidateRect(hWnd, &rcClient, FALSE);
+ InvalidateRect(hWnd, &rcClient, false);
}
- return FALSE;
+ return false;
}
@@ -199,28 +174,27 @@ static BOOL ListViewNotify(HWND hWnd, LPNMHDR lpNmHdr)
static BOOL ListViewContextMenu(HWND hwndPicker, LPARAM lParam)
{
struct PickerInfo *pPickerInfo;
- POINT pt, headerPt;
- int i, nViewID, nColumn = -1;
- HWND hwndHeader;
- RECT rcCol;
-
pPickerInfo = GetPickerInfo(hwndPicker);
// Extract the point out of the lparam
+ POINT pt;
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
if (pt.x < 0 && pt.y < 0)
GetCursorPos(&pt);
// Figure out which header column was clicked, if at all
- nViewID = Picker_GetViewID(hwndPicker);
+ int nViewID = Picker_GetViewID(hwndPicker);
+ int nColumn = -1;
+
if ((nViewID == VIEW_REPORT) || (nViewID == VIEW_GROUPED))
{
- hwndHeader = ListView_GetHeader(hwndPicker);
- headerPt = pt;
+ HWND hwndHeader = ListView_GetHeader(hwndPicker);
+ POINT headerPt = pt;
ScreenToClient(hwndHeader, &headerPt);
- for (i = 0; Header_GetItemRect(hwndHeader, i, &rcCol); i++)
+ RECT rcCol;
+ for (int i = 0; Header_GetItemRect(hwndHeader, i, &rcCol); i++)
{
if (PtInRect(&rcCol, headerPt))
{
@@ -242,7 +216,7 @@ static BOOL ListViewContextMenu(HWND hwndPicker, LPARAM lParam)
if (pPickerInfo->pCallbacks->pfnOnBodyContextMenu)
pPickerInfo->pCallbacks->pfnOnBodyContextMenu(pt);
}
- return TRUE;
+ return true;
}
@@ -263,7 +237,7 @@ static LRESULT CALLBACK ListViewWndProc(HWND hWnd, UINT message, WPARAM wParam,
{
struct PickerInfo *pPickerInfo;
LRESULT rc = 0;
- BOOL bHandled = FALSE;
+ BOOL bHandled = false;
WNDPROC pfnParentWndProc;
HWND hwndHeaderCtrl = NULL;
HFONT hHeaderCtrlFont = NULL;
@@ -273,16 +247,16 @@ static LRESULT CALLBACK ListViewWndProc(HWND hWnd, UINT message, WPARAM wParam,
switch(message)
{
- case WM_MOUSEMOVE:
+ case WM_MOUSEMOVE:
if (MouseHasBeenMoved())
- ShowCursor(TRUE);
+ ShowCursor(true);
break;
case WM_ERASEBKGND:
if (GetBackgroundBitmap())
{
rc = ListViewOnErase(hWnd, (HDC) wParam);
- bHandled = TRUE;
+ bHandled = true;
}
break;
@@ -315,7 +289,7 @@ static LRESULT CALLBACK ListViewWndProc(HWND hWnd, UINT message, WPARAM wParam,
// If we received WM_SETFONT, reset header ctrl font back to original font
if (hwndHeaderCtrl)
- SetWindowFont(hwndHeaderCtrl, hHeaderCtrlFont, TRUE);
+ SetWindowFont(hwndHeaderCtrl, hHeaderCtrlFont, true);
return rc;
}
@@ -326,19 +300,17 @@ static LRESULT CALLBACK ListViewWndProc(HWND hWnd, UINT message, WPARAM wParam,
static void Picker_InternalResetColumnDisplay(HWND hWnd, BOOL bFirstTime)
{
LV_COLUMN lvc;
- int i;
- int nColumn;
- int *widths;
- int *order;
- int *shown;
+ int i = 0;
+ int nColumn = 0;
//int shown_columns;
LVCOLUMN col;
struct PickerInfo *pPickerInfo;
- HRESULT res;
- BOOL b_res;
+ HRESULT res = 0;
+ BOOL b_res = 0;
pPickerInfo = GetPickerInfo(hWnd);
+ int *widths, *order, *shown;
widths = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*widths));
order = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*order));
shown = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*shown));
@@ -357,8 +329,7 @@ static void Picker_InternalResetColumnDisplay(HWND hWnd, BOOL bFirstTime)
DWORD style = GetWindowLong(hWnd, GWL_STYLE);
// switch the list view to LVS_REPORT style so column widths reported correctly
- SetWindowLong(hWnd, GWL_STYLE,
- (GetWindowLong(hWnd, GWL_STYLE) & ~LVS_TYPEMASK) | LVS_REPORT);
+ SetWindowLong(hWnd, GWL_STYLE, (GetWindowLong(hWnd, GWL_STYLE) & ~LVS_TYPEMASK) | LVS_REPORT);
// Retrieve each of the column widths
i = 0;
@@ -387,12 +358,13 @@ static void Picker_InternalResetColumnDisplay(HWND hWnd, BOOL bFirstTime)
lvc.iSubItem = nColumn;
lvc.cx = widths[order[i]];
lvc.fmt = LVCFMT_LEFT;
- res = ListView_InsertColumn(hWnd, nColumn, &lvc);
- pPickerInfo->pnColumnsOrder[nColumn] = order[i];
-
- dprintf("Visible column %d: Logical column %d; Width=%d\n", nColumn, order[i], widths[order[i]]);
-
- nColumn++;
+ if (lvc.pszText[0] > 0) // column name cannot be blank
+ {
+ res = ListView_InsertColumn(hWnd, nColumn, &lvc);
+ pPickerInfo->pnColumnsOrder[nColumn] = order[i];
+ //printf("Visible column %d: Logical column %d; Width=%d\n", nColumn, order[i], widths[order[i]]);
+ nColumn++;
+ }
}
}
@@ -420,13 +392,15 @@ done:
free(order);
if (shown)
free(shown);
+ res++;
+ b_res++;
}
void Picker_ResetColumnDisplay(HWND hWnd)
{
- Picker_InternalResetColumnDisplay(hWnd, FALSE);
+ Picker_InternalResetColumnDisplay(hWnd, false);
}
@@ -445,17 +419,15 @@ void Picker_ClearIdle(HWND hwndPicker)
-static void CALLBACK Picker_TimerProc(HWND hwndPicker, UINT uMsg,
- UINT_PTR idEvent, DWORD dwTime)
+static void CALLBACK Picker_TimerProc(HWND hwndPicker, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
struct PickerInfo *pPickerInfo;
- BOOL bContinueIdle;
- DWORD nTickCount, nBaseTickCount;
+ DWORD nTickCount = 0;
DWORD nMaxIdleTicks = 50;
pPickerInfo = GetPickerInfo(hwndPicker);
- bContinueIdle = FALSE;
- nBaseTickCount = GetTickCount();
+ BOOL bContinueIdle = false;
+ DWORD nBaseTickCount = GetTickCount();
// This idle procedure will loop until either idling is over, or until
// a specified amount of time elapses (in this case, 50ms). This frees
@@ -476,7 +448,7 @@ static void CALLBACK Picker_TimerProc(HWND hwndPicker, UINT uMsg,
// Instructs this picker to reset idling; idling will continue until the
-// idle function returns FALSE
+// idle function returns false
void Picker_ResetIdle(HWND hwndPicker)
{
struct PickerInfo *pPickerInfo;
@@ -502,16 +474,16 @@ BOOL Picker_IsIdling(HWND hwndPicker)
BOOL SetupPicker(HWND hwndPicker, const struct PickerOptions *pOptions)
{
struct PickerInfo *pPickerInfo;
- int i;
- LONG_PTR l;
- HRESULT res;
+ int i = 0;
+ LONG_PTR l = 0;
+ HRESULT res = 0;
- assert(hwndPicker);
+ //assert(hwndPicker);
// Allocate the list view struct
pPickerInfo = (struct PickerInfo *) malloc(sizeof(struct PickerInfo));
if (!pPickerInfo)
- return FALSE;
+ return false;
// And fill it out
memset(pPickerInfo, 0, sizeof(*pPickerInfo));
@@ -534,7 +506,7 @@ BOOL SetupPicker(HWND hwndPicker, const struct PickerOptions *pOptions)
for (i = 0; i < pPickerInfo->nColumnCount; i++)
{
pPickerInfo->pnColumnsOrder[i] = i;
- pPickerInfo->pnColumnsShown[i] = TRUE;
+ pPickerInfo->pnColumnsShown[i] = true;
}
if (GetUseOldControl())
@@ -562,14 +534,15 @@ BOOL SetupPicker(HWND hwndPicker, const struct PickerOptions *pOptions)
res = ListView_SetExtendedListViewStyle(hwndPicker, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP |
LVS_EX_UNDERLINEHOT | LVS_EX_UNDERLINECOLD | LVS_EX_LABELTIP);
- Picker_InternalResetColumnDisplay(hwndPicker, TRUE);
+ Picker_InternalResetColumnDisplay(hwndPicker, true);
Picker_ResetIdle(hwndPicker);
- return TRUE;
+ res++;
+ return true;
error:
if (pPickerInfo)
Picker_Free(pPickerInfo);
- return FALSE;
+ return false;
}
@@ -586,9 +559,6 @@ int Picker_GetViewID(HWND hwndPicker)
void Picker_SetViewID(HWND hwndPicker, int nViewID)
{
struct PickerInfo *pPickerInfo;
- LONG_PTR nListViewStyle;
- DWORD dwStyle;
-
pPickerInfo = GetPickerInfo(hwndPicker);
// Change the nCurrentViewID member
@@ -597,6 +567,7 @@ void Picker_SetViewID(HWND hwndPicker, int nViewID)
pPickerInfo->pCallbacks->pfnSetViewMode(pPickerInfo->nCurrentViewID);
// Change the ListView flags in accordance
+ LONG_PTR nListViewStyle;
switch(nViewID)
{
case VIEW_LARGE_ICONS:
@@ -615,7 +586,7 @@ void Picker_SetViewID(HWND hwndPicker, int nViewID)
break;
}
- dwStyle = GetWindowLong(hwndPicker, GWL_STYLE);
+ DWORD dwStyle = GetWindowLong(hwndPicker, GWL_STYLE);
if (GetUseXPControl())
{
// RS Microsoft must have changed something in the Ownerdraw handling with Version 6 of the Common Controls
@@ -629,8 +600,7 @@ void Picker_SetViewID(HWND hwndPicker, int nViewID)
// to properly get them to arrange, otherwise the entries might overlap
// we have to call SetWindowLong to get it into effect !!
// It's no use just setting the Style, as it's changed again further down...
- SetWindowLong(hwndPicker, GWL_STYLE, (GetWindowLong(hwndPicker, GWL_STYLE)
- & ~LVS_TYPEMASK) | LVS_ICON);
+ SetWindowLong(hwndPicker, GWL_STYLE, (GetWindowLong(hwndPicker, GWL_STYLE) & ~LVS_TYPEMASK) | LVS_ICON);
}
}
else
@@ -647,71 +617,63 @@ void Picker_SetViewID(HWND hwndPicker, int nViewID)
}
-
static BOOL PickerHitTest(HWND hWnd)
{
- RECT rect;
- POINTS p;
- DWORD res = GetMessagePos();
- LVHITTESTINFO htInfo;
- HRESULT result;
-
- memset(&htInfo, 0, sizeof(htInfo));
- p = MAKEPOINTS(res);
+ LVHITTESTINFO htInfo;
+ memset(&htInfo, 0, sizeof(htInfo));
+ RECT rect;
GetWindowRect(hWnd, &rect);
+ DWORD res = GetMessagePos();
+ POINTS p = MAKEPOINTS(res);
htInfo.pt.x = p.x - rect.left;
htInfo.pt.y = p.y - rect.top;
- result = ListView_HitTest(hWnd, &htInfo);
-
+ HRESULT result = ListView_HitTest(hWnd, &htInfo);
+ result++;
return (! (htInfo.flags & LVHT_NOWHERE));
}
-
int Picker_GetSelectedItem(HWND hWnd)
{
- int nItem;
- LV_ITEM lvi;
- BOOL res;
-
- nItem = ListView_GetNextItem(hWnd, -1, LVIS_SELECTED | LVIS_FOCUSED);
+ int nItem = ListView_GetNextItem(hWnd, -1, LVIS_SELECTED | LVIS_FOCUSED);
if (nItem < 0)
- return 0;
+ return nItem;
+ LV_ITEM lvi;
memset(&lvi, 0, sizeof(lvi));
lvi.iItem = nItem;
lvi.mask = LVIF_PARAM;
- res = ListView_GetItem(hWnd, &lvi);
+ BOOL res = ListView_GetItem(hWnd, &lvi);
+ res++;
return lvi.lParam;
}
-
-void Picker_SetSelectedPick(HWND hWnd, int nIndex)
+// This highlights a selected game, and scrolls it into view
+void Picker_SetSelectedPick(HWND hWnd, uint32_t nIndex)
{
- BOOL res;
-
- if (nIndex < 0)
- nIndex = 0;
-
- ListView_SetItemState(hWnd, nIndex, LVIS_FOCUSED | LVIS_SELECTED,
- LVIS_FOCUSED | LVIS_SELECTED);
- res = ListView_EnsureVisible(hWnd, nIndex, FALSE);
+ // nCount is one more than number of last game
+ int nCount = ListView_GetItemCount(hWnd);
+ // No games to show
+ if (nCount < 1)
+ return;
+ nCount--;
+ if (nCount < nIndex)
+ nIndex = nCount;
+ // Highlight a game
+ ListView_SetItemState(hWnd, nIndex, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
+ // Bring the game into view
+ (void)ListView_EnsureVisible(hWnd, nIndex, false);
}
-void Picker_SetSelectedItem(HWND hWnd, int nItem)
+void Picker_SetSelectedItem(HWND hWnd, uint32_t nItem)
{
- int i;
LV_FINDINFO lvfi;
-
- if (nItem < 0)
- return;
-
lvfi.flags = LVFI_PARAM;
lvfi.lParam = nItem;
- i = ListView_FindItem(hWnd, -1, &lvfi);
+ int i = ListView_FindItem(hWnd, -1, &lvfi);
if (i == -1)
{
POINT p = {0,0};
@@ -724,8 +686,7 @@ void Picker_SetSelectedItem(HWND hWnd, int nItem)
-static const TCHAR *Picker_CallGetItemString(HWND hwndPicker,
- int nItem, int nColumn, TCHAR *pszBuffer, UINT nBufferLength)
+static const TCHAR *Picker_CallGetItemString(HWND hwndPicker, int nItem, int nColumn, TCHAR *pszBuffer, UINT nBufferLength)
{
// this call wraps the pfnGetItemString callback to properly set up the
// buffers, and normalize the results
@@ -737,10 +698,8 @@ static const TCHAR *Picker_CallGetItemString(HWND hwndPicker,
s = NULL;
if (pPickerInfo->pCallbacks->pfnGetItemString)
- {
- s = pPickerInfo->pCallbacks->pfnGetItemString(hwndPicker,
- nItem, nColumn, pszBuffer, nBufferLength);
- }
+ s = pPickerInfo->pCallbacks->pfnGetItemString(hwndPicker, nItem, nColumn, pszBuffer, nBufferLength);
+
if (!s)
s = pszBuffer;
return s;
@@ -752,23 +711,17 @@ static const TCHAR *Picker_CallGetItemString(HWND hwndPicker,
static void Picker_ResetHeaderSortIcon(HWND hwndPicker)
{
struct PickerInfo *pPickerInfo;
- HWND hwndHeader;
- HD_ITEM hdi;
- int i, nViewColumn;
- BOOL res;
-
pPickerInfo = GetPickerInfo(hwndPicker);
-
- hwndHeader = ListView_GetHeader(hwndPicker);
+ HWND hwndHeader = ListView_GetHeader(hwndPicker);
+ BOOL res;
// take arrow off non-current columns
+ HD_ITEM hdi;
hdi.mask = HDI_FORMAT;
hdi.fmt = HDF_STRING;
- for (i = 0; i < pPickerInfo->nColumnCount; i++)
- {
+ for (int i = 0; i < pPickerInfo->nColumnCount; i++)
if (i != pPickerInfo->pCallbacks->pfnGetSortColumn())
res = Header_SetItem(hwndHeader, Picker_GetViewColumnFromRealColumn(hwndPicker, i), &hdi);
- }
if (GetUseXPControl())
{
@@ -784,8 +737,9 @@ static void Picker_ResetHeaderSortIcon(HWND hwndPicker)
hdi.iImage = pPickerInfo->pCallbacks->pfnGetSortReverse() ? 1 : 0;
}
- nViewColumn = Picker_GetViewColumnFromRealColumn(hwndPicker, pPickerInfo->pCallbacks->pfnGetSortColumn());
+ int nViewColumn = Picker_GetViewColumnFromRealColumn(hwndPicker, pPickerInfo->pCallbacks->pfnGetSortColumn());
res = Header_SetItem(hwndHeader, nViewColumn, &hdi);
+ res++;
}
@@ -801,8 +755,7 @@ struct CompareProcParams
-static void Picker_PopulateCompareProcParams(HWND hwndPicker,
- struct CompareProcParams *pParams)
+static void Picker_PopulateCompareProcParams(HWND hwndPicker, struct CompareProcParams *pParams)
{
struct PickerInfo *pPickerInfo;
@@ -825,8 +778,8 @@ static int CALLBACK Picker_CompareProc(LPARAM index1, LPARAM index2, LPARAM nPar
{
struct CompareProcParams *pcpp = (struct CompareProcParams *) nParamSort;
struct PickerInfo *pPickerInfo = pcpp->pPickerInfo;
- BOOL bCallCompare = TRUE;
- int nResult = 0, nParent1, nParent2;
+ BOOL bCallCompare = true;
+ int nResult = 0, nParent1 = 0, nParent2 = 0;
TCHAR szBuffer1[256], szBuffer2[256];
const TCHAR *s1, *s2;
@@ -868,7 +821,7 @@ static int CALLBACK Picker_CompareProc(LPARAM index1, LPARAM index2, LPARAM nPar
{
// if this is a child and its parent, put child after
nResult = 1;
- bCallCompare = FALSE;
+ bCallCompare = false;
}
else
{
@@ -883,7 +836,7 @@ static int CALLBACK Picker_CompareProc(LPARAM index1, LPARAM index2, LPARAM nPar
{
// if this is a child and its parent, put child after
nResult = -1;
- bCallCompare = FALSE;
+ bCallCompare = false;
}
else
{
@@ -905,9 +858,9 @@ static int CALLBACK Picker_CompareProc(LPARAM index1, LPARAM index2, LPARAM nPar
{
// no default sort proc, just get the string and compare them
s1 = Picker_CallGetItemString(pcpp->hwndPicker, index1, pcpp->nSortColumn,
- szBuffer1, ARRAY_LENGTH(szBuffer1));
+ szBuffer1, sizeof(szBuffer1) / sizeof(szBuffer1[0]));
s2 = Picker_CallGetItemString(pcpp->hwndPicker, index2, pcpp->nSortColumn,
- szBuffer2, ARRAY_LENGTH(szBuffer2));
+ szBuffer2, sizeof(szBuffer2) / sizeof(szBuffer2[0]));
nResult = _tcsicmp(s1, s2);
}
@@ -921,27 +874,26 @@ static int CALLBACK Picker_CompareProc(LPARAM index1, LPARAM index2, LPARAM nPar
void Picker_Sort(HWND hwndPicker)
{
- LV_FINDINFO lvfi;
//struct PickerInfo *pPickerInfo;
struct CompareProcParams params;
- int nItem;
- BOOL res;
//pPickerInfo = GetPickerInfo(hwndPicker);
// populate the CompareProcParams structure
Picker_PopulateCompareProcParams(hwndPicker, &params);
- res = ListView_SortItems(hwndPicker, Picker_CompareProc, (LPARAM) &params);
+ BOOL res = ListView_SortItems(hwndPicker, Picker_CompareProc, (LPARAM) &params);
Picker_ResetHeaderSortIcon(hwndPicker);
+ LV_FINDINFO lvfi;
memset(&lvfi, 0, sizeof(lvfi));
lvfi.flags = LVFI_PARAM;
lvfi.lParam = Picker_GetSelectedItem(hwndPicker);
- nItem = ListView_FindItem(hwndPicker, -1, &lvfi);
+ int nItem = ListView_FindItem(hwndPicker, -1, &lvfi);
- res = ListView_EnsureVisible(hwndPicker, nItem, FALSE);
+ res = ListView_EnsureVisible(hwndPicker, nItem, false);
+ res++;
}
@@ -949,16 +901,15 @@ void Picker_Sort(HWND hwndPicker)
int Picker_InsertItemSorted(HWND hwndPicker, int nParam)
{
//struct PickerInfo *pPickerInfo;
- int nHigh, nLow, nMid;
+ int nLow = 0, nMid = 0;
struct CompareProcParams params;
- int nCompareResult;
+ int nCompareResult = 0;
LVITEM lvi;
- BOOL res;
+ BOOL res = 0;
//pPickerInfo = GetPickerInfo(hwndPicker);
- nLow = 0;
- nHigh = ListView_GetItemCount(hwndPicker);
+ int nHigh = ListView_GetItemCount(hwndPicker);
// populate the CompareProcParams structure
Picker_PopulateCompareProcParams(hwndPicker, &params);
@@ -971,7 +922,6 @@ int Picker_InsertItemSorted(HWND hwndPicker, int nParam)
lvi.mask = LVIF_PARAM;
lvi.iItem = nMid;
res = ListView_GetItem(hwndPicker, &lvi);
-
nCompareResult = Picker_CompareProc(nParam, lvi.lParam, (LPARAM) &params);
if (nCompareResult > 0)
@@ -985,13 +935,14 @@ int Picker_InsertItemSorted(HWND hwndPicker, int nParam)
}
}
+ res++;
memset(&lvi, 0, sizeof(lvi));
lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
- lvi.iItem = nLow;
+ lvi.iItem = nLow;
lvi.iSubItem = 0;
- lvi.lParam = nParam;
+ lvi.lParam = nParam;
lvi.pszText = LPSTR_TEXTCALLBACK;
- lvi.iImage = I_IMAGECALLBACK;
+ lvi.iImage = I_IMAGECALLBACK;
return ListView_InsertItem(hwndPicker, &lvi);
}
@@ -1014,14 +965,11 @@ int Picker_GetRealColumnFromViewColumn(HWND hWnd, int nViewColumn)
int Picker_GetViewColumnFromRealColumn(HWND hWnd, int nRealColumn)
{
struct PickerInfo *pPickerInfo;
- int i;
pPickerInfo = GetPickerInfo(hWnd);
- for (i = 0; i < pPickerInfo->nColumnCount; i++)
- {
+ for (int i = 0; i < pPickerInfo->nColumnCount; i++)
if (pPickerInfo->pnColumnsOrder[i] == nRealColumn)
return i;
- }
// major error, shouldn't be possible, but no good way to warn
return 0;
@@ -1033,12 +981,12 @@ BOOL Picker_HandleNotify(LPNMHDR lpNmHdr)
{
struct PickerInfo *pPickerInfo;
HWND hWnd;
- BOOL bResult = FALSE;
+ BOOL bResult = false;
NM_LISTVIEW *pnmv;
LV_DISPINFO *pDispInfo;
- int nItem, nColumn;
+ int nItem = 0, nColumn = 0;
const TCHAR *s;
- BOOL bReverse;
+ BOOL bReverse = 0;
hWnd = lpNmHdr->hwndFrom;
pPickerInfo = GetPickerInfo(hWnd);
@@ -1057,13 +1005,13 @@ BOOL Picker_HandleNotify(LPNMHDR lpNmHdr)
{
Picker_SetSelectedItem(hWnd, pPickerInfo->nLastItem);
}
- bResult = TRUE;
+ bResult = true;
}
else if ((lpNmHdr->code == NM_DBLCLK) && (pPickerInfo->pCallbacks->pfnDoubleClick))
{
// double click!
pPickerInfo->pCallbacks->pfnDoubleClick();
- bResult = TRUE;
+ bResult = true;
}
break;
@@ -1078,13 +1026,13 @@ BOOL Picker_HandleNotify(LPNMHDR lpNmHdr)
pDispInfo->item.iImage = pPickerInfo->pCallbacks->pfnGetItemImage(hWnd, nItem);
else
pDispInfo->item.iImage = 0;
- bResult = TRUE;
+ bResult = true;
}
if (pDispInfo->item.mask & LVIF_STATE)
{
pDispInfo->item.state = 0;
- bResult = TRUE;
+ bResult = true;
}
if (pDispInfo->item.mask & LVIF_TEXT)
@@ -1096,7 +1044,7 @@ BOOL Picker_HandleNotify(LPNMHDR lpNmHdr)
pDispInfo->item.pszText, pDispInfo->item.cchTextMax);
pDispInfo->item.pszText = (TCHAR *) s;
- bResult = TRUE;
+ bResult = true;
}
break;
@@ -1115,7 +1063,7 @@ BOOL Picker_HandleNotify(LPNMHDR lpNmHdr)
if (pPickerInfo->pCallbacks->pfnEnteringItem)
pPickerInfo->pCallbacks->pfnEnteringItem(hWnd, pnmv->lParam);
}
- bResult = TRUE;
+ bResult = true;
break;
case LVN_COLUMNCLICK:
@@ -1123,11 +1071,11 @@ BOOL Picker_HandleNotify(LPNMHDR lpNmHdr)
if (pPickerInfo->pCallbacks->pfnGetSortColumn() == Picker_GetRealColumnFromViewColumn(hWnd, pnmv->iSubItem))
bReverse = !pPickerInfo->pCallbacks->pfnGetSortReverse();
else
- bReverse = FALSE;
+ bReverse = false;
pPickerInfo->pCallbacks->pfnSetSortReverse(bReverse);
pPickerInfo->pCallbacks->pfnSetSortColumn(Picker_GetRealColumnFromViewColumn(hWnd, pnmv->iSubItem));
Picker_Sort(hWnd);
- bResult = TRUE;
+ bResult = true;
break;
case LVN_BEGINDRAG:
@@ -1143,11 +1091,8 @@ BOOL Picker_HandleNotify(LPNMHDR lpNmHdr)
int Picker_GetNumColumns(HWND hWnd)
{
int nColumnCount = 0;
- int i;
- HWND hwndHeader;
int *shown;
struct PickerInfo *pPickerInfo;
-
pPickerInfo = GetPickerInfo(hWnd);
shown = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*shown));
@@ -1155,16 +1100,14 @@ int Picker_GetNumColumns(HWND hWnd)
return -1;
pPickerInfo->pCallbacks->pfnGetColumnShown(shown);
- hwndHeader = ListView_GetHeader(hWnd);
+ HWND hwndHeader = ListView_GetHeader(hWnd);
if (GetUseOldControl() || (nColumnCount = Header_GetItemCount(hwndHeader)) < 1)
{
nColumnCount = 0;
- for (i = 0; i < pPickerInfo->nColumnCount ; i++ )
- {
+ for (int i = 0; i < pPickerInfo->nColumnCount ; i++ )
if (shown[i])
nColumnCount++;
- }
}
free(shown);
@@ -1179,9 +1122,7 @@ static LPCTSTR MakeShortString(HDC hDC, LPCTSTR lpszLong, int nColumnLen, int nO
static const TCHAR szThreeDots[] = TEXT("...");
static TCHAR szShort[MAX_PATH];
int nStringLen = lstrlen(lpszLong);
- int nAddLen;
SIZE size;
- int i;
GetTextExtentPoint32(hDC, lpszLong, nStringLen, &size);
if (nStringLen == 0 || size.cx + nOffset <= nColumnLen)
@@ -1189,9 +1130,9 @@ static LPCTSTR MakeShortString(HDC hDC, LPCTSTR lpszLong, int nColumnLen, int nO
lstrcpy(szShort, lpszLong);
GetTextExtentPoint32(hDC, szThreeDots, ARRAY_LENGTH(szThreeDots), &size);
- nAddLen = size.cx;
+ int nAddLen = size.cx;
- for (i = nStringLen - 1; i > 0; i--)
+ for (int i = nStringLen - 1; i > 0; i--)
{
szShort[i] = 0;
GetTextExtentPoint32(hDC, szShort, i, &size);
@@ -1208,51 +1149,48 @@ static LPCTSTR MakeShortString(HDC hDC, LPCTSTR lpszLong, int nColumnLen, int nO
void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
- struct PickerInfo *pPickerInfo;
- HDC hDC = lpDrawItemStruct->hDC;
- RECT rcItem = lpDrawItemStruct->rcItem;
- UINT uiFlags = ILD_TRANSPARENT;
- HIMAGELIST hImageList;
- int nItem = lpDrawItemStruct->itemID;
- COLORREF clrTextSave = 0;
- COLORREF clrBkSave = 0;
- COLORREF clrImage = GetSysColor(COLOR_WINDOW);
- static TCHAR szBuff[MAX_PATH];
- BOOL bFocus = (GetFocus() == hWnd);
- LPCTSTR pszText;
- UINT nStateImageMask;
- BOOL bSelected;
- LV_COLUMN lvc;
- LV_ITEM lvi;
- RECT rcAllLabels;
- RECT rcLabel;
- RECT rcIcon;
- int offset;
- SIZE size;
- int i, j;
- int nColumn;
- int nColumnMax = 0;
- int *order;
- BOOL bDrawAsChild;
- int indent_space;
- BOOL bColorChild = FALSE;
- BOOL bParentFound = FALSE;
- int nParent;
- HBITMAP hBackground = GetBackgroundBitmap();
- MYBITMAPINFO *pbmDesc = GetBackgroundInfo();
- BOOL res;
-
+ struct PickerInfo *pPickerInfo;
pPickerInfo = GetPickerInfo(hWnd);
-
+ int *order;
order = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*order));
if (!order)
return;
- nColumnMax = Picker_GetNumColumns(hWnd);
+
+ HDC hDC = lpDrawItemStruct->hDC;
+ RECT rcItem = lpDrawItemStruct->rcItem;
+ UINT uiFlags = ILD_TRANSPARENT;
+ HIMAGELIST hImageList;
+ int nItem = lpDrawItemStruct->itemID;
+ COLORREF clrTextSave = 0;
+ COLORREF clrBkSave = 0;
+ COLORREF clrImage = GetSysColor(COLOR_WINDOW);
+ static TCHAR szBuff[MAX_PATH];
+ BOOL bFocus = (GetFocus() == hWnd);
+ LPCTSTR pszText;
+ UINT nStateImageMask = 0;
+ BOOL bSelected = 0;
+ LV_COLUMN lvc;
+ LV_ITEM lvi;
+ RECT rcAllLabels;
+ RECT rcLabel;
+ RECT rcIcon;
+ int offset = 0;
+ SIZE size;
+ int i = 0, j = 0;
+ int nColumn = 0;
+ BOOL bDrawAsChild = 0;
+ int indent_space = 0;
+ BOOL bColorChild = false;
+ BOOL bParentFound = false;
+ int nParent = 0;
+ HBITMAP hBackground = GetBackgroundBitmap();
+ MYBITMAPINFO *pbmDesc = GetBackgroundInfo();
+ BOOL res = 0;
+
+ int nColumnMax = Picker_GetNumColumns(hWnd);
if (GetUseOldControl())
- {
pPickerInfo->pCallbacks->pfnGetColumnOrder(order);
- }
else
{
/* Get the Column Order and save it */
@@ -1278,16 +1216,15 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
GetTextExtentPoint32(hDC, TEXT(" "), 1, &size);
offset = size.cx;
- lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
- lvi.iItem = nItem;
+ lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
+ lvi.iItem = nItem;
lvi.iSubItem = order[0];
- lvi.pszText = szBuff;
- lvi.cchTextMax = ARRAY_LENGTH(szBuff);
- lvi.stateMask = 0xFFFF; /* get all state flags */
+ lvi.pszText = szBuff;
+ lvi.cchTextMax = sizeof(szBuff) / sizeof(szBuff[0]);
+ lvi.stateMask = 0xFFFF; /* get all state flags */
res = ListView_GetItem(hWnd, &lvi);
- bSelected = ((lvi.state & LVIS_DROPHILITED) || ( (lvi.state & LVIS_SELECTED)
- && ((bFocus) || (GetWindowLong(hWnd, GWL_STYLE) & LVS_SHOWSELALWAYS))));
+ bSelected = ((lvi.state & LVIS_DROPHILITED) || ( (lvi.state & LVIS_SELECTED) && ((bFocus) || (GetWindowLong(hWnd, GWL_STYLE) & LVS_SHOWSELALWAYS))));
/* figure out if we indent and draw grayed */
if (pPickerInfo->pCallbacks->pfnFindItemParent)
@@ -1326,13 +1263,13 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
if (!bParentFound && bDrawAsChild)
{
/*Reset it, as no Parent is there*/
- bDrawAsChild = FALSE;
- bColorChild = TRUE;
+ bDrawAsChild = false;
+ bColorChild = true;
}
else
{
nParent = -1;
- bParentFound = FALSE;
+ bParentFound = false;
}
}
@@ -1341,19 +1278,17 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
rcAllLabels.left = rcLabel.left;
- if (hBackground != NULL)
+ if (hBackground)
{
- RECT rcClient;
- HRGN rgnBitmap;
- RECT rcTmpBmp = rcItem;
- RECT rcFirstItem;
- HPALETTE hPAL;
- HDC htempDC;
- HBITMAP oldBitmap;
+ RECT rcClient;
+ HRGN rgnBitmap;
+ RECT rcTmpBmp = rcItem;
+ RECT rcFirstItem;
+ HPALETTE hPAL;
- htempDC = CreateCompatibleDC(hDC);
+ HDC htempDC = CreateCompatibleDC(hDC);
- oldBitmap = (HBITMAP)SelectObject(htempDC, hBackground);
+ HBITMAP oldBitmap = (HBITMAP)SelectObject(htempDC, hBackground);
GetClientRect(hWnd, &rcClient);
rcTmpBmp.right = rcClient.right;
@@ -1372,7 +1307,7 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
if (GetDeviceCaps(htempDC, RASTERCAPS) & RC_PALETTE && hPAL != NULL)
{
- SelectPalette(htempDC, hPAL, FALSE);
+ SelectPalette(htempDC, hPAL, false);
RealizePalette(htempDC);
}
@@ -1416,14 +1351,14 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
if (bFocus)
{
clrTextSave = SetTextColor(hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
- clrBkSave = SetBkColor(hDC, GetSysColor(COLOR_HIGHLIGHT));
- hBrush = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
+ clrBkSave = SetBkColor(hDC, GetSysColor(COLOR_HIGHLIGHT));
+ hBrush = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
}
else
{
clrTextSave = SetTextColor(hDC, GetSysColor(COLOR_BTNTEXT));
- clrBkSave = SetBkColor(hDC, GetSysColor(COLOR_BTNFACE));
- hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
+ clrBkSave = SetBkColor(hDC, GetSysColor(COLOR_BTNFACE));
+ hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
}
hOldBrush = (HBRUSH)SelectObject(hDC, hBrush);
@@ -1435,9 +1370,7 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (hBackground == NULL)
{
- HBRUSH hBrush;
-
- hBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
+ HBRUSH hBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
FillRect(hDC, &rcAllLabels, hBrush);
DeleteBrush(hBrush);
}
@@ -1466,7 +1399,8 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
clrImage = GetSysColor(COLOR_WINDOW);
uiFlags |= ILD_BLEND50;
}
- else if (bSelected)
+ else
+ if (bSelected)
{
if (bFocus)
clrImage = GetSysColor(COLOR_HIGHLIGHT);
@@ -1497,10 +1431,7 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
UINT nOvlImageMask = lvi.state & LVIS_OVERLAYMASK;
if (rcIcon.left + 16 + indent_space < rcItem.right)
- {
- ImageList_DrawEx(hImageList, lvi.iImage, hDC, rcIcon.left, rcIcon.top, 16, 16,
- GetSysColor(COLOR_WINDOW), clrImage, uiFlags | nOvlImageMask);
- }
+ ImageList_DrawEx(hImageList, lvi.iImage, hDC, rcIcon.left, rcIcon.top, 16, 16, GetSysColor(COLOR_WINDOW), clrImage, uiFlags | nOvlImageMask);
}
res = ListView_GetItemRect_Modified(hWnd, nItem, &rcItem, LVIR_LABEL);
@@ -1511,25 +1442,24 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
rcLabel.left += offset + indent_space;
rcLabel.right -= offset;
- DrawText(hDC, pszText, -1, &rcLabel,
- DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
+ DrawText(hDC, pszText, -1, &rcLabel, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
for (nColumn = 1; nColumn < nColumnMax; nColumn++)
{
- int nRetLen;
- UINT nJustify;
+ int nRetLen;
+ UINT nJustify;
LV_ITEM lvItem;
lvc.mask = LVCF_FMT | LVCF_WIDTH;
res = ListView_GetColumn(hWnd, order[nColumn], &lvc);
- lvItem.mask = LVIF_TEXT;
- lvItem.iItem = nItem;
+ lvItem.mask = LVIF_TEXT;
+ lvItem.iItem = nItem;
lvItem.iSubItem = order[nColumn];
- lvItem.pszText = szBuff;
- lvItem.cchTextMax = ARRAY_LENGTH(szBuff);
+ lvItem.pszText = szBuff;
+ lvItem.cchTextMax = sizeof(szBuff) / sizeof(szBuff[0]);
- if (ListView_GetItem(hWnd, &lvItem) == FALSE)
+ if (ListView_GetItem(hWnd, &lvItem) == false)
continue;
rcItem.left = rcItem.right;
@@ -1563,8 +1493,7 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
rcLabel = rcItem;
rcLabel.left += offset;
rcLabel.right -= offset;
- DrawText(hDC, pszText, -1, &rcLabel,
- nJustify | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
+ DrawText(hDC, pszText, -1, &rcLabel, nJustify | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
}
if (lvi.state & LVIS_FOCUSED && bFocus)
@@ -1573,6 +1502,7 @@ void Picker_HandleDrawItem(HWND hWnd, LPDRAWITEMSTRUCT lpDrawItemStruct)
SetTextColor(hDC, clrTextSave);
SetBkColor(hDC, clrBkSave);
free(order);
+ res++;
}
@@ -1617,16 +1547,14 @@ void Picker_SetHeaderImageList(HWND hwndPicker, HIMAGELIST hHeaderImages)
BOOL Picker_SaveColumnWidths(HWND hwndPicker)
{
struct PickerInfo *pPickerInfo;
- int *widths;
- int *order;
- int *tmpOrder;
- int nColumnMax, i;
- BOOL bSuccess = FALSE;
- BOOL res;
+ int nColumnMax = 0, i = 0;
+ BOOL bSuccess = false;
+ BOOL res = 0;
pPickerInfo = GetPickerInfo(hwndPicker);
/* allocate space for the column info */
+ int *widths, *order, *tmpOrder;
widths = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*widths));
order = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*order));
tmpOrder = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*tmpOrder));
@@ -1640,19 +1568,13 @@ BOOL Picker_SaveColumnWidths(HWND hwndPicker)
pPickerInfo->pCallbacks->pfnGetColumnOrder(order);
/* switch the list view to LVS_REPORT style so column widths reported correctly */
- SetWindowLong(hwndPicker, GWL_STYLE,
- (GetWindowLong(hwndPicker, GWL_STYLE) & ~LVS_TYPEMASK) | LVS_REPORT);
+ SetWindowLong(hwndPicker, GWL_STYLE, (GetWindowLong(hwndPicker, GWL_STYLE) & ~LVS_TYPEMASK) | LVS_REPORT);
nColumnMax = Picker_GetNumColumns(hwndPicker);
if (GetUseOldControl())
- {
for (i = 0; i < nColumnMax; i++)
- {
- widths[Picker_GetRealColumnFromViewColumn(hwndPicker, i)] =
- ListView_GetColumnWidth(hwndPicker, i);
- }
- }
+ widths[Picker_GetRealColumnFromViewColumn(hwndPicker, i)] = ListView_GetColumnWidth(hwndPicker, i);
else
{
/* Get the Column Order and save it */
@@ -1660,15 +1582,14 @@ BOOL Picker_SaveColumnWidths(HWND hwndPicker)
for (i = 0; i < nColumnMax; i++)
{
- widths[Picker_GetRealColumnFromViewColumn(hwndPicker, i)]
- = ListView_GetColumnWidth(hwndPicker, i);
+ widths[Picker_GetRealColumnFromViewColumn(hwndPicker, i)] = ListView_GetColumnWidth(hwndPicker, i);
order[i] = Picker_GetRealColumnFromViewColumn(hwndPicker, tmpOrder[i]);
}
}
pPickerInfo->pCallbacks->pfnSetColumnWidths(widths);
pPickerInfo->pCallbacks->pfnSetColumnOrder(order);
- bSuccess = TRUE;
+ bSuccess = true;
done:
if (widths)
@@ -1677,5 +1598,6 @@ done:
free(order);
if (tmpOrder)
free(tmpOrder);
+ res++;
return bSuccess;
}