diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-03-05 22:14:09 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-03-05 22:14:09 +0000 |
commit | 18a91339f2d9e1449887f5d993ab2f038ff56833 (patch) | |
tree | c5ee079c530794040fee8d2cfb497bd799545735 /plugins/TabSRMM/src/tabctrl.cpp | |
parent | b915069a9d7ad8d4da5da7a7d92d3e73a0a65346 (diff) |
TabSRMM: code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@12344 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/tabctrl.cpp')
-rw-r--r-- | plugins/TabSRMM/src/tabctrl.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index da55d7f0da..612a253363 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -33,20 +33,20 @@ static WNDPROC OldTabControlClassProc; #define FIXED_TAB_SIZE 100
-// returns the index of the tab under the mouse pointer. Used for -// context menu popup and tooltips -// pt: mouse coordinates, obtained from GetCursorPos() - -int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt) -{ - TCHITTESTINFO tch; - tch.pt = (*pt); - tch.flags = 0; - ScreenToClient(hwndTab, &tch.pt); - - return TabCtrl_HitTest(hwndTab, &tch); -} - +// returns the index of the tab under the mouse pointer. Used for
+// context menu popup and tooltips
+// pt: mouse coordinates, obtained from GetCursorPos()
+
+int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt)
+{
+ TCHITTESTINFO tch;
+ tch.pt = (*pt);
+ tch.flags = 0;
+ ScreenToClient(hwndTab, &tch.pt);
+
+ return TabCtrl_HitTest(hwndTab, &tch);
+}
+
static int TabCtrl_TestForCloseButton(const TabControlData *tabdat, HWND hwnd, POINT *pt)
{
int iTab;
@@ -343,8 +343,10 @@ static void DrawItemRect(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint CSkinItem *item = &SkinItems[dwStyle & TCS_BOTTOM ? (nHint & HINT_HOTTRACK ? ID_EXTBKTABITEMHOTTRACKBOTTOM : ID_EXTBKTABITEMBOTTOM) :
(nHint & HINT_HOTTRACK ? ID_EXTBKTABITEMHOTTRACK : ID_EXTBKTABITEM)];
if (!item->IGNORED) {
- if (dwStyle & TCS_BOTTOM)
- rcItem->top = (rcItem->top > rcTabPage.bottom + 5) ? --rcItem->top : rcItem->top;
+ if (dwStyle & TCS_BOTTOM) {
+ rcItem->top = (rcItem->top > rcTabPage.bottom + 5) ? (rcItem->top-1) : rcItem->top;
+ rcItem->top--;
+ }
else
rcItem->bottom++;
@@ -588,6 +590,9 @@ static POINT ptMouseT = { 0 }; static void PaintWorker(HWND hwnd, TabControlData *tabdat)
{
+ if (tabdat == NULL || tabdat->pContainer == NULL)
+ return;
+
PAINTSTRUCT ps;
HDC hdc;
RECT rectTemp, rctPage, rctActive, rcItem, rctClip, rctOrig;
@@ -615,10 +620,10 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) item.mask = TCIF_PARAM;
tabdat->fAeroTabs = (CSkin::m_fAeroSkinsValid && (isAero || PluginConfig.m_fillColor)) ? TRUE : FALSE;
- tabdat->fCloseButton = tabdat->pContainer ? (tabdat->pContainer->dwFlagsEx & TCF_CLOSEBUTTON ? TRUE : FALSE) : FALSE;
+ tabdat->fCloseButton = (tabdat->pContainer->dwFlagsEx & TCF_CLOSEBUTTON ? TRUE : FALSE);
tabdat->helperDat = 0;
- if (tabdat->fAeroTabs && tabdat->pContainer) {
+ if (tabdat->fAeroTabs) {
TWindowData *dat = (TWindowData*)GetWindowLongPtr(tabdat->pContainer->hwndActive, GWLP_USERDATA);
if (dat)
tabdat->helperDat = dat;
@@ -1176,7 +1181,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_MOUSEMOVE:
if (tabdat->bDragging) {
- pt.x = GET_X_LPARAM(lParam); + pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
ImageList_DragMove(pt.x, pt.y);
}
|