summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-02-27 16:56:05 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-02-27 17:00:24 +0300
commit01b90e89e84ceea63fd9351c05972a797af698df (patch)
treee813547384973489994ff43e393c2b4d861fe3d9 /plugins
parent5acc73ee5648a0d8c7065611043fca5297ef0682 (diff)
fix for IDC_ADD button
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Scriver/src/chat/window.cpp2
-rw-r--r--plugins/Scriver/src/msgdialog.cpp21
-rw-r--r--plugins/Scriver/src/utils.cpp8
-rw-r--r--plugins/Scriver/src/utils.h2
4 files changed, 13 insertions, 20 deletions
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 4ad3cf571f..982cbd02cf 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -895,7 +895,7 @@ class CChatRoomDlg : public CSrmmBaseDialog
hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_MESSAGE), 0, 1, h - m_si->iSplitterY + SPLITTER_HEIGHT, w - 2, m_si->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
- SetButtonsPos(m_hwnd, bToolbar);
+ SetButtonsPos(m_hwnd, m_si->hContact, bToolbar);
if (m_si->m_hwndIeview != NULL) {
IEVIEWWINDOW ieWindow;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index b1cc7efbba..0d6440c9eb 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -163,28 +163,15 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* s
void CSrmmWindow::SetDialogToType()
{
BOOL showToolbar = SendMessage(m_hwndParent, CM_GETTOOLBARSTATUS, 0, 0);
- ParentWindowData *pdat = m_pParent;
+ if (m_hContact == 0)
+ showToolbar = false;
+ ParentWindowData *pdat = m_pParent;
if (pdat->flags2 & SMF2_SHOWINFOBAR)
ShowWindow(m_pInfobarData->hWnd, SW_SHOW);
else
ShowWindow(m_pInfobarData->hWnd, SW_HIDE);
- CustomButtonData *cbd;
- for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
- HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID);
- if (hwndButton == NULL)
- continue;
-
- if (m_hContact) {
- if (cbd->m_dwButtonCID == IDC_ADD && !db_get_b(m_hContact, "CList", "NotOnList", 0))
- ShowWindow(hwndButton, SW_HIDE);
- else
- ShowWindow(hwndButton, showToolbar ? SW_SHOW : SW_HIDE);
- }
- else ShowWindow(hwndButton, SW_HIDE);
- }
-
ShowWindow(m_message.GetHwnd(), SW_SHOW);
if (m_hwndIeview != NULL)
ShowWindow(m_log.GetHwnd(), SW_HIDE);
@@ -508,7 +495,7 @@ void CSrmmWindow::MessageDialogResize(int w, int h)
hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_SPLITTERY), 0, 0, h - hSplitterPos - 1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
- SetButtonsPos(m_hwnd, bToolbar);
+ SetButtonsPos(m_hwnd, m_hContact, bToolbar);
if (m_hwndIeview != NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp
index 11a012b094..a615d5dd5b 100644
--- a/plugins/Scriver/src/utils.cpp
+++ b/plugins/Scriver/src/utils.cpp
@@ -434,7 +434,7 @@ void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT *rect)
SendMessage(hwndTT, TTM_NEWTOOLRECT, 0, (LPARAM)&ti);
}
-void SetButtonsPos(HWND hwndDlg, bool bShow)
+void SetButtonsPos(HWND hwndDlg, MCONTACT hContact, bool bShow)
{
HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount());
@@ -453,6 +453,12 @@ void SetButtonsPos(HWND hwndDlg, bool bShow)
if (hwndButton == NULL)
continue;
+ if (cbd->m_dwButtonCID == IDC_ADD)
+ if (!db_get_b(hContact, "CList", "NotOnList", 0)) {
+ ShowWindow(hwndButton, SW_HIDE);
+ continue;
+ }
+
ShowWindow(hwndButton, bShow ? SW_SHOW : SW_HIDE);
int width = iGap + cbd->m_iButtonWidth;
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h
index 12f668969a..051de4800d 100644
--- a/plugins/Scriver/src/utils.h
+++ b/plugins/Scriver/src/utils.h
@@ -52,5 +52,5 @@ void GetContactUniqueId(class CSrmmWindow *dat, char *buf, int maxlen);
HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT *rect);
void SetToolTipText(HWND hwndParent, HWND hwndTT, LPTSTR ptszText, LPTSTR ptszTitle);
void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect);
-void SetButtonsPos(HWND hwndDlg, bool bShow);
+void SetButtonsPos(HWND hwndDlg, MCONTACT hContact, bool bShow);
#endif