mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-28 16:24:27 +02:00
[BUG_FIXED] Fix task list display glitch under Windows 7.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@723 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
10b4a1c9e0
commit
aedc097094
@ -20,7 +20,7 @@
|
|||||||
#include "TaskListDlg_rc.h"
|
#include "TaskListDlg_rc.h"
|
||||||
#include "colors.h"
|
#include "colors.h"
|
||||||
#include "ImageListSet.h"
|
#include "ImageListSet.h"
|
||||||
|
#include "Parameters.h"
|
||||||
|
|
||||||
void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem, int index2set)
|
void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem, int index2set)
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem
|
|||||||
|
|
||||||
// Create the list-view window in report view with label editing enabled.
|
// Create the list-view window in report view with label editing enabled.
|
||||||
int listViewStyles = LVS_REPORT | LVS_OWNERDATA | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER\
|
int listViewStyles = LVS_REPORT | LVS_OWNERDATA | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER\
|
||||||
| LVS_NOSCROLL | LVS_SINGLESEL | LVS_AUTOARRANGE | LVS_OWNERDRAWFIXED\
|
| /*LVS_NOSCROLL |*/ LVS_SINGLESEL | LVS_AUTOARRANGE | LVS_OWNERDRAWFIXED\
|
||||||
| LVS_SHAREIMAGELISTS/* | WS_BORDER*/;
|
| LVS_SHAREIMAGELISTS/* | WS_BORDER*/;
|
||||||
|
|
||||||
_hSelf = ::CreateWindow(WC_LISTVIEW,
|
_hSelf = ::CreateWindow(WC_LISTVIEW,
|
||||||
@ -69,7 +69,7 @@ void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem
|
|||||||
LVCOLUMN lvColumn;
|
LVCOLUMN lvColumn;
|
||||||
lvColumn.mask = LVCF_WIDTH;
|
lvColumn.mask = LVCF_WIDTH;
|
||||||
|
|
||||||
lvColumn.cx = 1500;
|
lvColumn.cx = 500;
|
||||||
|
|
||||||
ListView_InsertColumn(_hSelf, 0, &lvColumn);
|
ListView_InsertColumn(_hSelf, 0, &lvColumn);
|
||||||
|
|
||||||
@ -80,6 +80,16 @@ void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem
|
|||||||
ListView_SetBkColor(_hSelf, lightYellow);
|
ListView_SetBkColor(_hSelf, lightYellow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TaskList::destroy()
|
||||||
|
{
|
||||||
|
if (_hFont)
|
||||||
|
DeleteObject(_hFont);
|
||||||
|
if (_hFontSelected)
|
||||||
|
DeleteObject(_hFontSelected);
|
||||||
|
::DestroyWindow(_hSelf);
|
||||||
|
_hSelf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
RECT TaskList::adjustSize()
|
RECT TaskList::adjustSize()
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
@ -104,12 +114,39 @@ RECT TaskList::adjustSize()
|
|||||||
_rc.bottom += rc.bottom - rc.top;
|
_rc.bottom += rc.bottom - rc.top;
|
||||||
}
|
}
|
||||||
_rc.right = maxwidth + imgWidth + marge;
|
_rc.right = maxwidth + imgWidth + marge;
|
||||||
|
ListView_SetColumnWidth(_hSelf, 0, _rc.right);
|
||||||
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFont), 0);
|
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFont), 0);
|
||||||
|
|
||||||
reSizeTo(_rc);
|
reSizeTo(_rc);
|
||||||
|
//_rc.right += marge;
|
||||||
|
winVer ver = (NppParameters::getInstance())->getWinVersion();
|
||||||
|
_rc.bottom += ver <= WV_XP?5:15;
|
||||||
return _rc;
|
return _rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TaskList::setFont(TCHAR *fontName, size_t fontSize)
|
||||||
|
{
|
||||||
|
if (_hFont)
|
||||||
|
::DeleteObject(_hFont);
|
||||||
|
if (_hFontSelected)
|
||||||
|
::DeleteObject(_hFontSelected);
|
||||||
|
|
||||||
|
_hFont = ::CreateFont(fontSize, 0, 0, 0,
|
||||||
|
FW_NORMAL,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
fontName);
|
||||||
|
|
||||||
|
_hFontSelected = ::CreateFont(fontSize, 0, 0, 0,
|
||||||
|
FW_BOLD,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
fontName);
|
||||||
|
|
||||||
|
if (_hFont)
|
||||||
|
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFont), 0);
|
||||||
|
}
|
||||||
|
|
||||||
int TaskList::updateCurrentIndex()
|
int TaskList::updateCurrentIndex()
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < _nbItem ; i++)
|
for (int i = 0 ; i < _nbItem ; i++)
|
||||||
@ -139,48 +176,42 @@ LRESULT TaskList::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case WM_MOUSEWHEEL :
|
case WM_MOUSEWHEEL :
|
||||||
{
|
{
|
||||||
//if (LOWORD(wParam) & MK_RBUTTON)
|
short zDelta = (short) HIWORD(wParam);
|
||||||
// It's not easy to press RBUTTON while moving a mouse wheel and holding CTRL :-)
|
if (zDelta > 0)
|
||||||
// Actually, I thought MOUSEWHEEL is not working until I saw this code
|
|
||||||
{
|
{
|
||||||
short zDelta = (short) HIWORD(wParam);
|
size_t selected = (_currentIndex - 1) < 0 ? (_nbItem - 1) : (_currentIndex - 1);
|
||||||
if (zDelta > 0)
|
ListView_SetItemState(_hSelf, _currentIndex, 0, LVIS_SELECTED|LVIS_FOCUSED);
|
||||||
{
|
// tells what item(s) to be repainted
|
||||||
size_t selected = (_currentIndex - 1) < 0 ? (_nbItem - 1) : (_currentIndex - 1);
|
ListView_RedrawItems(_hSelf, _currentIndex, _currentIndex);
|
||||||
ListView_SetItemState(_hSelf, _currentIndex, 0, LVIS_SELECTED|LVIS_FOCUSED);
|
// repaint item(s)
|
||||||
// tells what item(s) to be repainted
|
UpdateWindow(_hSelf);
|
||||||
ListView_RedrawItems(_hSelf, _currentIndex, _currentIndex);
|
ListView_SetItemState(_hSelf, selected, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
|
||||||
// repaint item(s)
|
// tells what item(s) to be repainted
|
||||||
UpdateWindow(_hSelf);
|
ListView_RedrawItems(_hSelf, selected, selected);
|
||||||
ListView_SetItemState(_hSelf, selected, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
|
// repaint item(s)
|
||||||
// tells what item(s) to be repainted
|
UpdateWindow(_hSelf);
|
||||||
ListView_RedrawItems(_hSelf, selected, selected);
|
_currentIndex = selected;
|
||||||
// repaint item(s)
|
}
|
||||||
UpdateWindow(_hSelf);
|
else
|
||||||
_currentIndex = selected;
|
{
|
||||||
}
|
size_t selected = (_currentIndex + 1) > (_nbItem - 1) ? 0 : (_currentIndex + 1);
|
||||||
else
|
ListView_SetItemState(_hSelf, _currentIndex, 0, LVIS_SELECTED|LVIS_FOCUSED);
|
||||||
{
|
// tells what item(s) to be repainted
|
||||||
size_t selected = (_currentIndex + 1) > (_nbItem - 1) ? 0 : (_currentIndex + 1);
|
ListView_RedrawItems(_hSelf, _currentIndex, _currentIndex);
|
||||||
ListView_SetItemState(_hSelf, _currentIndex, 0, LVIS_SELECTED|LVIS_FOCUSED);
|
// repaint item(s)
|
||||||
// tells what item(s) to be repainted
|
UpdateWindow(_hSelf);
|
||||||
ListView_RedrawItems(_hSelf, _currentIndex, _currentIndex);
|
ListView_SetItemState(_hSelf, selected, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
|
||||||
// repaint item(s)
|
// tells what item(s) to be repainted
|
||||||
UpdateWindow(_hSelf);
|
ListView_RedrawItems(_hSelf, selected, selected);
|
||||||
ListView_SetItemState(_hSelf, selected, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
|
// repaint item(s)
|
||||||
// tells what item(s) to be repainted
|
UpdateWindow(_hSelf);
|
||||||
ListView_RedrawItems(_hSelf, selected, selected);
|
_currentIndex = selected;
|
||||||
// repaint item(s)
|
|
||||||
UpdateWindow(_hSelf);
|
|
||||||
_currentIndex = selected;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_KEYDOWN :
|
case WM_KEYDOWN :
|
||||||
{
|
{
|
||||||
//printStr(TEXT("WM_KEYDOWN"));
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,11 +260,8 @@ LRESULT TaskList::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//printStr(TEXT("else"));
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
//return DLGC_WANTALLKEYS ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return DLGC_WANTALLKEYS ;
|
return DLGC_WANTALLKEYS ;
|
||||||
}
|
}
|
||||||
|
@ -33,41 +33,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
virtual ~TaskList() {};
|
virtual ~TaskList() {};
|
||||||
|
|
||||||
virtual void destroy(){
|
|
||||||
if (_hFont)
|
|
||||||
DeleteObject(_hFont);
|
|
||||||
if (_hFontSelected)
|
|
||||||
DeleteObject(_hFontSelected);
|
|
||||||
::DestroyWindow(_hSelf);
|
|
||||||
_hSelf = NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
void init(HINSTANCE hInst, HWND hwnd, HIMAGELIST hImaLst, int nbItem, int index2set);
|
void init(HINSTANCE hInst, HWND hwnd, HIMAGELIST hImaLst, int nbItem, int index2set);
|
||||||
|
virtual void destroy();
|
||||||
void setFont(TCHAR *fontName, size_t fontSize) {
|
void setFont(TCHAR *fontName, size_t fontSize);
|
||||||
if (_hFont)
|
|
||||||
::DeleteObject(_hFont);
|
|
||||||
if (_hFontSelected)
|
|
||||||
::DeleteObject(_hFontSelected);
|
|
||||||
|
|
||||||
_hFont = ::CreateFont(fontSize, 0, 0, 0,
|
|
||||||
FW_NORMAL,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
fontName);
|
|
||||||
|
|
||||||
_hFontSelected = ::CreateFont(fontSize, 0, 0, 0,
|
|
||||||
FW_BOLD,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
fontName);
|
|
||||||
|
|
||||||
if (_hFont)
|
|
||||||
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFont), 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
RECT adjustSize();
|
RECT adjustSize();
|
||||||
int getCurrentIndex() const {return _currentIndex;}
|
int getCurrentIndex() const {return _currentIndex;}
|
||||||
int updateCurrentIndex();
|
int updateCurrentIndex();
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "TaskListDlg_rc.h"
|
#include "TaskListDlg_rc.h"
|
||||||
|
|
||||||
IDD_TASKLIST_DLG DIALOGEX DISCARDABLE 0, 0, 300, 300
|
IDD_TASKLIST_DLG DIALOGEX DISCARDABLE 0, 0, 300, 300
|
||||||
STYLE WS_POPUP | WS_VISIBLE
|
STYLE WS_POPUP | WS_VISIBLE | WS_THICKFRAME
|
||||||
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
|
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
END
|
END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user