diff options
author | alitor <me4all@mail.ru> | 2017-08-10 18:35:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-08-12 12:32:45 +0300 |
commit | a0d14c09331726b05608808dca4a65a36a2e03e9 (patch) | |
tree | 903460a362c141aec93aa00d38148ea2c6b2f5e5 /plugins/SmileyAdd/src | |
parent | 3d49e0e58c3c1c29f065e71a22bd7d3bfab741b1 (diff) |
SmileyAdd scrolling issue (#872)
Diffstat (limited to 'plugins/SmileyAdd/src')
-rw-r--r-- | plugins/SmileyAdd/src/smltool.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp index b2284343cd..a7c78a6371 100644 --- a/plugins/SmileyAdd/src/smltool.cpp +++ b/plugins/SmileyAdd/src/smltool.cpp @@ -221,12 +221,13 @@ void SmileyToolWindowType::SmileySel(int but) GetScrollInfo(m_hwndDialog, SB_VERT, &si);
HDC hdc = GetDC(m_hwndDialog);
- if (m_CurrentHotTrack >= 0) {
+ if (m_CurrentHotTrack >= 0) { // erase old rectangle selection and tooltip
RECT rect = CalculateButtonToCoordinates(m_CurrentHotTrack, si.nPos);
DrawFocusRect(hdc, &rect);
m_CurrentHotTrack = -1;
SendMessage(m_hToolTip, TTM_ACTIVATE, FALSE, 0);
}
+
m_CurrentHotTrack = but;
if (m_CurrentHotTrack >= 0) {
TOOLINFO ti = { 0 };
@@ -243,6 +244,17 @@ void SmileyToolWindowType::SmileySel(int but) RECT rect = CalculateButtonToCoordinates(m_CurrentHotTrack, si.nPos);
DrawFocusRect(hdc, &rect);
if (m_AniPack) m_AniPack->SetSel(rect);
+
+ // when selection is outside the window, then scroll
+ if (but < si.nPos * (opt.HorizontalSorting ? (int)m_NumberOfHorizontalButtons : 1)) {
+ int dist = but / (opt.HorizontalSorting ? (int)m_NumberOfHorizontalButtons : 1) - si.nPos;
+ ScrollV(SB_MYMOVE, dist);
+ }
+ int numVert = m_WindowSizeY / (m_ButtonSize.cy + m_ButtonSpace);
+ if (but >= (si.nPos + numVert) * (opt.HorizontalSorting ? (int)m_NumberOfHorizontalButtons : 1)) {
+ int dist = but / (opt.HorizontalSorting ? m_NumberOfHorizontalButtons : 1) - numVert - si.nPos + 1;
+ ScrollV(SB_MYMOVE, dist);
+ }
}
ReleaseDC(m_hwndDialog, hdc);
}
@@ -366,6 +378,14 @@ void SmileyToolWindowType::KeyUp(WPARAM wParam, LPARAM lParam) but += (opt.HorizontalSorting ? m_NumberOfHorizontalButtons : 1) * LOWORD(lParam);
break;
+ case VK_PRIOR:
+ but -= m_WindowSizeY / (m_ButtonSize.cy + m_ButtonSpace) * (opt.HorizontalSorting ? m_NumberOfHorizontalButtons : 1);
+ break;
+
+ case VK_NEXT:
+ but += m_WindowSizeY / (m_ButtonSize.cy + m_ButtonSpace) * (opt.HorizontalSorting ? m_NumberOfHorizontalButtons : 1);
+ break;
+
case VK_SPACE:
case VK_RETURN:
if (but != -1) InsertSmiley();
|