summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-16 14:01:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-16 14:01:25 +0000
commita39c5799008f43603593198980f9dae818f11cc3 (patch)
treef19575afc7e6bbe81e1ae804b94e05ce1cb2f184 /src/core
parente5ea3aa43eddf6ec4bfb86e7c39e6898e21c6490 (diff)
- 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
Diffstat (limited to 'src/core')
-rw-r--r--src/core/stdchat/src/chat.h9
-rw-r--r--src/core/stdchat/src/log.cpp8
-rw-r--r--src/core/stdchat/src/main.cpp26
-rw-r--r--src/core/stdchat/src/window.cpp8
4 files changed, 29 insertions, 22 deletions
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h
index 9f7e9cba7a..c8433da7ef 100644
--- a/src/core/stdchat/src/chat.h
+++ b/src/core/stdchat/src/chat.h
@@ -79,7 +79,12 @@ struct TABLIST
TABLIST *next;
};
-struct MODULEINFO : public GCModuleInfoBase {};
+struct MODULEINFO : public GCModuleInfoBase
+{
+ int OnlineIconIndex;
+ int OfflineIconIndex;
+};
+
struct SESSION_INFO : public GCSessionInfoBase {};
struct LOGSTREAMDATA : public GCLogStreamDataBase {};
@@ -95,6 +100,7 @@ extern GlobalLogSettings g_Settings;
extern SESSION_INFO g_TabSession;
extern TABLIST *g_TabList;
extern HMENU g_hMenu;
+extern HIMAGELIST hIconsList;
extern HINSTANCE g_hInst;
extern BOOL SmileyAddInstalled, PopupInstalled;
@@ -145,7 +151,6 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
// log.c
void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL bPhaseTwo);
void ValidateFilename (TCHAR * filename);
-TCHAR* MakeTimeStamp(TCHAR* pszStamp, time_t time);
char* Log_CreateRtfHeader(MODULEINFO * mi);
// window.c
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp
index 1942fe9a3f..10b6f8097e 100644
--- a/src/core/stdchat/src/log.cpp
+++ b/src/core/stdchat/src/log.cpp
@@ -23,14 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// The code for streaming the text is to a large extent copied from
// the srmm module and then modified to fit the chat module.
-TCHAR* MakeTimeStamp( TCHAR* pszStamp, time_t time)
-{
- static TCHAR szTime[30];
- if ( !_tcsftime(szTime, SIZEOF(szTime)-1, pszStamp, localtime(&time)))
- _tcsncpy(szTime, TranslateT("<invalid>"), SIZEOF(szTime));
- return szTime;
-}
-
static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
{
LOGSTREAMDATA *lstrdat = (LOGSTREAMDATA *) dwCookie;
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp
index eb345b53ab..18e16c34cd 100644
--- a/src/core/stdchat/src/main.cpp
+++ b/src/core/stdchat/src/main.cpp
@@ -31,6 +31,7 @@ HINSTANCE g_hInst;
int hLangpack;
BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE;
+HIMAGELIST hIconsList;
GlobalLogSettings g_Settings;
@@ -69,9 +70,23 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_CHAT, M
int OnShutdown(WPARAM, LPARAM)
{
TabM_RemoveAll();
+ ImageList_Destroy(hIconsList);
return 0;
}
+static void OnCreateModule(MODULEINFO *mi)
+{
+ mi->OnlineIconIndex = ImageList_AddIcon(hIconsList, LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
+ mi->hOnlineIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT);
+ mi->hOnlineTalkIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+ ImageList_AddIcon(hIconsList, mi->hOnlineTalkIcon);
+
+ mi->OfflineIconIndex = ImageList_AddIcon(hIconsList, LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
+ mi->hOfflineIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT);
+ mi->hOfflineTalkIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+ ImageList_AddIcon(hIconsList, mi->hOfflineTalkIcon);
+}
+
static void OnAddLog(SESSION_INFO *si, int isOk)
{
if (isOk && si->hWnd) {
@@ -327,13 +342,10 @@ void LoadIcons(void)
LoadLogIcons();
- pci->hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 3);
- pci->hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 100);
- ImageList_AddIcon(pci->hIconsList, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
- ImageList_AddIcon(pci->hIconsList, LoadIconEx("overlay", FALSE));
- ImageList_SetOverlayImage(pci->hIconsList, 1, 1);
- ImageList_AddIcon(pci->hImageList, (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0));
- ImageList_AddIcon(pci->hImageList, (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0));
+ hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 100);
+ ImageList_AddIcon(hIconsList, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
+ ImageList_AddIcon(hIconsList, LoadIconEx("overlay", FALSE));
+ ImageList_SetOverlayImage(hIconsList, 1, 1);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index b0bdffc27a..181dfa24e2 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -872,9 +872,10 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
s = (SESSION_INFO*)tc.lParam;
if (s) {
BOOL bOnline = db_get_w(s->hContact, s->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE ? TRUE : FALSE;
+ MODULEINFO *mi = pci->MM_FindModule(s->pszModule);
bDragging = TRUE;
iBeginIndex = i;
- ImageList_BeginDrag(pci->hIconsList, bOnline ? (pci->MM_FindModule(s->pszModule))->OnlineIconIndex : (pci->MM_FindModule(s->pszModule))->OfflineIconIndex, 8, 8);
+ ImageList_BeginDrag(hIconsList, bOnline ? mi->OnlineIconIndex : mi->OfflineIconIndex, 8, 8);
ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
SetCapture(hwnd);
}
@@ -1150,13 +1151,10 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)* 0x7FFFFFFF, 0);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback);
- // RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_MESSAGE));
- // RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_LOG));
-
si->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP | SBT_TOOLTIPS, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL);
SendMessage(si->hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0);
TabCtrl_SetMinTabWidth(GetDlgItem(hwndDlg, IDC_TAB), 80);
- TabCtrl_SetImageList(GetDlgItem(hwndDlg, IDC_TAB), pci->hIconsList);
+ TabCtrl_SetImageList(GetDlgItem(hwndDlg, IDC_TAB), hIconsList);
// enable tooltips
si->iOldItemID = -1;