From f04d64869f3b1de54fb343f28f955584780001b8 Mon Sep 17 00:00:00 2001 From: mataes2007 Date: Sat, 26 Nov 2011 15:41:10 +0000 Subject: Project folders rename part 3 git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@215 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- Tooltip_Notify/src/DbHelpers.cpp | 120 ---- Tooltip_Notify/src/DbHelpers.h | 9 - Tooltip_Notify/src/Settings.h | 42 -- Tooltip_Notify/src/Tooltip.cpp | 219 ------- Tooltip_Notify/src/Tooltip.h | 55 -- Tooltip_Notify/src/TooltipNotify.cpp | 1114 ---------------------------------- Tooltip_Notify/src/TooltipNotify.h | 143 ----- Tooltip_Notify/src/Utils.cpp | 32 - Tooltip_Notify/src/Utils.h | 8 - Tooltip_Notify/src/main.cpp | 218 ------- Tooltip_Notify/src/main.rc | 204 ------- Tooltip_Notify/src/resource.h | 47 -- Tooltip_Notify/src/stdafx.cpp | 8 - Tooltip_Notify/src/stdafx.h | 37 -- Tooltip_Notify/src/version.h | 11 - Tooltip_Notify/src/version.rc | 52 -- 16 files changed, 2319 deletions(-) delete mode 100644 Tooltip_Notify/src/DbHelpers.cpp delete mode 100644 Tooltip_Notify/src/DbHelpers.h delete mode 100644 Tooltip_Notify/src/Settings.h delete mode 100644 Tooltip_Notify/src/Tooltip.cpp delete mode 100644 Tooltip_Notify/src/Tooltip.h delete mode 100644 Tooltip_Notify/src/TooltipNotify.cpp delete mode 100644 Tooltip_Notify/src/TooltipNotify.h delete mode 100644 Tooltip_Notify/src/Utils.cpp delete mode 100644 Tooltip_Notify/src/Utils.h delete mode 100644 Tooltip_Notify/src/main.cpp delete mode 100644 Tooltip_Notify/src/main.rc delete mode 100644 Tooltip_Notify/src/resource.h delete mode 100644 Tooltip_Notify/src/stdafx.cpp delete mode 100644 Tooltip_Notify/src/stdafx.h delete mode 100644 Tooltip_Notify/src/version.h delete mode 100644 Tooltip_Notify/src/version.rc (limited to 'Tooltip_Notify/src') diff --git a/Tooltip_Notify/src/DbHelpers.cpp b/Tooltip_Notify/src/DbHelpers.cpp deleted file mode 100644 index 9302064..0000000 --- a/Tooltip_Notify/src/DbHelpers.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// DbHelpers.cpp -// -////////////////////////////////////////////////////////////////////// - -#include "stdafx.h" -#include "DbHelpers.h" - -typedef std::vector SettingsList; - -static int EnumSettingsProc1(const char *pszSetting, LPARAM lParam) -{ - return 0; -} - -bool ModuleSettingsExists(HANDLE hContact, const char* pszModuleName) -{ - DBCONTACTENUMSETTINGS dbces = {0}; - dbces.szModule = pszModuleName; - dbces.pfnEnumProc = EnumSettingsProc1; - - int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact, (LPARAM)&dbces); - return (nResult != -1); -} - -static int EnumSettingsProc2(const char *pszSetting, LPARAM lParam) -{ - SettingsList& settingsList = *((SettingsList*)lParam); - settingsList.push_back(_strdup(pszSetting)); - return 0; -} - -void DeleteModuleSettings(HANDLE hContact, const char* pszModuleName) -{ - SettingsList settingsList; - DBCONTACTENUMSETTINGS dbces = {0}; - dbces.szModule = pszModuleName; - dbces.lParam = (LPARAM)&settingsList; - dbces.pfnEnumProc = EnumSettingsProc2; - - int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact, (LPARAM)&dbces); - if (nResult != -1) - { - for(unsigned i=0; itype = 0; - - int rr = CallService(MS_DB_CONTACT_GETSETTING,(WPARAM)hContact,(LPARAM)&cgs); - - if (dbv->type != DBVT_UTF8) - return rr; - else - return 1; -} - -void RenameModule(HANDLE hContact, const char* pszOldName, const char* pszNewName) -{ - SettingsList settingsList; - DBCONTACTENUMSETTINGS dbces = {0}; - dbces.szModule = pszOldName; - dbces.lParam = (LPARAM)&settingsList; - dbces.pfnEnumProc = EnumSettingsProc2; - - int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact, (LPARAM)&dbces); - if (nResult != -1) - { - DBVARIANT dbv; - - for(unsigned i=0; iGetDllInstance(), NULL); - - SetWindowLong(m_hWnd, GWL_USERDATA, reinterpret_cast(this)); -} - - -CTooltip::~CTooltip() -{ - if (m_hWnd) DestroyWindow(m_hWnd); - if (m_hFont) DeleteObject(m_hFont); - - if (m_szText) free(m_szText); -} - -/*static*/ void CTooltip::Initialize(HMODULE hInstance) -{ - WNDCLASSEX wcexWndClass; - wcexWndClass.cbSize = sizeof(WNDCLASSEX); - wcexWndClass.style = CS_SAVEBITS; - wcexWndClass.lpfnWndProc = (WNDPROC)CTooltip::WindowProcWrapper; - wcexWndClass.cbClsExtra = 0; - wcexWndClass.cbWndExtra = 0; - wcexWndClass.hInstance = hInstance; - wcexWndClass.hIcon = 0; - wcexWndClass.hCursor = 0; - wcexWndClass.hbrBackground = 0; - wcexWndClass.lpszMenuName = 0; - wcexWndClass.lpszClassName = s_szTooltipClass; - wcexWndClass.hIconSm = 0; - RegisterClassEx(&wcexWndClass); -} - -/*static*/ void CTooltip::Deinitialize(HMODULE hInstance) -{ - UnregisterClass(s_szTooltipClass, hInstance); -} - -LRESULT CALLBACK CTooltip::WindowProcWrapper(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - CTooltip* pThis = reinterpret_cast(GetWindowLong(hWnd, GWL_USERDATA)); - return pThis->WindowProc(hWnd, message, wParam, lParam); -} - - - -LRESULT CALLBACK CTooltip::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_CREATE: - break; - - case WM_COMMAND: - break; - - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hDC = BeginPaint(hWnd, &ps); - - RECT rect; - GetClientRect(hWnd, &rect); - - rect.top += 1; - rect.left += 1; - rect.right -= 1; - rect.bottom -= 1; - - SetBkMode(hDC, TRANSPARENT); - SetTextColor(hDC, m_dwTextColor); - SelectObject(hDC, m_hFont); - DrawText(hDC, m_szText, lstrlen(m_szText), &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE); - - EndPaint(hWnd, &ps); - - break; - } - - case WM_ERASEBKGND: - { - RECT rect; - GetClientRect(hWnd, &rect); - HBRUSH hBgBrush = CreateSolidBrush(m_dwBgColor); - FillRect((HDC)wParam, &rect, hBgBrush); - DeleteObject(hBgBrush); - - return TRUE; - } - - case WM_NCHITTEST: - { - UINT uHitTest = DefWindowProc(hWnd, message, wParam, lParam); - if(uHitTest == HTCLIENT) - return HTCAPTION; - else - return uHitTest; - } - - case WM_NCLBUTTONDBLCLK: - { - m_pTooltipNotify->OnTooltipDblClicked(this); - break; - } - - case WM_SYSCOMMAND: - { - if (!m_pTooltipNotify->OnTooltipBeginMove(this)) - break; - - // doesn't return until the moving is complete - DefWindowProc(hWnd, message, wParam, lParam); - // DefWindowProc returned - m_pTooltipNotify->OnTooltipEndMove(this); - - break; - } - - case WM_DESTROY: - break; - - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - return 0; - -} - - -VOID CTooltip::Validate() -{ - m_hFont = CreateFontIndirect(&m_lfFont); - SIZE Size; - HDC hDC = GetDC(m_hWnd); - SelectObject(hDC, m_hFont); - GetTextExtentPoint32(hDC, m_szText, lstrlen(m_szText), &Size); - SetWindowPos(m_hWnd, 0, 0, 0, Size.cx+6, Size.cy+4, - SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW); - ReleaseDC(m_hWnd, hDC); -} - - -VOID CTooltip::Show() -{ - ShowWindow(m_hWnd, SW_SHOWNOACTIVATE); -} - - -VOID CTooltip::Hide() -{ - ShowWindow(m_hWnd, SW_HIDE); -} - - - -VOID CTooltip::set_Translucency(BYTE bAlpha) -{ - typedef BOOL (WINAPI *pfnSetLayeredWindowAttributes_t)(HWND, COLORREF, BYTE, DWORD); - pfnSetLayeredWindowAttributes_t pfnSetLayeredWindowAttributes; - - pfnSetLayeredWindowAttributes = reinterpret_cast - (GetProcAddress(GetModuleHandle(_T("user32.dll")), "SetLayeredWindowAttributes")); - - if (pfnSetLayeredWindowAttributes && - SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED) != 0) - { - pfnSetLayeredWindowAttributes(m_hWnd, RGB(0,0,0), bAlpha, LWA_ALPHA); - } -} - -VOID CTooltip::set_TransparentInput(BOOL bOnOff) -{ - if (bOnOff) - SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_TRANSPARENT); - else - SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) & ~WS_EX_TRANSPARENT); -} - - -VOID CTooltip::get_Rect(RECT *Rect) const -{ - GetWindowRect(m_hWnd, Rect); -} - -VOID CTooltip::set_Position(INT x, INT y) -{ - SetWindowPos(m_hWnd, 0, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE); -} - -VOID CTooltip::set_Text(const TCHAR* szText) -{ - if (m_szText) free(m_szText); - m_szText = _tcsdup(szText); -} - diff --git a/Tooltip_Notify/src/Tooltip.h b/Tooltip_Notify/src/Tooltip.h deleted file mode 100644 index fc97348..0000000 --- a/Tooltip_Notify/src/Tooltip.h +++ /dev/null @@ -1,55 +0,0 @@ -// Tooltip.h: interface for the CTooltip class. -// -////////////////////////////////////////////////////////////////////// - -#pragma once - -class CTooltipNotify; - -class CTooltip -{ -public: - - CTooltip(CTooltipNotify *pTooltipNotify); - virtual ~CTooltip(); - - HWND GetHandle() const { return m_hWnd; } - VOID Hide(); - VOID Show(); - VOID Validate(); - VOID set_Position(INT x, INT y); - VOID get_Rect(RECT *Rect) const; - VOID set_TransparentInput(BOOL bOnOff); - VOID set_Translucency(BYTE bAlpha); - VOID set_Text(const TCHAR* szText); - VOID set_Font(const LOGFONT& Font) { m_lfFont = Font; } - VOID set_TextColor(DWORD TextColor) { m_dwTextColor = TextColor; } - VOID set_BgColor(DWORD BgColor) { m_dwBgColor = BgColor; } - - static void Initialize(HMODULE hInstance); - static void Deinitialize(HMODULE hInstance); - -private: - // prohibit copying - CTooltip(const CTooltip& rhs); - CTooltip& operator= (const CTooltip& rhs); - -private: - static LRESULT CALLBACK WindowProcWrapper(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - - HWND m_hWnd; - HFONT m_hFont; - - // tooltip parameters - DWORD m_dwTextColor; - DWORD m_dwBgColor; - LOGFONT m_lfFont; - TCHAR *m_szText; - BYTE m_bAlpha; - BOOL m_bTranspInput; - BYTE m_bLDblClick; - - CTooltipNotify *m_pTooltipNotify; - static const TCHAR *s_szTooltipClass; -}; diff --git a/Tooltip_Notify/src/TooltipNotify.cpp b/Tooltip_Notify/src/TooltipNotify.cpp deleted file mode 100644 index ac480dc..0000000 --- a/Tooltip_Notify/src/TooltipNotify.cpp +++ /dev/null @@ -1,1114 +0,0 @@ -// TooltipNotify.cpp: implementation of the CTooltipNotify class. -// -////////////////////////////////////////////////////////////////////// - -#include "stdafx.h" -#include "resource.h" -#include "TooltipNotify.h" -#include "Tooltip.h" -#include "Settings.h" -#include "DbHelpers.h" -#include "Utils.h" - -#define ReadSettingByte(c, d) DBGetContactSettingByte(NULL, s_szModuleName, c, d) -#define ReadSettingWord(c, d) DBGetContactSettingWord(NULL, s_szModuleName, c, d) -#define ReadSettingDword(c, d) DBGetContactSettingDword(NULL, s_szModuleName, c, d) -#define ReadSettingString(c, d) DBGetContactSettingTString(NULL, s_szModuleName, c, d) - -#define WriteSettingByte(c, d) DBWriteContactSettingByte(NULL, s_szModuleName, c, d) -#define WriteSettingWord(c, d) DBWriteContactSettingWord(NULL, s_szModuleName, c, d) -#define WriteSettingDword(c, d) DBWriteContactSettingDword(NULL, s_szModuleName, c, d) -#define WriteSettingString(c, d) DBWriteContactSettingTString(NULL, s_szModuleName, c, d) - -enum -{ - ProtoIntBit = 0x01, - ProtoUserBit = 0x02 -}; - -static const char* SND_ONLINE = "ttntfOnline"; -static const char* SND_OFFLINE = "ttntfOffline"; -static const char* SND_OTHER = "ttntfOther"; -static const char* SND_TYPING = "ttntfTyping"; -static const char* CONTACT_IGNORE_TTNOTIFY = "Ignore"; - -static const int ID_TTNTF_STATUS_TYPING = ID_STATUS_INVISIBLE+10; -static const int ID_TTNTF_STATUS_IDLE = ID_STATUS_INVISIBLE+11; -static const int ID_TTNTF_STATUS_NOT_IDLE = ID_STATUS_INVISIBLE+12; - -#define FONTSERV_GROUP _T("Tooltip Notify") -#define FONTSERV_ONLINE _T("Online") -#define FONTSERV_OFFLINE _T("Offline") -#define FONTSERV_OTHER _T("Other Status") -#define FONTSERV_TYPING _T("Typing") -#define FONTSERV_IDLE _T("Idle") - -struct FontEntry -{ - int status; - TCHAR* name; - char* fontPrefix; - char* clrPrefix; -}; - -static FontEntry s_fontTable[] = -{ - ID_STATUS_ONLINE, FONTSERV_ONLINE, "OnlineFont", "OnlineBgColor", - ID_STATUS_OFFLINE, FONTSERV_OFFLINE, "OfflineFont", "OfflineBgColor", - ID_TTNTF_STATUS_TYPING, FONTSERV_TYPING, "TypingFont", "TypingBgColor", - ID_TTNTF_STATUS_IDLE, FONTSERV_IDLE, "IdleFont", "IdleBgColor", - ID_TTNTF_STATUS_NOT_IDLE, FONTSERV_IDLE, "IdleFont", "IdleBgColor", - 0, FONTSERV_OTHER, "OtherFont", "OtherBgColor", -}; - -/*static*/ CTooltipNotify *CTooltipNotify::s_pInstance = 0; -/*static*/ const char *CTooltipNotify::s_szModuleNameOld = "ttntfmod"; -/*static*/ const char *CTooltipNotify::s_szModuleName = "TooltipNotify"; - - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CTooltipNotify::CTooltipNotify(HINSTANCE hinstDLL) : - m_hDllInstance(hinstDLL), m_bNt50(IsNt50()) -{ - if (s_pInstance!=0) - throw EAlreadyExists(); - - s_pInstance = this; - - CTooltip::Initialize(m_hDllInstance); -} - -CTooltipNotify::~CTooltipNotify() -{ - EndNotifyAll(); - CTooltip::Deinitialize(m_hDllInstance); - s_pInstance=0; -} - -void CTooltipNotify::RegisterFonts() -{ - FontIDT fontId = {0}; - fontId.cbSize = sizeof(fontId); - _tcscpy(fontId.group, FONTSERV_GROUP); - strcpy(fontId.dbSettingsGroup, s_szModuleName); - fontId.flags = FIDF_DEFAULTVALID; - fontId.deffontsettings.colour = DEF_SETTING_TXTCOLOR; - fontId.deffontsettings.size = -MulDiv(DEF_SETTING_FONT_SIZE, DEF_LOGPIXELSY, 72); - fontId.deffontsettings.style = DEF_SETTING_FONT_STYLE; - fontId.deffontsettings.charset = DEF_SETTING_FONT_CHARSET; - _tcscpy(fontId.deffontsettings.szFace, DEF_SETTING_FONT_FACE); - fontId.order = 0; - _tcscpy(fontId.backgroundGroup, FONTSERV_GROUP); - - ColourIDT colorId = {0}; - colorId.cbSize = sizeof(colorId); - _tcscpy(colorId.group, FONTSERV_GROUP); - strcpy(colorId.dbSettingsGroup, s_szModuleName); - colorId.flags = 0; - colorId.defcolour = DEF_SETTING_BGCOLOR; - colorId.order = 0; - - for (int i=0; i0) - { - STooltipData *pTooltipData = new STooltipData; - pTooltipData->uiTimeout = lParam*1000; - pTooltipData->hContact = (HANDLE)wParam; - pTooltipData->iStatus = ID_TTNTF_STATUS_TYPING; - - EndNotifyAll(); - SkinPlaySound(SND_TYPING); - BeginNotify(pTooltipData); - } - else - { - EndNotifyAll(); - } - - return 0; -} - - -int CTooltipNotify::ProtoAck(WPARAM wParam, LPARAM lParam) -{ - ACKDATA *ack=(ACKDATA*)lParam; - if(ack->type != ACKTYPE_STATUS) return 0; - - WORD wNewStatus = (WORD)ack->lParam; - WORD wOldStatus = (WORD)ack->hProcess; - if (wOldStatus == wNewStatus) return 0; //Useless message. - - char *szProtocol = (char *)ack->szModule; - - if (wNewStatus == ID_STATUS_OFFLINE) - { - BYTE bProtoActive = ReadSettingByte(szProtocol, ProtoUserBit|ProtoIntBit); - bProtoActive &= ~ProtoIntBit; - WriteSettingByte(szProtocol, bProtoActive); - } - else - { - if (wOldStatus < ID_STATUS_ONLINE && wNewStatus > ID_STATUS_OFFLINE) - { - UINT_PTR idTimer = SetTimer(0, 0, m_sOptions.wStartupDelay*1000, ConnectionTimerProcWrapper); - ProtoData protoData = { _strdup(szProtocol), idTimer }; - m_mapTimerIdProto.push_back(protoData); - } - } - - return 0; -} - -int CTooltipNotify::ContactSettingChanged(WPARAM wParam, LPARAM lParam) -{ - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - HANDLE hContact = (HANDLE)wParam; - if(hContact==NULL) return 0; - - bool idle = false; - if (lstrcmpA(cws->szSetting,"Status")==0) - idle = false; - else if (lstrcmpA(cws->szSetting,"IdleTS")==0) - idle = true; - else return 0; - - if(DBGetContactSettingByte(hContact, "CList", "Hidden", 0)) return 0; - - const char *pszProto = cws->szModule; - if (ReadSettingByte(pszProto, ProtoUserBit|ProtoIntBit) != (ProtoUserBit|ProtoIntBit)) - { - return 0; - } - - if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && m_sOptions.bIgnoreUnknown) - { - return 0; - } - - if (DBGetContactSettingByte(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew)) - { - return 0; - } - - if (idle && !m_sOptions.bIdle) return 0; - - WORD wNewStatus = cws->value.wVal; - switch(wNewStatus) - { - case ID_STATUS_OFFLINE: - if (!m_sOptions.bOffline) return 0; - SkinPlaySound(SND_OFFLINE); - break; - - case ID_STATUS_ONLINE: - if(CallService(MS_IGNORE_ISIGNORED,(WPARAM)hContact,IGNOREEVENT_USERONLINE) && m_sOptions.bConjSOLN) return 0; - if (!m_sOptions.bOnline) return 0; - SkinPlaySound(SND_ONLINE); - break; - - default: - if (!m_sOptions.bOther) return 0; - SkinPlaySound(SND_OTHER); - break; - } - - STooltipData *pTooltipData = new STooltipData; - pTooltipData->uiTimeout = m_sOptions.wDuration * (wNewStatus==ID_STATUS_ONLINE ? (m_sOptions.bX2+1):1); - pTooltipData->hContact = hContact; - - if (idle) wNewStatus = (wNewStatus!=0 ? ID_TTNTF_STATUS_IDLE : ID_TTNTF_STATUS_NOT_IDLE); - pTooltipData->iStatus = wNewStatus; - - EndNotifyAll(); - BeginNotify(pTooltipData); - - return 0; - -} - -int CTooltipNotify::InitializeOptions(WPARAM wParam, LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp; - - ZeroMemory(&odp,sizeof(odp)); - odp.cbSize = sizeof(odp); - odp.position = 100000000; - odp.hInstance = m_hDllInstance; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); - odp.ptszTitle = TranslateT("Tooltip Notify"); - odp.ptszGroup = TranslateT("Appearance"); - odp.groupPosition = 910000000; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.pfnDlgProc = CTooltipNotify::OptionsDlgProcWrapper; - ::CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); - - return 0; -} - -CTooltip *CTooltipNotify::BeginNotify(STooltipData *pTooltipData) -{ - TCHAR szTooltipText[64] = {0}; - MakeTooltipString(pTooltipData->hContact, pTooltipData->iStatus, szTooltipText, 64); - - LOGFONT lf = {0}; - COLORREF textColor = 0; - COLORREF bgColor = 0; - GetFont(pTooltipData->iStatus, &lf, &textColor, &bgColor); - - CTooltip *pTooltip = new CTooltip(this); - pTooltip->set_Text(szTooltipText); - pTooltip->set_Font(lf); - pTooltip->set_BgColor(bgColor); - pTooltip->set_TextColor(textColor); - if (m_bNt50 && m_sOptions.bTransp) - pTooltip->set_Translucency(m_sOptions.bAlpha); - pTooltip->set_TransparentInput(m_bNt50 && m_sOptions.bTransp && m_sOptions.bTranspInput); - pTooltip->Validate(); - - RECT TooltipRect, WorkAreaRect; - SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkAreaRect, 0); - pTooltip->get_Rect(&TooltipRect); - - int tt_width = TooltipRect.right-TooltipRect.left; - int tt_height = TooltipRect.bottom-TooltipRect.top; - - if (m_sOptions.bAutoPos || - m_sOptions.wXPos > WorkAreaRect.right-tt_width || - m_sOptions.wYPos > WorkAreaRect.bottom-tt_height) - { - pTooltip->set_Position( - WorkAreaRect.right - 10 - tt_width, - WorkAreaRect.bottom - 2 - tt_height); - } - else - { - pTooltip->set_Position(m_sOptions.wXPos, m_sOptions.wYPos); - } - - - UINT_PTR idTimer = SetTimer(0, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper); - pTooltipData->idTimer = idTimer; - pTooltipData->pTooltip = pTooltip; - - m_TooltipsList.push_back(pTooltipData); - - pTooltip->Show(); - - return pTooltip; -} - -BOOL CTooltipNotify::EndNotify(STooltipData* pTooltipData) -{ - CTooltip* pTooltip = pTooltipData->pTooltip; - - // return if the tooltip timer suspended - if (pTooltipData->idTimer == 0) return FALSE; - SuspendTimer(pTooltip); - - pTooltip->Hide(); - delete pTooltip; - delete pTooltipData; - - m_TooltipsList.erase( - std::remove(m_TooltipsList.begin(), m_TooltipsList.end(), pTooltipData), - m_TooltipsList.end()); - - return TRUE; -} - -VOID CTooltipNotify::EndNotifyAll() -{ - // iterate through active tooltips and - // remove one which do not have its timer suspended - TooltipsList::reverse_iterator mapRevIter = m_TooltipsList.rbegin(); - while (mapRevIter != m_TooltipsList.rend()) - { - STooltipData* pTooltipData = *mapRevIter; - if (EndNotify(pTooltipData)) - { - mapRevIter = m_TooltipsList.rbegin(); - } - else - { - ++mapRevIter; - } - } -} - -CTooltipNotify::MapTimerIdProtoIter CTooltipNotify::FindProtoByTimer(UINT idTimer) -{ - for ( - MapTimerIdProtoIter iter = m_mapTimerIdProto.begin(); - iter != m_mapTimerIdProto.end(); - ++iter) - { - if (iter->timerId == idTimer) - { - return iter; - } - } - - return m_mapTimerIdProto.end(); -} - -VOID CTooltipNotify::OnConnectionTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - BOOL bSuccess = KillTimer(0, idEvent); - assert(bSuccess); - - MapTimerIdProtoIter iter = FindProtoByTimer(idEvent); - assert(iter!=m_mapTimerIdProto.end()); - - BYTE bProtoActive = ReadSettingByte(iter->proto, ProtoUserBit|ProtoIntBit); - bProtoActive |= ProtoIntBit; - WriteSettingByte(iter->proto, bProtoActive); - - free((char*)iter->proto); - m_mapTimerIdProto.erase(iter); -} - - -VOID CTooltipNotify::OnTooltipTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - TooltipsList::iterator iter = FindBy(&STooltipData::idTimer, idEvent); - assert(iter!=m_TooltipsList.end()); - - STooltipData* pTooltipData = *iter; - EndNotify(pTooltipData); -} - -VOID CTooltipNotify::MigrateSettings() -{ - if (ModuleSettingsExists(NULL, s_szModuleNameOld) && !ModuleSettingsExists(NULL, s_szModuleName)) - { - RenameModule(NULL, s_szModuleNameOld, s_szModuleName); - } -} - -VOID CTooltipNotify::LoadSettings() -{ - m_sOptions.bFirstRun = ReadSettingByte("firstrun", DEF_SETTING_FIRSTRUN); - m_sOptions.bOffline = ReadSettingByte("offline", DEF_SETTING_OFFLINE); - m_sOptions.bOnline = ReadSettingByte("online", DEF_SETTING_ONLINE); - m_sOptions.bOther = ReadSettingByte("other", DEF_SETTING_OTHER); - m_sOptions.bTyping = ReadSettingByte("typing", DEF_SETTING_TYPING); - m_sOptions.bIdle = ReadSettingByte("idle", DEF_SETTING_TYPING); - m_sOptions.bX2 = ReadSettingByte("x2", DEF_SETTING_X2); - m_sOptions.bConjSOLN = ReadSettingByte("conjsoln", DEF_SETTING_CONJSOLN); - m_sOptions.bAutoPos = ReadSettingByte("autopos", DEF_SETTING_DEF_POS); - m_sOptions.bBallonTip = ReadSettingByte("balloontip", DEF_SETTING_BALLONTIP); - m_sOptions.bTransp = ReadSettingByte("transp", DEF_SETTING_TRANSP); - m_sOptions.bAlpha = ReadSettingByte("alpha", DEF_SETTING_ALPHA); - m_sOptions.bTranspInput = ReadSettingByte("transpinput", DEF_SETTING_TRANSP_INPUT); - m_sOptions.bPrefixProto = ReadSettingByte("prfxproto", DEF_SETTING_PREFIX_PROTO); - m_sOptions.bLDblClick = ReadSettingByte("ldblclick", DEF_SETTING_LDBLCLICK); - m_sOptions.wDuration = ReadSettingWord("duration", DEF_SETTING_DURATION); - m_sOptions.wXPos = ReadSettingWord("xpos", DEF_SETTING_DEF_XPOS); - m_sOptions.wYPos = ReadSettingWord("ypos", DEF_SETTING_DEF_YPOS); - m_sOptions.wStartupDelay = ReadSettingWord("suprconndelay", DEF_SETTING_STARTUP_DELAY); - m_sOptions.bIgnoreUnknown = ReadSettingByte("ignoreunknown", DEF_SETTING_IGNORE_UNKNOWN); - m_sOptions.bIgnoreNew = ReadSettingByte("ignorenew", DEF_SETTING_IGNORE_NEW); -} - -VOID CTooltipNotify::SaveSettings() -{ - WriteSettingWord("duration", m_sOptions.wDuration); - WriteSettingWord("suprconndelay", m_sOptions.wStartupDelay); - WriteSettingByte("offline", m_sOptions.bOffline); - WriteSettingByte("online", m_sOptions.bOnline); - WriteSettingByte("other", m_sOptions.bOther); - WriteSettingByte("typing", m_sOptions.bTyping); - WriteSettingByte("idle", m_sOptions.bIdle); - WriteSettingByte("prfxproto", m_sOptions.bPrefixProto); - WriteSettingByte("x2", m_sOptions.bX2); - WriteSettingByte("conjsoln", m_sOptions.bConjSOLN); - WriteSettingByte("autopos", m_sOptions.bAutoPos); - WriteSettingByte("balloontip", m_sOptions.bBallonTip); - WriteSettingByte("transp", m_sOptions.bTransp); - WriteSettingByte("alpha", m_sOptions.bAlpha); - WriteSettingByte("transpinput", m_sOptions.bTranspInput); - WriteSettingByte("ldblclick", m_sOptions.bLDblClick); - WriteSettingByte("ignoreunknown", m_sOptions.bIgnoreUnknown); - WriteSettingByte("ignorenew", m_sOptions.bIgnoreNew); -} - - -VOID CTooltipNotify::ReadSettingsFromDlg(HWND hDlg) -{ - m_sOptions.bOffline = (BYTE)(IsDlgButtonChecked(hDlg, IDC_OFFLINE) == BST_CHECKED ? 1:0); - m_sOptions.bOnline = (BYTE)(IsDlgButtonChecked(hDlg, IDC_ONLINE) == BST_CHECKED ? 1:0); - m_sOptions.bOther = (BYTE)(IsDlgButtonChecked(hDlg, IDC_OTHER) == BST_CHECKED ? 1:0); - m_sOptions.bTyping = (BYTE)(IsDlgButtonChecked(hDlg, IDC_TYPING) == BST_CHECKED ? 1:0); - m_sOptions.bIdle = (BYTE)(IsDlgButtonChecked(hDlg, IDC_IDLE) == BST_CHECKED ? 1:0); - m_sOptions.bX2 = (BYTE)(IsDlgButtonChecked(hDlg, IDC_X2) == BST_CHECKED ? 1:0); - m_sOptions.bConjSOLN = (BYTE)(IsDlgButtonChecked(hDlg, IDC_CONJSOLN) == BST_CHECKED ? 1:0); - m_sOptions.bAutoPos = (BYTE)(IsDlgButtonChecked(hDlg, IDC_AUTOPOS) == BST_CHECKED ? 1:0); - m_sOptions.bBallonTip = (BYTE)(IsDlgButtonChecked(hDlg, IDC_BALLONTIP) == BST_CHECKED ? 1:0); - m_sOptions.bTransp = (BYTE)(IsDlgButtonChecked(hDlg, IDC_TRANSPARENCY) == BST_CHECKED ? 1:0); - m_sOptions.bAlpha = (BYTE)SendDlgItemMessage(hDlg,IDC_TRANSPARENCY_SLIDER,TBM_GETPOS,0,0); - m_sOptions.bTranspInput = (BYTE)(IsDlgButtonChecked(hDlg, IDC_TRANSP_INPUT) == BST_CHECKED ? 1:0); - m_sOptions.bPrefixProto = (BYTE)(IsDlgButtonChecked(hDlg, IDC_PREFIX_PROTO) == BST_CHECKED ? 1:0); - m_sOptions.bLDblClick = (BYTE)(IsDlgButtonChecked(hDlg, IDC_RB_CLIST) == BST_CHECKED) ? SHOW_HIDE_CLIST:OPEN_MSGDLG; - m_sOptions.wDuration = LOWORD(SendDlgItemMessage(hDlg, IDC_DURATIONSPIN, UDM_GETPOS, 0, 0)); - m_sOptions.wStartupDelay = LOWORD(SendDlgItemMessage(hDlg, IDC_DELAYONCONNSPIN, UDM_GETPOS, 0, 0)); -} - -VOID CTooltipNotify::WriteSettingsToDlg(HWND hDlg) -{ - SendDlgItemMessage(hDlg, IDC_DURATIONSPIN, UDM_SETRANGE, 0, MAKELONG(550*36, 550)); - SendDlgItemMessage(hDlg, IDC_DURATIONSPIN, UDM_SETPOS, 0, MAKELONG(m_sOptions.wDuration, 0)); - SendDlgItemMessage(hDlg, IDC_DELAYONCONNSPIN, UDM_SETRANGE, 0, MAKELONG(30, 0)); - SendDlgItemMessage(hDlg, IDC_DELAYONCONNSPIN, UDM_SETPOS, 0, MAKELONG(m_sOptions.wStartupDelay, 0)); - - CheckDlgButton(hDlg, IDC_OFFLINE, m_sOptions.bOffline ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_ONLINE, m_sOptions.bOnline ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_OTHER, m_sOptions.bOther ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_TYPING, m_sOptions.bTyping ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_IDLE, m_sOptions.bIdle ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_PREFIX_PROTO, m_sOptions.bPrefixProto ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_X2, m_sOptions.bX2 ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_CONJSOLN, m_sOptions.bConjSOLN ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_AUTOPOS, m_sOptions.bAutoPos ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_BALLONTIP, m_sOptions.bBallonTip ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_TRANSPARENCY, m_sOptions.bTransp ? BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hDlg, IDC_TRANSP_INPUT, m_sOptions.bTranspInput ? BST_CHECKED:BST_UNCHECKED); - - switch(m_sOptions.bLDblClick) - { - case SHOW_HIDE_CLIST: CheckDlgButton(hDlg, IDC_RB_CLIST, TRUE); break; - case OPEN_MSGDLG: CheckDlgButton(hDlg, IDC_RB_MSGDLG, TRUE); break; - default: CheckDlgButton(hDlg, IDC_RB_CLIST, TRUE); break; - } - - EnableWindow(GetDlgItem(hDlg, IDC_GB_TRANSP), m_bNt50); - EnableWindow(GetDlgItem(hDlg, IDC_TRANSPARENCY), m_bNt50); - EnableWindow(GetDlgItem(hDlg, IDC_TRANSPARENCY_SLIDER), m_sOptions.bTransp && m_bNt50); - EnableWindow(GetDlgItem(hDlg, IDC_TRANSPERC), m_sOptions.bTransp && m_bNt50); - EnableWindow(GetDlgItem(hDlg, IDC_TRANSP_INPUT), m_sOptions.bTransp && m_bNt50); - //EnableWindow(GetDlgItem(hDlg, IDC_GB_DBLCLICK), m_sOptions.bTranspInput); - EnableWindow(GetDlgItem(hDlg, IDC_RB_CLIST), !m_sOptions.bTranspInput); - EnableWindow(GetDlgItem(hDlg, IDC_RB_MSGDLG), !m_sOptions.bTranspInput); - - SendDlgItemMessage(hDlg, IDC_TRANSPARENCY_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(1,255)); - SendDlgItemMessage(hDlg, IDC_TRANSPARENCY_SLIDER, TBM_SETPOS, TRUE, m_sOptions.bAlpha); -} - - -VOID CTooltipNotify::ValidateSettings() -{ - if (m_sOptions.wStartupDelay>30) m_sOptions.wStartupDelay=30; - if (m_sOptions.wDuration>550*36) m_sOptions.wDuration=550*36; - if (m_sOptions.wDuration<550*1) m_sOptions.wDuration=550*1; - if (!m_sOptions.bTransp) m_sOptions.bTranspInput=0; -} - - -// main options dialog -BOOL CTooltipNotify::OptionsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hDlg); - WriteSettingsToDlg(hDlg); - SendMessage(hDlg, WM_HSCROLL, 0x12345678, 0); - - return TRUE; - } - - case WM_VSCROLL: - case WM_HSCROLL: - { - TCHAR str[10]; - wsprintf(str, _T("%d%%"), 100*SendDlgItemMessage(hDlg, IDC_TRANSPARENCY_SLIDER, TBM_GETPOS, 0, 0)/255); - SetDlgItemText(hDlg, IDC_TRANSPERC, str); - if(wParam!=0x12345678) SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); - return TRUE; - } - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_TRANSPARENCY: - EnableWindow(GetDlgItem(hDlg, IDC_TRANSPERC), IsDlgButtonChecked(hDlg, IDC_TRANSPARENCY) == BST_CHECKED); - EnableWindow(GetDlgItem(hDlg, IDC_TRANSPARENCY_SLIDER), IsDlgButtonChecked(hDlg, IDC_TRANSPARENCY) == BST_CHECKED); - EnableWindow(GetDlgItem(hDlg, IDC_TRANSP_INPUT), IsDlgButtonChecked(hDlg, IDC_TRANSPARENCY) == BST_CHECKED); - CheckDlgButton(hDlg, IDC_TRANSP_INPUT, IsDlgButtonChecked(hDlg, IDC_TRANSPARENCY) == BST_CHECKED ? m_sOptions.bTranspInput : BST_UNCHECKED); - SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_TRANSP_INPUT, 0), 0); - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); - break; - - case IDC_TRANSP_INPUT: - //EnableWindow(GetDlgItem(hDlg,IDC_GB_DBLCLICK), IsDlgButtonChecked(hDlg, IDC_TRANSP_INPUT)); - EnableWindow(GetDlgItem(hDlg,IDC_RB_CLIST), !(IsDlgButtonChecked(hDlg, IDC_TRANSP_INPUT) == BST_CHECKED)); - EnableWindow(GetDlgItem(hDlg,IDC_RB_MSGDLG), !(IsDlgButtonChecked(hDlg, IDC_TRANSP_INPUT) == BST_CHECKED)); - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); - break; - - case IDC_BALLONTIP: - EnableWindow(GetDlgItem(hDlg,IDC_DURATION),!(IsDlgButtonChecked(hDlg,IDC_BALLONTIP)==BST_CHECKED)); - EnableWindow(GetDlgItem(hDlg,IDC_X2),!(IsDlgButtonChecked(hDlg,IDC_BALLONTIP)==BST_CHECKED)); - EnableWindow(GetDlgItem(hDlg,IDC_RB_CLIST),!(IsDlgButtonChecked(hDlg,IDC_BALLONTIP)==BST_CHECKED)); - EnableWindow(GetDlgItem(hDlg,IDC_RB_MSGDLG),!(IsDlgButtonChecked(hDlg,IDC_BALLONTIP)==BST_CHECKED)); - EnableWindow(GetDlgItem(hDlg,IDC_TRANSP_INPUT),!(IsDlgButtonChecked(hDlg,IDC_BALLONTIP)==BST_CHECKED)); - EnableWindow(GetDlgItem(hDlg,IDC_AUTOPOS),!(IsDlgButtonChecked(hDlg,IDC_BALLONTIP)==BST_CHECKED)); - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); - break; - - case IDC_DURATION: - if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return FALSE; - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); - break; - - case IDC_DELAYONCONN: - if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return FALSE; - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); - break; - - case IDC_PREVIEW: - { - STooltipData *pTooltipData = new STooltipData; - pTooltipData->uiTimeout = m_sOptions.wDuration * (m_sOptions.bX2 ? (m_sOptions.bX2+1):1); - pTooltipData->hContact = 0; - pTooltipData->iStatus = ID_STATUS_ONLINE; - - EndNotifyAll(); - BeginNotify(pTooltipData); - break; - } - - case IDC_SEL_PROTO: - DialogBox(m_hDllInstance, MAKEINTRESOURCE(IDD_PROTOS), hDlg, (DLGPROC)CTooltipNotify::ProtosDlgProcWrapper); - break; - - case IDC_IGNORE: - DialogBox(m_hDllInstance, MAKEINTRESOURCE(IDD_CONTACTS), hDlg, (DLGPROC)CTooltipNotify::ContactsDlgProcWrapper); - break; - - default: - // activate 'apply' button - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); - return TRUE; - } - - return TRUE; - } - - case WM_NOTIFY: - { - //Here we have pressed either the OK or the APPLY button. - switch(((LPNMHDR)lParam)->idFrom) - { - case 0: - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - ReadSettingsFromDlg(hDlg); - SaveSettings(); - return TRUE; - - } // switch code - break; - - } //switch idFrom - - return TRUE; - } - - default: - break; - - } - - return FALSE; - -} - - -// dialog for protocols selecting -BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - - case WM_INITDIALOG: - { - TranslateDialogDefault(hDlg); - - ListView_SetExtendedListViewStyle(GetDlgItem(hDlg, IDC_PROTOS), LVS_EX_CHECKBOXES); - - // enum protocols currently running - int iProtoCount = 0; - PROTOCOLDESCRIPTOR **ppProtos = 0; - ::CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM)&iProtoCount, (LPARAM)&ppProtos); - - // and fill in the list - int iNonProtoCount = 0; - for (int i=0; i < iProtoCount; i++) - { - if (ppProtos[i]->type == PROTOTYPE_PROTOCOL) - { - LV_ITEM lvi; - - lvi.mask = LVIF_TEXT; - lvi.iSubItem = 0; - lvi.iItem = i; - lvi.lParam = i; -#ifdef _UNICODE - WCHAR wszProto[128]; - long lLen = MultiByteToWideChar(CP_ACP, 0, ppProtos[i]->szName, - strlen(ppProtos[i]->szName), wszProto, ARRAY_SIZE(wszProto)); - wszProto[lLen] = L'\0'; - - lvi.pszText = wszProto; -#else - lvi.pszText = ppProtos[lvi.iItem]->szName; -#endif - int new_item = ListView_InsertItem(GetDlgItem(hDlg,IDC_PROTOS),&lvi); - - BYTE bProtoState = ReadSettingByte(ppProtos[i]->szName, ProtoUserBit|ProtoIntBit); - BOOL bProtoEnabled = (bProtoState & ProtoUserBit) != 0; - ListView_SetCheckState(GetDlgItem(hDlg,IDC_PROTOS), i-iNonProtoCount, bProtoEnabled); - } - else - { - iNonProtoCount++; - } - } - - return TRUE; - } - - - case WM_COMMAND: - { - if (LOWORD(wParam) == IDOK) - { - int proto_count = ListView_GetItemCount(GetDlgItem(hDlg,IDC_PROTOS)); - - for (int i=0; i < proto_count; i++) - { - TCHAR szProto[64]; - - ListView_GetItemText(GetDlgItem(hDlg,IDC_PROTOS), i, 0, szProto, ARRAY_SIZE(szProto)); -#ifdef _UNICODE - char szMultiByteProto[128]; - long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, lstrlen(szProto), - szMultiByteProto, sizeof(szMultiByteProto), NULL, NULL); - szMultiByteProto[lLen] = '\0'; - - BYTE bProtoState = ReadSettingByte(szMultiByteProto, ProtoUserBit|ProtoIntBit); -#else - BYTE bProtoState = ReadSettingByte(szProto, ProtoUserBit|ProtoIntBit); -#endif - - BOOL bProtoEnabled = ListView_GetCheckState(GetDlgItem(hDlg,IDC_PROTOS), i); - bProtoState = bProtoEnabled ? bProtoState|ProtoUserBit : bProtoState&~ProtoUserBit; -#ifdef _UNICODE - WriteSettingByte(szMultiByteProto, bProtoState); -#else - WriteSettingByte(szProto, bProtoState); -#endif - } - - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - } - - if (LOWORD(wParam) == IDCANCEL) - { - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - } - - return TRUE; - } - - case WM_CLOSE: - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - - default: - break; - - } // switch (msg) - - return FALSE; - -} - -void CTooltipNotify::ResetCList(HWND hwndDlg) -{ - BOOL b = (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && - DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT)); - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) b, 0); - - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0); - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0); - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0); - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKBITMAP, 0, (LPARAM) (HBITMAP) NULL); - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0); - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETINDENT, 10, 0); - - for (int i = 0; i <= FONTID_MAX; i++) - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT)); -} - -void CTooltipNotify::LoadList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) -{ - if (hItemNew && !m_sOptions.bIgnoreNew) - { - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemNew, 1); - } - if (hItemUnknown && !m_sOptions.bIgnoreUnknown) - { - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1); - } - - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - do - { - HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0); - if (hItem && !DBGetContactSettingByte(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew)) - { - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1); - } - } - while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0)); -} - -void CTooltipNotify::SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) -{ - if (hItemNew) - { - m_sOptions.bIgnoreNew = (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemNew, 0) ? 0 : 1); - } - if (hItemUnknown) - { - m_sOptions.bIgnoreUnknown = (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 0 : 1); - } - - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - do - { - HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0); - if (hItem) - { - BYTE bChecked = (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0)); - DBWriteContactSettingByte(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, bChecked ? 0 : 1); - } - } - while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0)); -} - - -// dialog for ignore tooltip notifications -BOOL CTooltipNotify::ContactsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - static HANDLE hItemNew, hItemUnknown; - - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hDlg); - - CLCINFOITEM cii = { 0 }; - cii.cbSize = sizeof(cii); - cii.flags = CLCIIF_GROUPFONT | CLCIIF_CHECKBOX; - cii.pszText = TranslateT("** New contacts **"); - hItemNew = (HANDLE) SendDlgItemMessage(hDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii); - cii.pszText = TranslateT("** Unknown contacts **"); - hItemUnknown = (HANDLE) SendDlgItemMessage(hDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii); - - ResetCList(hDlg); - LoadList(hDlg, hItemNew, hItemUnknown); - return TRUE; - } - - - case WM_COMMAND: - { - if (LOWORD(wParam) == IDOK) - { - SaveList(hDlg, hItemNew, hItemUnknown); - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - } - - if (LOWORD(wParam) == IDCANCEL) - { - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - } - - return TRUE; - } - - case WM_CLOSE: - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - - default: - break; - - } // switch (msg) - - return FALSE; - -} - - - -TCHAR *CTooltipNotify::StatusToString(int iStatus, TCHAR *szStatus, int iBufSize) -{ - - //iBufSize--; - - switch(iStatus) - { - case ID_STATUS_OFFLINE: - lstrcpyn(szStatus, TranslateT("Offline"), iBufSize); - break; - - case ID_STATUS_ONLINE: - lstrcpyn(szStatus, TranslateT("Online"), iBufSize); - break; - - case ID_STATUS_AWAY: - lstrcpyn(szStatus, TranslateT("Away"), iBufSize); - break; - - case ID_STATUS_NA : - lstrcpyn(szStatus, TranslateT("N/A"), iBufSize); - break; - - case ID_STATUS_OCCUPIED: - lstrcpyn(szStatus, TranslateT("Occupied"), iBufSize); - break; - - case ID_STATUS_DND: - lstrcpyn(szStatus, TranslateT("DND"), iBufSize); - break; - - case ID_STATUS_FREECHAT: - lstrcpyn(szStatus, TranslateT("Free for chat"), iBufSize); - break; - - case ID_STATUS_INVISIBLE: - lstrcpyn(szStatus, TranslateT("Invisible"), iBufSize); - break; - - case ID_TTNTF_STATUS_TYPING: - lstrcpyn(szStatus, TranslateT("Typing"), iBufSize); - break; - - case ID_TTNTF_STATUS_IDLE: - lstrcpyn(szStatus, TranslateT("Idle"), iBufSize); - break; - - case ID_TTNTF_STATUS_NOT_IDLE: - lstrcpyn(szStatus, TranslateT("Not Idle"), iBufSize); - break; - - default: - lstrcpyn(szStatus, TranslateT("Unknown"), iBufSize); - break; - } - - return szStatus; - -} - -TCHAR *CTooltipNotify::MakeTooltipString(HANDLE hContact, int iStatus, TCHAR *szString, int iBufSize) -{ - TCHAR szStatus[32]; - StatusToString(iStatus, szStatus, ARRAY_SIZE(szStatus)); - - // "proro: user is online" - const TCHAR *szFormatString = m_sOptions.bPrefixProto ? _T("%s%s%s") : _T("%.0s%.0s%s"); - const TCHAR* szIs = TranslateT("is"); - - const char* szProto = - hContact==0 ? "Proto" : (char*)::CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - const TCHAR* szContactName = - (TCHAR *)::CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); - - memset(szString, 0, iBufSize*sizeof(TCHAR)); - -#ifdef _UNICODE - WCHAR wszProto[32]; - long lLen = MultiByteToWideChar(CP_ACP, 0, szProto, strlen(szProto), wszProto, ARRAY_SIZE(wszProto)); - wszProto[lLen] = _T('\0'); - - _sntprintf(szString, iBufSize-1, szFormatString, wszProto, _T(": "), szContactName); -#else - _sntprintf(szString, iBufSize-1, szFormatString, szProto, _T(": "), szContactName); -#endif - - TruncateWithDots(szString, iBufSize-1-_tcslen(szStatus)-_tcslen(szIs)-2); // 2 spaces around szIs - _sntprintf(szString+_tcslen(szString), iBufSize-1-_tcslen(szString), _T(" %s %s"), szIs, szStatus); - - return szString; -} - - -VOID CTooltipNotify::OnTooltipDblClicked(CTooltip *pTooltip) -{ - switch(m_sOptions.bLDblClick) - { - case SHOW_HIDE_CLIST: - ::CallService(MS_CLIST_SHOWHIDE,0,0); - break; - - case OPEN_MSGDLG: - { - TooltipsList::iterator iter = FindBy(&STooltipData::pTooltip, pTooltip); - STooltipData* pTooltipData = *iter; - WPARAM wParam = (WPARAM)pTooltipData->hContact; - if (wParam) ::CallService(MS_CLIST_CONTACTDOUBLECLICKED, wParam, 0); - break; - } - - default: - ::CallService(MS_CLIST_SHOWHIDE,0,0); - break; - } -} - - -BOOL CTooltipNotify::OnTooltipBeginMove(CTooltip *pTooltip) -{ - if (m_sOptions.bAutoPos) return FALSE; - - SuspendTimer(pTooltip); - return TRUE; -} - - -VOID CTooltipNotify::OnTooltipEndMove(CTooltip *pTooltip) -{ - RECT TooltipRect; - - pTooltip->get_Rect(&TooltipRect); - m_sOptions.wXPos = (WORD)TooltipRect.left; - m_sOptions.wYPos = (WORD)TooltipRect.top; - WriteSettingWord("xpos", m_sOptions.wXPos); - WriteSettingWord("ypos", m_sOptions.wYPos); - - ResumeTimer(pTooltip); -} - - -VOID CTooltipNotify::SuspendTimer(CTooltip *pTooltip) -{ - TooltipsList::iterator iter = FindBy(&STooltipData::pTooltip, pTooltip); - assert(iter!=m_TooltipsList.end()); - - STooltipData* pTooltipData = *iter; - - BOOL bSuccess = KillTimer(0, pTooltipData->idTimer); - assert(bSuccess); - pTooltipData->idTimer = 0; // denote that the timer is inactive -} - - -VOID CTooltipNotify::ResumeTimer(CTooltip *pTooltip) -{ - TooltipsList::iterator iter = FindBy(&STooltipData::pTooltip, pTooltip); - assert(iter!=m_TooltipsList.end()); - - STooltipData* pTooltipData = *iter; - - UINT_PTR idTimer = SetTimer(0, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper); - pTooltipData->idTimer = idTimer; -} - -template -CTooltipNotify::TooltipsList::iterator CTooltipNotify::FindBy(T STooltipData::* field, const T& value) -{ - for ( - TooltipsList::iterator iter = m_TooltipsList.begin(); - iter != m_TooltipsList.end(); - ++iter) - { - STooltipData *pTooltipData = *iter; - if (pTooltipData->*field == value) - { - return iter; - } - } - - return m_TooltipsList.end(); -} diff --git a/Tooltip_Notify/src/TooltipNotify.h b/Tooltip_Notify/src/TooltipNotify.h deleted file mode 100644 index 5e17597..0000000 --- a/Tooltip_Notify/src/TooltipNotify.h +++ /dev/null @@ -1,143 +0,0 @@ -// TooltipNotify.h: interface for the CTooltipNotify class. -// -////////////////////////////////////////////////////////////////////// - -#pragma once - -class CTooltip; - -class CTooltipNotify -{ -private: - struct STooltipData; - -public: - CTooltipNotify(HINSTANCE hinstDLL); - virtual ~CTooltipNotify(); - - // exceptions - class EAlreadyExists {}; - - BOOL EndNotify(STooltipData* pTooltipData); - VOID EndNotifyAll(); - CTooltip *BeginNotify(STooltipData *pTooltipData); - VOID OnTooltipDblClicked(CTooltip *pTooltip); - BOOL OnTooltipBeginMove(CTooltip *pTooltip); - VOID OnTooltipEndMove(CTooltip *pTooltip); - int InitializeOptions(WPARAM wParam, LPARAM lParam); - int ContactSettingChanged(WPARAM wParam, LPARAM lParam); - int ProtoAck(WPARAM wParam, LPARAM lParam); - int ModulesLoaded(WPARAM wParam,LPARAM lParam); - int ProtoContactIsTyping(WPARAM wParam, LPARAM lParam); - - static CTooltipNotify *GetObjInstance() { return s_pInstance; } - HINSTANCE GetDllInstance() const { return m_hDllInstance; } - -private: - // prohibit copying - CTooltipNotify(const CTooltipNotify& rhs); - CTooltipNotify& operator= (const CTooltipNotify& rhs); - -private: - static CTooltipNotify *s_pInstance; - static const char *s_szModuleNameOld; - static const char *s_szModuleName; - - const HINSTANCE m_hDllInstance; - const BOOL m_bNt50; - - struct SOptions { - BYTE bFirstRun; - BYTE bOffline; - BYTE bOnline; - BYTE bOther; - BYTE bTyping; - BYTE bIdle; - BYTE bConjSOLN; - BYTE bX2; - BYTE bAutoPos; - BYTE bBallonTip; - BYTE bTransp; - BYTE bTranspInput; - BYTE bAlpha; - BYTE bLDblClick; - BYTE bPrefixProto; - WORD wDuration; - WORD wXPos; - WORD wYPos; - WORD wStartupDelay; - BYTE bIgnoreNew; - BYTE bIgnoreUnknown; - } m_sOptions; - - struct STooltipData { - CTooltip *pTooltip; - UINT_PTR idTimer; - UINT uiTimeout; - HANDLE hContact; - int iStatus; - }; - - struct ProtoData { - const char* proto; - UINT_PTR timerId; - }; - - typedef std::vector TooltipsList; - typedef TooltipsList::iterator TooltipsListIter; - typedef TooltipsList::reverse_iterator TooltipsListRevIter; - TooltipsList m_TooltipsList; - - typedef std::vector MapTimerIdProto; - typedef MapTimerIdProto::iterator MapTimerIdProtoIter; - MapTimerIdProto m_mapTimerIdProto; - - MapTimerIdProtoIter FindProtoByTimer(UINT idTimer); - template TooltipsListIter FindBy(T STooltipData::* m, const T& value); - TCHAR *StatusToString(int iStatus, TCHAR *szStatus, int iBufSize); - TCHAR *MakeTooltipString(HANDLE hContact, int iStatus, TCHAR *szString, int iBufSize); - VOID MigrateSettings(); - void RegisterFonts(); - void GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF* bg); - void ResetCList(HWND hwndDlg); - void LoadList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown); - void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown); - VOID LoadSettings(); - VOID SaveSettings(); - VOID ValidateSettings(); - VOID ReadSettingsFromDlg(HWND hDlg); - VOID WriteSettingsToDlg(HWND hDlg); - - VOID SuspendTimer(CTooltip *pTooltip); - VOID ResumeTimer(CTooltip *pTooltip); - VOID OnConnectionTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); - VOID OnTooltipTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); - - // Dialog procedures - BOOL OptionsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); - BOOL ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); - BOOL ContactsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); - - static VOID CALLBACK ConnectionTimerProcWrapper(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) - { - CTooltipNotify::GetObjInstance()->OnConnectionTimer(hwnd, uMsg, idEvent, dwTime); - } - static VOID CALLBACK TooltipTimerProcWrapper(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) - { - CTooltipNotify::GetObjInstance()->OnTooltipTimer(hwnd, uMsg, idEvent, dwTime); - } - static BOOL CALLBACK OptionsDlgProcWrapper(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) - { - return CTooltipNotify::GetObjInstance()->OptionsDlgProc(hDlg, msg, wParam, lParam); - } - static BOOL CALLBACK ProtosDlgProcWrapper(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) - { - return CTooltipNotify::GetObjInstance()->ProtosDlgProc(hDlg, msg, wParam, lParam); - } - - static BOOL CALLBACK ContactsDlgProcWrapper(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) - { - return CTooltipNotify::GetObjInstance()->ContactsDlgProc(hDlg, msg, wParam, lParam); - } - -}; diff --git a/Tooltip_Notify/src/Utils.cpp b/Tooltip_Notify/src/Utils.cpp deleted file mode 100644 index ce73dbc..0000000 --- a/Tooltip_Notify/src/Utils.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Utils.cpp -// - -#include "stdafx.h" -#include "Utils.h" - -BOOL IsNt50() -{ - WORD wOsVersion = LOWORD(GetVersion()); - BYTE bMajorVer = LOBYTE(wOsVersion); - BYTE bMinorVer = HIBYTE(wOsVersion); - - return (bMajorVer>=5 && bMinorVer>=0); -} - -void TruncateWithDots(TCHAR* szString, int iNewLen) -{ - assert(iNewLen >= 0); - - int iOrigLen = _tcslen(szString); - if (iNewLen < iOrigLen) - { - TCHAR* p = szString+iNewLen; - *p = _T('\0'); - for(int i=0; --p>=szString && i<3; i++) - { - *p = _T('.'); - } - } -} - diff --git a/Tooltip_Notify/src/Utils.h b/Tooltip_Notify/src/Utils.h deleted file mode 100644 index d1ad4d0..0000000 --- a/Tooltip_Notify/src/Utils.h +++ /dev/null @@ -1,8 +0,0 @@ -// -// Utils.h -// - -#pragma once - -BOOL IsNt50(); -void TruncateWithDots(TCHAR* szString, int iNewLen); \ No newline at end of file diff --git a/Tooltip_Notify/src/main.cpp b/Tooltip_Notify/src/main.cpp deleted file mode 100644 index 5695120..0000000 --- a/Tooltip_Notify/src/main.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/*///////////////////////////////////////////// - Tooltip Notify plugin for Miranda IM -*////////////////////////////////////////////// - -#include "stdafx.h" -#include "version.h" -#include "TooltipNotify.h" - -// {5906A545-F31A-4726-B48F-03A09F060318} -static const MUUID MIID_TOOLTIPNOTIFY_UNICODE = -{ 0x5906a545, 0xf31a, 0x4726, { 0xb4, 0x8f, 0x3, 0xa0, 0x9f, 0x6, 0x3, 0x18 } }; - -// {C4475C65-630F-4e70-980F-C0CA98767110} -static const MUUID MIID_TOOLTIPNOTIFY_ANSI = -{ 0xc4475c65, 0x630f, 0x4e70, { 0x98, 0xf, 0xc0, 0xca, 0x98, 0x76, 0x71, 0x10 } }; - -// {03CD82B6-0BB5-4f26-8EB4-06CD8ECD36FF} -static const MUUID MIID_TOOLTIPNOTIFY = -{ 0x3cd82b6, 0xbb5, 0x4f26, { 0x8e, 0xb4, 0x6, 0xcd, 0x8e, 0xcd, 0x36, 0xff } }; - -static int InitializeOptions(WPARAM wParam,LPARAM lParam); -static int ModulesLoaded(WPARAM wParam,LPARAM lParam); -static int ContactSettingChanged(WPARAM wParam,LPARAM lParam); -static int ProtoAck(WPARAM,LPARAM); -static int ProtoContactIsTyping(WPARAM wParam,LPARAM lParam); - - -// Globals -PLUGINLINK *pluginLink; // cannot be static since it is used for mim service calls - -static HANDLE g_hContactSettingChanged = 0; -static HANDLE g_hOptionsInitialize = 0; -static HANDLE g_hModulesLoaded = 0; -static HANDLE g_hProtoAck = 0; -static HANDLE g_hProtoContactIsTyping = 0; -static HINSTANCE g_hInstDLL = 0; -static bool g_bRightModule = false; // i.e. ansi for win9x, and unicode for winnt - -// Main global object -static CTooltipNotify *g_pTooltipNotify = 0; - - -//================================================================================ -// plugin init/deinit routines -//================================================================================ - -BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - switch(fdwReason) - { - case DLL_PROCESS_ATTACH: - { - DisableThreadLibraryCalls(hInstDLL); - g_hInstDLL = hInstDLL; - - OSVERSIONINFO OsVersionInfo; - OsVersionInfo.dwOSVersionInfoSize = sizeof(OsVersionInfo); - GetVersionEx(&OsVersionInfo); - -#ifdef _UNICODE - g_bRightModule = (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -#else - g_bRightModule = (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); -#endif - - break; - } - - case DLL_PROCESS_DETACH: - break; - } - - return TRUE; -} - -extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) -{ - static const MUUID interfaces[] = {MIID_TOOLTIPNOTIFY, MIID_LAST}; - return interfaces; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - static char szWrongUsage9x[] = - "Warning! You are trying to use unicode version of the plugin on win9x system! " - "It can not be working here. You must use ansi version of the plugin."; - - static char szWrongUsageNt[] = - "Warning! You are using ansi version of the plugin on a unicode-aware system. " - "It is recommended to use unicode version of the plugin."; - - static char szFunctionalDescription[] = - "Shows a small tooltip above system tray area when a contact status is changed."; - - - static PLUGININFOEX sPluginInfo = - { - sizeof(PLUGININFOEX), - "Tooltip Notify", - PLUGIN_MAKE_VERSION(MAJOR,MINOR,BUILD,REVISION), // major, minor, revision, build -#ifdef _UNICODE - g_bRightModule ? szFunctionalDescription : szWrongUsage9x, -#else - g_bRightModule ? szFunctionalDescription : szWrongUsageNt, -#endif - "perf", - "perf@mail333.com", - "© 2004-2008 Gneedah software", - "http://addons.miranda-im.org/details.php?action=viewfile&id=1290", - UNICODE_AWARE, - 0, //doesn't replace anything built-in -#ifdef _UNICODE - MIID_TOOLTIPNOTIFY_UNICODE -#else - MIID_TOOLTIPNOTIFY_ANSI -#endif - }; - - return &sPluginInfo; -} - -extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) -{ - PLUGININFOEX* pPluginInfoEx = MirandaPluginInfoEx(mirandaVersion); - - static PLUGININFO sPluginInfo = - { - sizeof(PLUGININFO), - pPluginInfoEx->shortName, - pPluginInfoEx->version, - pPluginInfoEx->description, - pPluginInfoEx->author, - pPluginInfoEx->authorEmail, - pPluginInfoEx->copyright, - pPluginInfoEx->homepage, - pPluginInfoEx->flags, - pPluginInfoEx->replacesDefaultModule - }; - - return &sPluginInfo; -} - - -extern "C" int __declspec(dllexport) Load(PLUGINLINK *pLink) -{ -#ifdef _UNICODE - if (!g_bRightModule) return 0; -#else - // ansi version can work ok on winnt platform -#endif - - pluginLink = pLink; - - g_pTooltipNotify = new CTooltipNotify(g_hInstDLL); - assert(g_pTooltipNotify!=0); - - g_hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - - return 0; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - if (g_hContactSettingChanged) UnhookEvent(g_hContactSettingChanged); - if (g_hProtoContactIsTyping) UnhookEvent(g_hProtoContactIsTyping); - if (g_hProtoAck) UnhookEvent(g_hProtoAck); - if (g_hOptionsInitialize) UnhookEvent(g_hOptionsInitialize); - if (g_hModulesLoaded) UnhookEvent(g_hModulesLoaded); - delete g_pTooltipNotify; - - return 0; -} - - - -//================================================================================ -//================================================================================ -//================================================================================ - - -int ModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - g_hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); - g_hProtoAck = HookEvent(ME_PROTO_ACK, ProtoAck); - g_hProtoContactIsTyping = HookEvent(ME_PROTO_CONTACTISTYPING, ProtoContactIsTyping); - g_hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, InitializeOptions); - - return CTooltipNotify::GetObjInstance()->ModulesLoaded(wParam, lParam); -} - - -int ProtoContactIsTyping(WPARAM wParam, LPARAM lParam) -{ - return CTooltipNotify::GetObjInstance()->ProtoContactIsTyping(wParam, lParam); -} - - -int ProtoAck(WPARAM wParam, LPARAM lParam) -{ - return CTooltipNotify::GetObjInstance()->ProtoAck(wParam, lParam); -} - - -int ContactSettingChanged(WPARAM wParam, LPARAM lParam) -{ - return CTooltipNotify::GetObjInstance()->ContactSettingChanged(wParam, lParam); -} - - -int InitializeOptions(WPARAM wParam, LPARAM lParam) -{ - return CTooltipNotify::GetObjInstance()->InitializeOptions(wParam, lParam); -} - - - - - diff --git a/Tooltip_Notify/src/main.rc b/Tooltip_Notify/src/main.rc deleted file mode 100644 index 958bc49..0000000 --- a/Tooltip_Notify/src/main.rc +++ /dev/null @@ -1,204 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Russian resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -#ifdef _WIN32 -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#include ""version.rc2""\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Russian resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PROTOS DIALOGEX 0, 0, 106, 138 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | - WS_CAPTION | WS_SYSMENU -CAPTION "Select protocols" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - DEFPUSHBUTTON "OK",IDOK,28,117,50,14 - CONTROL "List1",IDC_PROTOS,"SysListView32",LVS_LIST | - LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | - WS_BORDER | WS_TABSTOP,7,7,91,103 -END - -IDD_CONTACTS DIALOGEX 0, 0, 284, 234 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | - WS_CAPTION | WS_SYSMENU -CAPTION "Choose contacts..." -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - LTEXT "Allow tooltip notifications for the following users:", - IDC_STATIC,8,9,268,9 - CONTROL "",IDC_CLIST,"CListControl",WS_TABSTOP | 0x3da,7,23,270, - 180,WS_EX_CLIENTEDGE - DEFPUSHBUTTON "OK",IDOK,171,213,50,14 - PUSHBUTTON "Cancel",IDCANCEL,227,213,50,14 -END - -IDD_OPTIONS DIALOGEX 0, 0, 316, 250 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Notify upon the following events",IDC_STATIC,5,7,304,32, - WS_GROUP - CONTROL "Online",IDC_ONLINE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,15,17,46,14 - CONTROL "Offline",IDC_OFFLINE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,66,17,46,14 - CONTROL "All other",IDC_OTHER,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,117,17,52,14 - CONTROL "Typing",IDC_TYPING,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,174,17,51,14 - PUSHBUTTON "Protocols",IDC_SEL_PROTO,254,162,46,14 - LTEXT "Suppress notifications upon connection for",IDC_STATIC, - 120,93,137,9 - EDITTEXT IDC_DELAYONCONN,259,91,27,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_DELAYONCONNSPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_NOTHOUSANDS,280,86,11,14 - LTEXT "sec",IDC_STATIC,290,93,12,10 - CONTROL "Prefix proto name",IDC_PREFIX_PROTO,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,15,163,70,11 - GROUPBOX "Duration",IDC_GB_DURATION,5,43,304,30 - LTEXT "Show tooltip for",IDC_STATIC,15,55,51,10 - EDITTEXT IDC_DURATION,69,53,36,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_DURATIONSPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS | UDS_NOTHOUSANDS,100,47,10,14 - LTEXT "ms",IDC_STATIC,109,55,14,10 - CONTROL "Duration x2 upon online event",IDC_X2,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,159,55,137,10 - GROUPBOX "Double click on tooltip",IDC_GB_DBLCLICK,5,78,103,54 - CONTROL "Shows/Hides CList",IDC_RB_CLIST,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,15,93,83,11 - CONTROL "Opens message dialog",IDC_RB_MSGDLG,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,15,112,88,11 - GROUPBOX "Behavior",IDC_STATIC,113,78,196,54 - GROUPBOX "Misc",IDC_STATIC,5,136,304,44 - CONTROL "Obey 'Suppress online notification' settings", - IDC_CONJSOLN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119, - 112,164,11 - CONTROL "Auto positioning",IDC_AUTOPOS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,15,147,75,11 - CONTROL "Transparent input",IDC_TRANSP_INPUT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,96,147,81,11 - PUSHBUTTON "Preview",IDC_PREVIEW,201,162,46,14 - GROUPBOX "Translucency options (Windows 2000/XP only)", - IDC_GB_TRANSP,5,185,304,34 - CONTROL "Transparent tooltip",IDC_TRANSPARENCY,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,15,200,73,9 - CONTROL "Slider1",IDC_TRANSPARENCY_SLIDER,"msctls_trackbar32", - TBS_TOP | TBS_NOTICKS | WS_TABSTOP,94,199,170,11 - LTEXT "000%",IDC_TRANSPERC,273,201,22,9 - PUSHBUTTON "Contacts",IDC_IGNORE,254,144,46,14 - CONTROL "Idle",IDC_IDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 227,17,51,14 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_PROTOS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 99 - TOPMARGIN, 7 - BOTTOMMARGIN, 131 - END - - IDD_CONTACTS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 277 - TOPMARGIN, 7 - BOTTOMMARGIN, 227 - END - - IDD_OPTIONS, DIALOG - BEGIN - VERTGUIDE, 5 - VERTGUIDE, 309 - HORZGUIDE, 246 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#include "version.rc2" -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Tooltip_Notify/src/resource.h b/Tooltip_Notify/src/resource.h deleted file mode 100644 index d67e8c5..0000000 --- a/Tooltip_Notify/src/resource.h +++ /dev/null @@ -1,47 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by main.rc -// -#define IDD_OPTIONS 101 -#define IDD_PROTOS 103 -#define IDD_CONTACTS 104 -#define IDC_ONLINE 1002 -#define IDC_OTHER 1003 -#define IDC_OFFLINE 1004 -#define IDC_TYPING 1006 -#define IDC_IDLE 1007 -#define IDC_X2 1011 -#define IDC_CONJSOLN 1012 -#define IDC_PROTOS 1014 -#define IDC_SEL_PROTO 1015 -#define IDC_AUTOPOS 1016 -#define IDC_TRANSPARENCY_SLIDER 1017 -#define IDC_TRANSPERC 1018 -#define IDC_TRANSPARENCY 1019 -#define IDC_GB_TRANSP 1020 -#define IDC_TRANSP_INPUT 1021 -#define IDC_PREVIEW 1025 -#define IDC_RB_CLIST 1026 -#define IDC_RB_MSGDLG 1027 -#define IDC_IGNORE 1028 -#define IDC_GB_DBLCLICK 1033 -#define IDC_BALLONTIP 1034 -#define IDC_GB_DURATION 1035 -#define IDC_PREFIX_PROTO 1039 -#define IDC_CLIST 1040 -#define IDC_DURATION 1283 -#define IDC_DURATIONSPIN 1284 -#define IDC_DELAYONCONN 1285 -#define IDC_DELAYONCONNSPIN 1286 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 105 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1042 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Tooltip_Notify/src/stdafx.cpp b/Tooltip_Notify/src/stdafx.cpp deleted file mode 100644 index cb27709..0000000 --- a/Tooltip_Notify/src/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// ttnotify.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/Tooltip_Notify/src/stdafx.h b/Tooltip_Notify/src/stdafx.h deleted file mode 100644 index d77c5a3..0000000 --- a/Tooltip_Notify/src/stdafx.h +++ /dev/null @@ -1,37 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define _WIN32_WINNT 0x0500 - -// Windows header files -#include -#include -#include - -// C/C++ header files -#include -#include -#include - -// Miranda IM header files -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) \ No newline at end of file diff --git a/Tooltip_Notify/src/version.h b/Tooltip_Notify/src/version.h deleted file mode 100644 index 9de12d2..0000000 --- a/Tooltip_Notify/src/version.h +++ /dev/null @@ -1,11 +0,0 @@ -/*********************************************************************/ -// -// Tooltip Notify version file -// -/*********************************************************************/ - - -#define MAJOR 0 -#define MINOR 6 -#define BUILD 0 -#define REVISION 47 diff --git a/Tooltip_Notify/src/version.rc b/Tooltip_Notify/src/version.rc deleted file mode 100644 index da191b4..0000000 --- a/Tooltip_Notify/src/version.rc +++ /dev/null @@ -1,52 +0,0 @@ -// -// version.rc2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -#include "version.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION MAJOR,MINOR,BUILD,REVISION - PRODUCTVERSION MAJOR,MINOR,BUILD,REVISION - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Shows a small tooltip above system tray area when a contact status is changed." - VALUE "CompanyName", "Gneedah software" - VALUE "FileDescription", "Tooltip Notify plugin for Miranda IM." - VALUE "FileVersion", "*,*,*,*" - VALUE "InternalName", "ttnotify.dll" - VALUE "LegalCopyright", "© 2004-2008 Gneedah software" - VALUE "OriginalFilename", "ttnotify.dll" - VALUE "ProductName", "Tooltip Notify" - VALUE "ProductVersion", "*,*,*,*" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3