From a39c5799008f43603593198980f9dae818f11cc3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 16 Jan 2014 14:01:25 +0000 Subject: - StdChat specific icons management moved back to StdChat; - fix for chat custom menus; git-svn-id: http://svn.miranda-ng.org/main/trunk@7680 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/chat/chat.h | 1 - plugins/Scriver/src/chat/log.cpp | 8 -------- plugins/Scriver/src/chat/main.cpp | 26 ++++++++++++++++++++++++++ plugins/Scriver/src/chat/services.cpp | 23 +---------------------- plugins/Scriver/src/chat/tools.cpp | 20 ++++++++++---------- 5 files changed, 37 insertions(+), 41 deletions(-) (limited to 'plugins/Scriver') diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h index 82b52be14b..a14407e314 100644 --- a/plugins/Scriver/src/chat/chat.h +++ b/plugins/Scriver/src/chat/chat.h @@ -93,7 +93,6 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRed void LoadMsgLogBitmaps(void); void FreeMsgLogBitmaps(void); TCHAR* GetChatLogsFilename (HANDLE hContact, time_t tTime); -TCHAR* MakeTimeStamp(TCHAR* pszStamp, time_t time); char* Log_CreateRtfHeader(MODULEINFO * mi, SESSION_INFO *si); //window.c diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index 31ec53b3db..613669777d 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -24,14 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef EM_GETSCROLLPOS #define EM_GETSCROLLPOS (WM_USER+221) #endif -TCHAR* MakeTimeStamp( TCHAR* pszStamp, time_t time) -{ - static TCHAR szTime[30]; - if ( !_tcsftime(szTime, SIZEOF(szTime)-1, pszStamp, localtime(&time))) - _tcsncpy(szTime, TranslateT(""), SIZEOF(szTime)); - return szTime; -} - static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb) { diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 6c26bc6fd4..5a2cb0854c 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -29,6 +29,24 @@ HMENU g_hMenu = NULL; GlobalLogSettings g_Settings; +void LoadModuleIcons(MODULEINFO *mi) +{ + HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); + + int overlayIcon = ImageList_AddIcon(hList, GetCachedIcon("chat_overlay")); + ImageList_SetOverlayImage(hList, overlayIcon, 1); + + int index = ImageList_AddIcon(hList, LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_ONLINE)); + mi->hOnlineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT); + mi->hOnlineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1)); + + index = ImageList_AddIcon(hList, LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_OFFLINE)); + mi->hOfflineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT); + mi->hOfflineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1)); + + ImageList_Destroy(hList); +} + static void OnAddLog(SESSION_INFO *si, int isOk) { if (isOk && si->hWnd) @@ -93,11 +111,19 @@ static void OnFlashWindow(SESSION_INFO *si, int bInactive) SendMessage(si->hWnd, GC_SETMESSAGEHIGHLIGHT, 0, 0); } +static void OnCreateModule(MODULEINFO *mi) +{ + LoadModuleIcons(mi); + mi->hOnlineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_ONLINE); + mi->hOfflineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_OFFLINE); +} + int Chat_Load() { mir_getCI(&g_Settings); pci->cbModuleInfo = sizeof(MODULEINFO); pci->cbSession = sizeof(SESSION_INFO); + pci->OnCreateModule = OnCreateModule; pci->OnNewUser = OnNewUser; pci->OnSetStatus = OnSetStatus; diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp index 5910841a66..9945563c48 100644 --- a/plugins/Scriver/src/chat/services.cpp +++ b/plugins/Scriver/src/chat/services.cpp @@ -23,13 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground) { - HWND hParent = NULL; if (!si) return; //Do we need to create a window? if (si->hWnd == NULL) { - hParent = GetParentWindow(si->windowData.hContact, TRUE); + HWND hParent = GetParentWindow(si->windowData.hContact, TRUE); si->hWnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), hParent, RoomWndProc, (LPARAM)si); } SendMessage(si->hWnd, DM_UPDATETABCONTROL, -1, (LPARAM)si); @@ -38,23 +37,3 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground) SendMessage(si->hWnd, WM_MOUSEACTIVATE, 0, 0); SetFocus(GetDlgItem(si->hWnd, IDC_CHAT_MESSAGE)); } - -void LoadModuleIcons(MODULEINFO *mi) -{ - HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); - - int overlayIcon = ImageList_AddIcon(hList, GetCachedIcon("chat_overlay")); - ImageList_SetOverlayImage(hList, overlayIcon, 1); - - mi->hOnlineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_ONLINE); - mi->hOnlineIcon = LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_ONLINE); - int index = ImageList_AddIcon(hList, mi->hOnlineIcon); - mi->hOnlineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1)); - - mi->hOfflineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_OFFLINE); - mi->hOfflineIcon = LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_OFFLINE); - index = ImageList_AddIcon(hList, mi->hOfflineIcon); - mi->hOfflineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1)); - - ImageList_Destroy(hList); -} diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 0745ad83c6..e5b2cfc617 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -164,34 +164,34 @@ TCHAR* GetChatLogsFilename(HANDLE hContact, time_t tTime) // day 1-31 rva[0].lptzKey = _T("d"); - rva[0].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%#d"), tTime)); + rva[0].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%#d"), tTime)); // day 01-31 rva[1].lptzKey = _T("dd"); - rva[1].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%d"), tTime)); + rva[1].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%d"), tTime)); // month 1-12 rva[2].lptzKey = _T("m"); - rva[2].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%#m"), tTime)); + rva[2].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%#m"), tTime)); // month 01-12 rva[3].lptzKey = _T("mm"); - rva[3].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%m"), tTime)); + rva[3].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%m"), tTime)); // month text short rva[4].lptzKey = _T("mon"); - rva[4].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%b"), tTime)); + rva[4].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%b"), tTime)); // month text rva[5].lptzKey = _T("month"); - rva[5].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%B"), tTime)); + rva[5].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%B"), tTime)); // year 01-99 rva[6].lptzKey = _T("yy"); - rva[6].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%y"), tTime)); + rva[6].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%y"), tTime)); // year 1901-9999 rva[7].lptzKey = _T("yyyy"); - rva[7].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%Y"), tTime)); + rva[7].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%Y"), tTime)); // weekday short rva[8].lptzKey = _T("wday"); - rva[8].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%a"), tTime)); + rva[8].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%a"), tTime)); // weekday rva[9].lptzKey = _T("weekday"); - rva[9].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%A"), tTime)); + rva[9].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%A"), tTime)); // end of array rva[10].lptzKey = NULL; rva[10].lptzValue = NULL; -- cgit v1.2.3