diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-01-27 14:26:48 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-01-27 14:26:48 +0000 |
commit | fa08cfd41dfb84b42a2183a08a6045528a4e5263 (patch) | |
tree | 86b172e7ac6a3d7ab20878f3196d69179da58001 | |
parent | 155c12bafe3a30b502f8effc07e2ef258cdee85b (diff) |
oops - re-applied popup history renderer patch from Eblis
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@81 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | yapp/PPh2.ico | bin | 0 -> 2038 bytes | |||
-rw-r--r-- | yapp/YAPP.mdsp | 5 | ||||
-rw-r--r-- | yapp/common.h | 10 | ||||
-rw-r--r-- | yapp/popup_history.cpp | 325 | ||||
-rw-r--r-- | yapp/popup_history.h | 40 | ||||
-rw-r--r-- | yapp/popup_history_dlg.cpp | 744 | ||||
-rw-r--r-- | yapp/popups2.cpp | 7 | ||||
-rw-r--r-- | yapp/resource.h | 14 | ||||
-rw-r--r-- | yapp/resource.rc | 230 | ||||
-rw-r--r-- | yapp/services.cpp | 3 | ||||
-rw-r--r-- | yapp/version.h | 8 |
11 files changed, 1068 insertions, 318 deletions
diff --git a/yapp/PPh2.ico b/yapp/PPh2.ico Binary files differnew file mode 100644 index 0000000..f8aa63a --- /dev/null +++ b/yapp/PPh2.ico diff --git a/yapp/YAPP.mdsp b/yapp/YAPP.mdsp index 7828202..a4fe633 100644 --- a/yapp/YAPP.mdsp +++ b/yapp/YAPP.mdsp @@ -89,6 +89,7 @@ extraResourceOptions= 6=services.cpp
7=popup_history.cpp
8=str_utils.cpp
+9=popup_history_dlg.cpp
[Header]
1=message_pump.h
2=notify.h
@@ -107,5 +108,7 @@ extraResourceOptions= 1=popups2.rc
2=version.rc
[History]
-version.h,150
+common.h,2437
+popup_history.cpp,2330
popwin.cpp,0
+version.h,175
diff --git a/yapp/common.h b/yapp/common.h index 114aa47..48d85ee 100644 --- a/yapp/common.h +++ b/yapp/common.h @@ -67,3 +67,13 @@ extern int code_page; // work around a bug in neweventnotify, possibly httpserver
// ignore the address passed to the 'get plugin data' service
extern bool ignore_gpd_passed_addy;
+
+// win32 defines for mingw version of windows headers :(
+#ifndef LVM_SORTITEMSEX
+#define LVM_SORTITEMSEX (LVM_FIRST + 81)
+
+typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM);
+
+#define ListView_SortItemsEx(hwndLV, _pfnCompare, _lPrm) \
+ (BOOL)SendMessage((hwndLV), LVM_SORTITEMSEX, (WPARAM)(LPARAM)(_lPrm), (LPARAM)(PFNLVCOMPARE)(_pfnCompare))
+#endif
diff --git a/yapp/popup_history.cpp b/yapp/popup_history.cpp index b10062f..b413727 100644 --- a/yapp/popup_history.cpp +++ b/yapp/popup_history.cpp @@ -2,21 +2,11 @@ #define WIN32_LEAN_AND_MEAN #include "common.h" -#include "resource.h" #include "popup_history.h" -#include <time.h> -#define POPUPMENU_TITLE 100 -#define POPUPMENU_MESSAGE 101 -#define POPUPMENU_TIMESTAMP 102 - -HWND hHistoryWindow = 0; //the history window -PopupHistoryList lstPopupHistory; //defined in main.cpp - -WNDPROC oldPopupsListProc = NULL; - -PopupHistoryList::PopupHistoryList() +PopupHistoryList::PopupHistoryList(int renderer) { + this->renderer = renderer; size = HISTORY_SIZE; //fixed size (at least for now) historyData = (PopupHistoryData *) malloc(size * sizeof(PopupHistoryData)); //alloc space for data count = 0; @@ -32,9 +22,9 @@ void PopupHistoryList::Clear() { int i; for (i = 0; i < count; i++) - { - DeleteData(i); - } + { + DeleteData(i); + } count = 0; } @@ -53,23 +43,16 @@ void PopupHistoryList::RemoveItem(int index) int i; DeleteData(index); //free the mem for that particular item for (i = index + 1; i < count; i++) - { - historyData[i - 1] = historyData[i]; //shift all items to the left - } + { + historyData[i - 1] = historyData[i]; //shift all items to the left + } } void PopupHistoryList::DeleteData(int index) { PopupHistoryData *item = &historyData[index]; - if (item->flags && PHDF_UNICODE) //strings are dupped(), we need to free them - { - free(item->titleW); - free(item->messageW); - } - else{ - free(item->title); - free(item->message); - } + free(item->titleT); + free(item->messageT); item->timestamp = 0; //invalidate item item->title = NULL; item->message = NULL; @@ -79,12 +62,12 @@ void PopupHistoryList::DeleteData(int index) void PopupHistoryList::AddItem(PopupHistoryData item) { if (count >= size) - { - RemoveItem(0); //remove first element - the oldest - count--; //it will be inc'ed later - } + { + RemoveItem(0); //remove first element - the oldest + count--; //it will be inc'ed later + } historyData[count++] = item; //item has it's relevant strings dupped() - RefreshPopupHistory(hHistoryWindow); + RefreshPopupHistory(hHistoryWindow, GetRenderer()); } void PopupHistoryList::Add(char *title, char *message, time_t timestamp) @@ -109,285 +92,19 @@ void PopupHistoryList::Add(wchar_t *title, wchar_t *message, time_t timestamp) PopupHistoryData *PopupHistoryList::Get(int index) { if ((index < 0) || (index >= count)) //a bit of sanity check - { - return NULL; - } - - return &historyData[index]; -} - -//Stucture passed to list sort function -struct SortParams{ - HWND hList; - int column; -}; - -static int lastColumn = -1; //last sort column - -int CALLBACK PopupsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam) -{ - SortParams params = *(SortParams *) myParam; - const int MAX_SIZE = 512; - TCHAR text1[MAX_SIZE]; - TCHAR text2[MAX_SIZE]; - int res; - - ListView_GetItemText(params.hList, (int) lParam1, params.column, text1, MAX_SIZE); - ListView_GetItemText(params.hList, (int) lParam2, params.column, text2, MAX_SIZE); - - res = _tcsicmp(text1, text2); - - res = (params.column == lastColumn) ? -res : res; //do reverse search on second click on same column - - return res; -} - -void RefreshPopupHistory(HWND hWnd) -{ - if (!hWnd) - { - return; - } - HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY); - ListView_DeleteAllItems(hHistoryList); - - int i; - LVITEM item = {0}; - item.mask = LVIF_TEXT; - TCHAR buffer[1024]; - struct tm *myTime; - for (i = 0; i < lstPopupHistory.Count(); i++) - { - item.iItem = i; - PopupHistoryData *popupItem = lstPopupHistory.Get(i); - item.pszText = popupItem->titleT; - ListView_InsertItem(hHistoryList, &item); - ListView_SetItemText(hHistoryList, i, 1, popupItem->messageT); - myTime = localtime(&popupItem->timestamp); - _tcsftime(buffer, 1024, _T("%c"), myTime); - ListView_SetItemText(hHistoryList, i, 2, buffer); - } - - SortParams params = {0}; - params.hList = hHistoryList; - params.column = lastColumn; - - ListView_SortItemsEx(hHistoryList, PopupsCompare, ¶ms); -} - -void CopyPopupDataToClipboard(HWND hList, int selection) -{ - if (!selection) { - return; + return NULL; } - if (!GetOpenClipboardWindow()) - { - if (OpenClipboard(hList)) - { - TCHAR buffer[2048]; - buffer[0] = _T('\0'); - TCHAR *clipboard; - int i; - int found = 0; - int count = ListView_GetItemCount(hList); - int textType; -#ifdef _UNICODE - textType = CF_UNICODETEXT; -#else - textType = CF_TEXT; -#endif - - for (i = 0; i < count; i++) - { - if (ListView_GetItemState(hList, i, LVIS_SELECTED)) - { - ListView_GetItemText(hList, i, selection - 100, buffer, 2048); - found = 1; - break; - } - } - if (found) - { - EmptyClipboard(); - int len = _tcslen(buffer); - - HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (len + 2) * sizeof(TCHAR)); - clipboard = (TCHAR *) GlobalLock(hData); - _tcsncpy(clipboard, buffer, len); - clipboard[len] = _T('\0'); - GlobalUnlock(hData); - if (!SetClipboardData(textType, hData)) - { - PUShowMessage("Could not set clipboard data", SM_WARNING); - } - } - CloseClipboard(); - } - else{ - PUShowMessage("Could not open clipboard", SM_WARNING); - } - } - else{ - PUShowMessage("The clipboard is not available", SM_WARNING); - } + return &historyData[index]; } -//subclass proc for the list view -BOOL CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +int PopupHistoryList::GetRenderer() { - switch (msg) - { - case WM_CONTEXTMENU: - { - int x = LOWORD(lParam); - int y = HIWORD(lParam); - int selection; - - HMENU hMenu = CreatePopupMenu(); - AppendMenu(hMenu, MF_STRING, POPUPMENU_TITLE, TranslateT("Copy title to clipboard")); - AppendMenu(hMenu, MF_STRING, POPUPMENU_MESSAGE, TranslateT("Copy message to clipboard")); - AppendMenu(hMenu, MF_STRING, POPUPMENU_TIMESTAMP, TranslateT("Copy timestamp to clipboard")); - selection = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, hWnd, NULL); - DestroyMenu(hMenu); - if (selection) - { - CopyPopupDataToClipboard(hWnd, selection); - } - - break; - } - - case WM_KEYUP: - { - switch (wParam) - { - case 'C': - { - if (GetKeyState(VK_CONTROL)) - { - CopyPopupDataToClipboard(hWnd, POPUPMENU_MESSAGE); - } - - break; - } - - case VK_ESCAPE: - { - SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0); - - break; - } - - } - - break; - } - - case WM_SYSKEYDOWN: - { - if (wParam == 'X') - { - SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0); - } - - break; - } - } - - return CallWindowProc(oldPopupsListProc, hWnd, msg, wParam, lParam); + return renderer; } -//this is the history list window handler -BOOL CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +void PopupHistoryList::SetRenderer(int newRenderer) { - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hWnd); - HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY); - - ListView_SetExtendedListViewStyleEx (hHistoryList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); - - oldPopupsListProc = (WNDPROC) SetWindowLong(hHistoryList, GWL_WNDPROC, (LONG) PopupsListSubclassProc); - - LVCOLUMN col; - col.mask = LVCF_TEXT | LVCF_WIDTH; - col.pszText = _T("Title"); - col.cx = 100; - ListView_InsertColumn(hHistoryList, 0, &col); - col.pszText = _T("Message"); - col.cx = 450; - ListView_InsertColumn(hHistoryList, 1, &col); - col.pszText = _T("Timestamp"); - col.cx = 115; - ListView_InsertColumn(hHistoryList, 2, &col); - RefreshPopupHistory(hWnd); - - return TRUE; - } - - case WM_DESTROY: - { - hHistoryWindow = NULL; - - break; - } - - case WM_CLOSE: - { - DestroyWindow(hWnd); - - break; - } - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_CLOSE: - { - SendMessage(hWnd, WM_CLOSE, 0, 0); - - break; - } - } - - break; - } - - case WM_NOTIFY: - { - switch(((LPNMHDR)lParam)->idFrom) - { - case IDC_LST_HISTORY: - { - switch (((LPNMHDR)lParam)->code) - { - case LVN_COLUMNCLICK: - { - LPNMLISTVIEW lv = (LPNMLISTVIEW) lParam; - int column = lv->iSubItem; - SortParams params = {0}; - params.hList = GetDlgItem(hWnd, IDC_LST_HISTORY); - params.column = column; - - ListView_SortItemsEx(params.hList, PopupsCompare, (LPARAM) ¶ms); - lastColumn = (params.column == lastColumn) ? -1 : params.column; - - break; - } - } - - break; - } - } - - break; - } - } - - return 0; + renderer = newRenderer; } diff --git a/yapp/popup_history.h b/yapp/popup_history.h index 7bc49a0..cf8b6b3 100644 --- a/yapp/popup_history.h +++ b/yapp/popup_history.h @@ -1,10 +1,41 @@ #ifndef __popup_history_h__ #define __popup_history_h__ +#include "m_ieview.h" //need this for special renderers + +/****HISTORY ++ STUFF ***/ +//there's no include file for h++ yet +#ifndef MS_HPP_EG_WINDOW +#define MS_HPP_EG_WINDOW "History++/ExtGrid/NewWindow" +#endif + +#ifndef MS_HPP_EG_EVENT +#define MS_HPP_EG_EVENT "History++/ExtGrid/Event" +#endif + +#ifndef MS_HPP_EG_NAVIGATE +#define MS_HPP_EG_NAVIGATE "History++/ExtGrid/Navigate" +#endif + +#ifndef MS_HPP_EG_OPTIONSCHANGED +#define MS_HPP_EG_OPTIONSCHANGED "History++/ExtGrid/OptionsChanged" +#endif +/************************/ + + + #define HISTORY_SIZE 200 //number of popup history items #define PHDF_UNICODE 1 +#define POPUPMENU_TITLE 100 +#define POPUPMENU_MESSAGE 101 +#define POPUPMENU_TIMESTAMP 102 + +#define RENDER_DEFAULT 0x00000 +#define RENDER_HISTORYPP 0x00001 +#define RENDER_IEVIEW 0x00002 + struct PopupHistoryData{ DWORD flags; //PHDF_* flags union{ @@ -26,15 +57,19 @@ class PopupHistoryList{ PopupHistoryData *historyData; //historyData[0] - oldest, historyData[size - 1] - newest int count; int size; + int renderer; void DeleteData(int index); void AddItem(PopupHistoryData item); //adds a PopupHistoryData item void RemoveItem(int index); public: - PopupHistoryList(); + PopupHistoryList(int renderer = RENDER_DEFAULT); ~PopupHistoryList(); + int GetRenderer(); + void SetRenderer(int newRenderer); + void Add(char *title, char *message, time_t timestamp); void Add(wchar_t *title, wchar_t *message, time_t timestamp); @@ -54,7 +89,8 @@ lParam - 0 extern PopupHistoryList lstPopupHistory; //defined in main.cpp extern HWND hHistoryWindow; //the history window -void RefreshPopupHistory(HWND hWnd); +extern HICON hiPopupHistory; +void RefreshPopupHistory(HWND hWnd, int renderer); BOOL CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/yapp/popup_history_dlg.cpp b/yapp/popup_history_dlg.cpp new file mode 100644 index 0000000..f75e23e --- /dev/null +++ b/yapp/popup_history_dlg.cpp @@ -0,0 +1,744 @@ +#include "common.h"
+#include "resource.h"
+#include "popup_history.h"
+#include <time.h>
+
+//************ Some helper resize stuff ******************
+
+#define MIN_HISTORY_WIDTH 540
+#define MIN_HISTORY_HEIGHT 300
+
+#define GAP_SIZE 2
+
+#define ANCHOR_LEFT 0x000001
+#define ANCHOR_RIGHT 0x000002
+#define ANCHOR_TOP 0x000004
+#define ANCHOR_BOTTOM 0x000008
+#define ANCHOR_ALL ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM
+
+WNDPROC oldPopupsListProc = NULL;
+
+HWND hHistoryWindow = 0; //the history window
+HICON hiPopupHistory; //popup history icon
+PopupHistoryList lstPopupHistory; //defined in main.cpp
+
+const TCHAR *szHistoryColumns[] = {_T("Title"), _T("Message"), _T("Timestamp")}; //need to make sure that the string and size vectors have the same number of elements
+const int cxHistoryColumns[] = {100, 450, 115};
+const int cHistoryColumns = sizeof(szHistoryColumns) / sizeof(szHistoryColumns[0]);
+
+struct PopupHistoryWindowData{
+ HWND hIEView;
+};
+
+void ScreenToClient(HWND hWnd, LPRECT rect)
+{
+ POINT pt;
+ int cx = rect->right - rect->left;
+ int cy = rect->bottom - rect->top;
+ pt.x = rect->left;
+ pt.y = rect->top;
+ ScreenToClient(hWnd, &pt);
+ rect->left = pt.x;
+ rect->top = pt.y;
+ rect->right = pt.x + cx;
+ rect->bottom = pt.y + cy;
+}
+
+RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors)
+{
+ RECT rChild;
+ RECT rTmp;
+
+ GetWindowRect(window, &rChild);
+ ScreenToClient(parentPos->hwnd, &rChild);
+
+ int cx = rParent->right - rParent->left;
+ int cy = rParent->bottom - rParent->top;
+ if ((cx == parentPos->cx) && (cy == parentPos->cy))
+ {
+ return rChild;
+ }
+ if (parentPos->flags & SWP_NOSIZE)
+ {
+ return rChild;
+ }
+
+ rTmp.left = parentPos->x - rParent->left;
+ rTmp.right = (parentPos->x + parentPos->cx) - rParent->right;
+ rTmp.bottom = (parentPos->y + parentPos->cy) - rParent->bottom;
+ rTmp.top = parentPos->y - rParent->top;
+
+ cx = (rTmp.left) ? -rTmp.left : rTmp.right;
+ cy = (rTmp.top) ? -rTmp.top : rTmp.bottom;
+
+ rChild.right += cx;
+ rChild.bottom += cy;
+ //expanded the window accordingly, now we need to enforce the anchors
+ if ((anchors & ANCHOR_LEFT) && (!(anchors & ANCHOR_RIGHT)))
+ {
+ rChild.right -= cx;
+ }
+ if ((anchors & ANCHOR_TOP) && (!(anchors & ANCHOR_BOTTOM)))
+ {
+ rChild.bottom -= cy;
+ }
+ if ((anchors & ANCHOR_RIGHT) && (!(anchors & ANCHOR_LEFT)))
+ {
+ rChild.left += cx;
+ }
+ if ((anchors & ANCHOR_BOTTOM) && (!(anchors & ANCHOR_TOP)))
+ {
+ rChild.top += cy;
+ }
+ return rChild;
+}
+
+void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors)
+{
+ RECT rParent;
+ RECT rChild;
+
+ if (parentPos->flags & SWP_NOSIZE)
+ {
+ return;
+ }
+ GetWindowRect(parentPos->hwnd, &rParent);
+ rChild = AnchorCalcPos(window, &rParent, parentPos, anchors);
+ MoveWindow(window, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, FALSE);
+}
+
+void AddAnchorWindowToDeferList(HDWP &hdWnds, HWND window, RECT *rParent, WINDOWPOS *wndPos, int anchors)
+{
+ RECT rChild = AnchorCalcPos(window, rParent, wndPos, anchors);
+ hdWnds = DeferWindowPos(hdWnds, window, HWND_NOTOPMOST, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, SWP_NOZORDER);
+}
+//************************************************************
+
+//Stucture passed to list sort function
+struct SortParams{
+ HWND hList;
+ int column;
+};
+
+static int lastColumn = -1; //last sort column
+
+int MatchesFilterCS(const TCHAR *filter, const PopupHistoryData *popupItem) //case sensitive
+{
+ if (_tcslen(filter) <= 0) { return 1; } //if no filter is set then the popup item matches the filter
+ int match = 0;
+
+ match = (_tcsstr(popupItem->messageT, filter)) ? 1 : match; //check message part
+
+ if (!match) //check title part of no match has been found
+ {
+ match = (_tcsstr(popupItem->titleT, filter)) ? 1 : match;
+ }
+
+ if (!match) //if no match has been found yet try to match the timestamp
+ {
+ TCHAR buffer[1024];
+ struct tm *myTime = localtime(&popupItem->timestamp);
+ _tcsftime(buffer, 1024, _T("%c"), myTime);
+ match = (_tcsstr(buffer, filter)) ? 1 : match;
+ }
+
+ return match;
+}
+
+__inline void ConvertCase(TCHAR *dest, const TCHAR *source, size_t size)
+{
+ _tcsncpy(dest, source, size);
+ _tcslwr(dest);
+}
+
+int MatchesFilterCI(const TCHAR *filterS, const PopupHistoryData *popupItem)
+{
+ if (_tcslen(filterS) <= 0) { return 1; } //if no filter is set then the popup item matches the filter
+ int match = 0;
+ const int BUFFER_SIZE = 1024;
+ TCHAR buffer[BUFFER_SIZE];
+ TCHAR filterI[BUFFER_SIZE];
+
+ ConvertCase(filterI, filterS, BUFFER_SIZE);
+
+ ConvertCase(buffer, popupItem->messageT, BUFFER_SIZE); //check message part
+ match = (_tcsstr(buffer, filterI)) ? 1 : match;
+
+ if (!match) // check title part of no match has been found
+ {
+ ConvertCase(buffer, popupItem->titleT, BUFFER_SIZE);
+ match = (_tcsstr(buffer, filterI)) ? 1 : match;
+ }
+
+ if (!match) //if no match has been found yet try to match the timestamp
+ {
+ struct tm *myTime = localtime(&popupItem->timestamp);
+ _tcsftime(buffer, 1024, _T("%c"), myTime);
+ match = (_tcsstr(buffer, filterI)) ? 1 : match;
+ }
+
+ return match;
+}
+
+int CALLBACK PopupsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam)
+{
+ SortParams params = *(SortParams *) myParam;
+ const int MAX_SIZE = 512;
+ TCHAR text1[MAX_SIZE];
+ TCHAR text2[MAX_SIZE];
+ int res;
+
+ ListView_GetItemText(params.hList, (int) lParam1, params.column, text1, MAX_SIZE);
+ ListView_GetItemText(params.hList, (int) lParam2, params.column, text2, MAX_SIZE);
+
+ res = _tcsicmp(text1, text2);
+
+ res = (params.column == lastColumn) ? -res : res; //do reverse search on second click on same column
+
+ return res;
+}
+
+
+
+int CalcCustomControlPos(IEVIEWWINDOW *ieWnd, HWND hMainWindow)
+{
+ RECT rect;
+ GetWindowRect(GetDlgItem(hMainWindow, IDC_LST_HISTORY), &rect);
+ ScreenToClient(hMainWindow, &rect);
+
+ ieWnd->x = rect.left + GAP_SIZE;
+ ieWnd->y = rect.top + GAP_SIZE;
+ ieWnd->cx = rect.right - rect.left - (2 * GAP_SIZE);
+ ieWnd->cy = rect.bottom - rect.top - (2 * GAP_SIZE);
+ return 0;
+}
+
+void MoveCustomControl(HWND hWnd, int renderer)
+{
+ switch (renderer)
+ {
+ case RENDER_HISTORYPP:
+ case RENDER_IEVIEW:
+ {
+ PopupHistoryWindowData *data = (PopupHistoryWindowData *) GetWindowLong(hWnd, GWL_USERDATA);
+ if (data)
+ {
+ IEVIEWWINDOW ieWnd = {0};
+ ieWnd.cbSize = sizeof(ieWnd);
+ ieWnd.parent = hWnd;
+ ieWnd.hwnd = data->hIEView;
+ ieWnd.iType = IEW_SETPOS;
+ CalcCustomControlPos(&ieWnd, hWnd);
+
+ CallService((renderer == RENDER_HISTORYPP) ? MS_HPP_EG_WINDOW : MS_IEVIEW_WINDOW, 0, (LPARAM) &ieWnd);
+ }
+
+ break;
+ }
+ }
+}
+
+void LoadRenderer(HWND hWnd, int renderer)
+{
+ switch (renderer)
+ {
+ case RENDER_HISTORYPP:
+ case RENDER_IEVIEW:
+ {
+ IEVIEWWINDOW ieWnd = {0};
+
+ ieWnd.cbSize = sizeof(ieWnd);
+ ieWnd.iType = IEW_CREATE;
+ ieWnd.dwMode = IEWM_HISTORY;
+ ieWnd.dwFlags = 0;
+ ieWnd.parent = hWnd;
+ CalcCustomControlPos(&ieWnd, hWnd);
+
+ CallService((renderer == RENDER_HISTORYPP) ? MS_HPP_EG_WINDOW : MS_IEVIEW_WINDOW, 0, (LPARAM) &ieWnd); //create the IeView or H++ control.
+
+ PopupHistoryWindowData *data = (PopupHistoryWindowData *) malloc(sizeof(PopupHistoryWindowData)); //create custom control data
+ data->hIEView = ieWnd.hwnd;
+ ShowWindow(data->hIEView, SW_SHOW);
+ SetWindowLong(hWnd, GWL_USERDATA, (LONG) data); //set it as the window's user data
+ ShowWindow(GetDlgItem(hWnd, IDC_LST_HISTORY), SW_HIDE);
+ //SetWindowPos(GetDlgItem(hWnd, IDC_LST_HISTORY), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+ break;
+ }
+ }
+}
+
+void UnloadRenderer(HWND hWnd, int renderer)
+{
+ switch (renderer)
+ {
+ case RENDER_HISTORYPP:
+ case RENDER_IEVIEW:
+ {
+ PopupHistoryWindowData *data = (PopupHistoryWindowData *) GetWindowLong(hWnd, GWL_USERDATA);
+
+ if (data)
+ {
+ IEVIEWWINDOW ieWnd = {0};
+ ieWnd.cbSize = sizeof(ieWnd);
+ ieWnd.parent = hWnd;
+ ieWnd.hwnd = data->hIEView;
+ ieWnd.iType = IEW_DESTROY;
+ CallService((renderer == RENDER_HISTORYPP) ? MS_HPP_EG_WINDOW : MS_IEVIEW_WINDOW, 0, (LPARAM) &ieWnd);
+
+ free(data);
+ }
+
+ break;
+ }
+ }
+}
+
+void DeleteOldEvents(HWND hWnd, int renderer)
+{
+ switch (renderer)
+ {
+ case RENDER_HISTORYPP:
+ case RENDER_IEVIEW:
+ {
+ PopupHistoryWindowData *data = (PopupHistoryWindowData *) GetWindowLong(hWnd, GWL_USERDATA);
+ if (data)
+ {
+ IEVIEWEVENT ieEvent = {0};
+ ieEvent.cbSize = sizeof(IEVIEWEVENT);
+ ieEvent.hwnd = data->hIEView;
+ ieEvent.iType = IEE_CLEAR_LOG;
+
+ CallService((renderer == RENDER_HISTORYPP) ? MS_HPP_EG_EVENT : MS_IEVIEW_EVENT, 0, (LPARAM) &ieEvent);
+ }
+
+ break;
+ }
+
+ case RENDER_DEFAULT:
+ default:
+ {
+ ListView_DeleteAllItems(GetDlgItem(hWnd, IDC_LST_HISTORY));
+
+ break;
+ }
+
+ }
+}
+
+typedef int (*SIG_MATCHESFILTER)(const TCHAR *filter, const PopupHistoryData *popupItem);
+typedef void (*SIG_ADDEVENTS)(HWND hWnd, int renderer, TCHAR *filter, SIG_MATCHESFILTER MatchesFilter);
+
+IEVIEWEVENTDATA *CreateAndFillEventData(PopupHistoryData *popupItem)
+{
+ IEVIEWEVENTDATA *eventData = (IEVIEWEVENTDATA *) malloc(sizeof(IEVIEWEVENTDATA));
+ if (eventData)
+ {
+ memset(eventData, 0, sizeof(IEVIEWEVENTDATA));
+
+ eventData->cbSize = sizeof(IEVIEWEVENTDATA);
+ eventData->iType = IEED_EVENT_MESSAGE;
+#ifdef UNICODE
+ eventData->dwFlags = IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT | IEEDF_UNICODE_TEXT2;
+#endif
+ eventData->pszNickW = popupItem->titleW;
+ eventData->pszTextW = popupItem->messageW;
+ eventData->time = (DWORD) popupItem->timestamp;
+ eventData->next = NULL;
+ }
+
+ return eventData;
+}
+
+void AddEventsCustomControl(HWND hWnd, int renderer, TCHAR *filter, SIG_MATCHESFILTER MatchesFilter)
+{
+ PopupHistoryWindowData *pwData = (PopupHistoryWindowData *) GetWindowLong(hWnd, GWL_USERDATA);
+ if (pwData)
+ {
+ IEVIEWEVENT ieEvent = {0};
+ ieEvent.cbSize = sizeof(IEVIEWEVENT);
+ ieEvent.hwnd = pwData->hIEView;
+ ieEvent.codepage = CP_ACP;
+ ieEvent.iType = IEE_LOG_MEM_EVENTS;
+ ieEvent.hContact = NULL;//(HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); IEVIEW needs a contact handle !!
+
+ IEVIEWEVENTDATA *eventData = NULL;
+ IEVIEWEVENTDATA *cED = NULL;
+ IEVIEWEVENTDATA *prevED = NULL;
+
+ int i;
+ int count = 0;
+ int size = lstPopupHistory.Count();
+ PopupHistoryData *popupItem;
+
+ for (i = 0; i < size; i++)
+ {
+ popupItem = lstPopupHistory.Get(i);
+ if (MatchesFilter(filter, popupItem))
+ {
+ cED = CreateAndFillEventData(popupItem);
+ if (cED)
+ {
+ count++;
+ if (!eventData)
+ {
+ eventData = cED;
+ }
+ else{
+ prevED->next = cED;
+ }
+
+ prevED = cED;
+ }
+ }
+ }
+ ieEvent.count = count;
+ ieEvent.eventData = eventData;
+
+ CallService((renderer == RENDER_HISTORYPP) ? MS_HPP_EG_EVENT : MS_IEVIEW_EVENT, 0, (LPARAM) &ieEvent);
+
+ while (eventData)
+ {
+ cED = eventData;
+ eventData = eventData->next;
+ free(cED);
+ }
+ }
+}
+
+void AddEventsDefault(HWND hWnd, int renderer, TCHAR *filter, SIG_MATCHESFILTER MatchesFilter)
+{
+ HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY);
+ TCHAR buffer[1024];
+ struct tm *myTime;
+
+ LVITEM item = {0};
+ item.mask = LVIF_TEXT;
+
+ int i, lIndex;
+ lIndex = 0;
+ PopupHistoryData *popupItem;
+ for (i = 0; i < lstPopupHistory.Count(); i++)
+ {
+ item.iItem = lIndex;
+ popupItem = lstPopupHistory.Get(i);
+ if (MatchesFilter(filter, popupItem))
+ {
+ item.pszText = popupItem->titleT;
+ ListView_InsertItem(hHistoryList, &item);
+ ListView_SetItemText(hHistoryList, lIndex, 1, popupItem->messageT);
+ myTime = localtime(&popupItem->timestamp);
+ _tcsftime(buffer, 1024, _T("%c"), myTime);
+ ListView_SetItemText(hHistoryList, lIndex++, 2, buffer);
+ }
+ }
+}
+
+void RefreshPopupHistory(HWND hWnd, int renderer)
+{
+ if (!hWnd) { return; }
+ const int MAX_FILTER_SIZE = 1024;
+ SIG_MATCHESFILTER MatchesFilter = (IsDlgButtonChecked(hWnd, IDC_HISTORY_FILTER_CASESENSITIVE)) ? MatchesFilterCS : MatchesFilterCI; //case sensitive compare or not ?
+
+ SIG_ADDEVENTS AddEvents = (renderer == RENDER_DEFAULT) ? AddEventsDefault : AddEventsCustomControl;
+
+ TCHAR filter[MAX_FILTER_SIZE];
+ DeleteOldEvents(hWnd, renderer); //delete events
+
+ GetWindowText(GetDlgItem(hWnd, IDC_HISTORY_FILTER), filter, MAX_FILTER_SIZE); //get filter text
+
+ AddEvents(hWnd, renderer, filter, MatchesFilter);
+
+ if (renderer == RENDER_DEFAULT)
+ {
+ HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY);
+ SortParams params = {0};
+ params.hList = hHistoryList;
+ params.column = lastColumn;
+
+ ListView_SortItemsEx(hHistoryList, PopupsCompare, ¶ms);
+ }
+}
+
+void CopyPopupDataToClipboard(HWND hList, int selection)
+{
+ if (!selection)
+ {
+ return;
+ }
+
+ if (!GetOpenClipboardWindow())
+ {
+ if (OpenClipboard(hList))
+ {
+ TCHAR buffer[2048];
+ buffer[0] = _T('\0');
+ TCHAR *clipboard;
+ int i;
+ int found = 0;
+ int count = ListView_GetItemCount(hList);
+ int textType;
+#ifdef _UNICODE
+ textType = CF_UNICODETEXT;
+#else
+ textType = CF_TEXT;
+#endif
+
+ for (i = 0; i < count; i++)
+ {
+ if (ListView_GetItemState(hList, i, LVIS_SELECTED))
+ {
+ ListView_GetItemText(hList, i, selection - 100, buffer, 2048);
+ found = 1;
+ break;
+ }
+ }
+ if (found)
+ {
+ EmptyClipboard();
+ int len = _tcslen(buffer);
+
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (len + 2) * sizeof(TCHAR));
+ clipboard = (TCHAR *) GlobalLock(hData);
+ _tcsncpy(clipboard, buffer, len);
+ clipboard[len] = _T('\0');
+ GlobalUnlock(hData);
+ if (!SetClipboardData(textType, hData))
+ {
+ PUShowMessage("Could not set clipboard data", SM_WARNING);
+ }
+ }
+ CloseClipboard();
+ }
+ else{
+ PUShowMessage("Could not open clipboard", SM_WARNING);
+ }
+ }
+ else{
+ PUShowMessage("The clipboard is not available", SM_WARNING);
+ }
+}
+
+//subclass proc for the list view
+BOOL CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_CONTEXTMENU:
+ {
+ int x = LOWORD(lParam);
+ int y = HIWORD(lParam);
+ int selection;
+
+ HMENU hMenu = CreatePopupMenu();
+ AppendMenu(hMenu, MF_STRING, POPUPMENU_TITLE, TranslateT("Copy title to clipboard"));
+ AppendMenu(hMenu, MF_STRING, POPUPMENU_MESSAGE, TranslateT("Copy message to clipboard"));
+ AppendMenu(hMenu, MF_STRING, POPUPMENU_TIMESTAMP, TranslateT("Copy timestamp to clipboard"));
+ selection = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, hWnd, NULL);
+ DestroyMenu(hMenu);
+ if (selection)
+ {
+ CopyPopupDataToClipboard(hWnd, selection);
+ }
+
+ break;
+ }
+
+ case WM_KEYUP:
+ {
+ switch (wParam)
+ {
+ case 'C':
+ {
+ if (GetKeyState(VK_CONTROL))
+ {
+ CopyPopupDataToClipboard(hWnd, POPUPMENU_MESSAGE);
+ }
+
+ break;
+ }
+
+ case VK_ESCAPE:
+ {
+ SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
+
+ break;
+ }
+
+ }
+
+ break;
+ }
+
+ case WM_SYSKEYDOWN:
+ {
+ if (wParam == 'X')
+ {
+ SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
+ }
+
+ break;
+ }
+ }
+
+ return CallWindowProc(oldPopupsListProc, hWnd, msg, wParam, lParam);
+}
+
+//load the columns
+void LoadHistoryColumns(HWND hHistoryList)
+{
+ LVCOLUMN col;
+ col.mask = LVCF_TEXT | LVCF_WIDTH;
+ int i;
+
+ for (i = 0; i < cHistoryColumns; i++)
+ {
+ col.pszText = TranslateTS(szHistoryColumns[i]);
+ col.cx = cxHistoryColumns[i];
+ ListView_InsertColumn(hHistoryList, i, &col);
+ }
+}
+
+//this is the history list window handler
+BOOL CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ static int bInitializing;
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ bInitializing = 1;
+ int renderer = lstPopupHistory.GetRenderer();
+
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiPopupHistory);
+
+ LoadRenderer(hWnd, renderer);
+
+ TranslateDialogDefault(hWnd);
+ HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY);
+
+ ListView_SetExtendedListViewStyleEx(hHistoryList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
+
+ oldPopupsListProc = (WNDPROC) SetWindowLong(hHistoryList, GWL_WNDPROC, (LONG) PopupsListSubclassProc);
+
+ LoadHistoryColumns(hHistoryList);
+
+ RefreshPopupHistory(hWnd, renderer);
+
+ bInitializing = 0;
+
+ return TRUE;
+ }
+
+ case WM_DESTROY:
+ {
+ UnloadRenderer(hWnd, lstPopupHistory.GetRenderer());
+ hHistoryWindow = NULL;
+
+ break;
+ }
+
+ case WM_CLOSE:
+ {
+ DestroyWindow(hWnd);
+
+ break;
+ }
+
+ case WM_WINDOWPOSCHANGING:
+ {
+ HDWP hdWnds = BeginDeferWindowPos(4);
+ RECT rParent;
+ WINDOWPOS *wndPos = (WINDOWPOS *) lParam;
+ GetWindowRect(hWnd, &rParent);
+
+ if (wndPos->cx < MIN_HISTORY_WIDTH)
+ {
+ wndPos->cx = MIN_HISTORY_WIDTH;
+ }
+ if (wndPos->cy < MIN_HISTORY_HEIGHT)
+ {
+ wndPos->cy = MIN_HISTORY_HEIGHT;
+ }
+ AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_CLOSE), &rParent, wndPos, ANCHOR_RIGHT | ANCHOR_BOTTOM);
+ AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_HISTORY_FILTER), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM);
+ AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_HISTORY_FILTER_CASESENSITIVE), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_BOTTOM);
+ AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_LST_HISTORY), &rParent, wndPos, ANCHOR_ALL);
+
+ EndDeferWindowPos(hdWnds);
+ MoveCustomControl(hWnd, lstPopupHistory.GetRenderer()); //move the custom control too, if any
+
+ break;
+ }
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_CLOSE:
+ {
+ SendMessage(hWnd, WM_CLOSE, 0, 0);
+
+ break;
+ }
+
+ case IDC_HISTORY_FILTER_CASESENSITIVE:
+ {
+ if (HIWORD(wParam) == BN_CLICKED)
+ {
+ RefreshPopupHistory(hWnd, lstPopupHistory.GetRenderer());
+ }
+ }
+
+ case IDC_HISTORY_FILTER:
+ {
+ if (HIWORD(wParam) == EN_CHANGE)
+ {
+ if (!bInitializing)
+ {
+ RefreshPopupHistory(hWnd, lstPopupHistory.GetRenderer());
+ }
+ }
+
+ break;
+ }
+
+ }
+
+ break;
+ }
+
+ case WM_NOTIFY:
+ {
+ switch(((LPNMHDR)lParam)->idFrom)
+ {
+ case IDC_LST_HISTORY:
+ {
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case LVN_COLUMNCLICK:
+ {
+ LPNMLISTVIEW lv = (LPNMLISTVIEW) lParam;
+ int column = lv->iSubItem;
+ SortParams params = {0};
+ params.hList = GetDlgItem(hWnd, IDC_LST_HISTORY);
+ params.column = column;
+
+ ListView_SortItemsEx(params.hList, PopupsCompare, (LPARAM) ¶ms);
+ lastColumn = (params.column == lastColumn) ? -1 : params.column;
+
+ break;
+ }
+ }
+
+ break;
+ }
+ }
+
+ break;
+ }
+ }
+
+ return 0;
+}
diff --git a/yapp/popups2.cpp b/yapp/popups2.cpp index 7e5ead7..47b737b 100644 --- a/yapp/popups2.cpp +++ b/yapp/popups2.cpp @@ -10,6 +10,8 @@ #include "notify.h"
#include "str_utils.h"
+#include "popup_history.h" //to be able to update the renderer
+
HMODULE hInst = 0;
HANDLE mainThread = 0;
@@ -103,6 +105,11 @@ HANDLE hEventReloadFont = 0; int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
MNotifyGetLink();
+ if (ServiceExists(MS_HPP_EG_WINDOW))
+ {
+ lstPopupHistory.SetRenderer(RENDER_HISTORYPP);
+ }
+
if(ServiceExists(MS_UPDATE_REGISTER)) {
// register with updater
Update update = {0};
diff --git a/yapp/resource.h b/yapp/resource.h index 2ba26c1..08891ea 100644 --- a/yapp/resource.h +++ b/yapp/resource.h @@ -1,11 +1,17 @@ //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by popups2.rc
+// Used by resource.rc
//
+#define __MAJOR_VERSION 0
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
+#define __MINOR_VERSION 2
#define IDD_OPT1 101
#define IDD_DIALOG1 102
#define IDD_OPT_NOTIFY 103
#define IDD_LST_HISTORY 104
+#define IDI_ICON1 105
+#define IDI_POPUP_HISTORY 105
#define IDC_RAD_NOTIMEOUT 1001
#define IDC_RAD_TIMEOUT 1002
#define IDC_ED_TIMEOUT 1003
@@ -55,14 +61,16 @@ #define IDC_CLOSE 1041
#define IDC_LIST3 1042
#define IDC_LST_HISTORY 1043
+#define IDC_HISTORY_FILTER 1044
+#define IDC_HISTORY_FILTER_CASESENSITIVE 1046
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 105
+#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1044
+#define _APS_NEXT_CONTROL_VALUE 1047
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/yapp/resource.rc b/yapp/resource.rc index f39a424..42a15c2 100644 --- a/yapp/resource.rc +++ b/yapp/resource.rc @@ -1,6 +1,228 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
-// this makes our dependencies work better
-#include "version.h"
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// 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
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_POPUP_HISTORY ICON "PPh2.ico"
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Australia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_LST_HISTORY DIALOGEX 0, 0, 466, 303
+STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+CAPTION "Popup history"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ PUSHBUTTON "Close",IDC_CLOSE,413,285,50,14
+ CONTROL "",IDC_LST_HISTORY,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,4,3,459,278
+ EDITTEXT IDC_HISTORY_FILTER,4,285,176,14,ES_AUTOHSCROLL
+ CONTROL "Case sensitive",IDC_HISTORY_FILTER_CASESENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,185,287,222,10
+END
+
+IDD_OPT1 DIALOGEX 0, 0, 297, 218
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Default Timeout",IDC_STATIC,4,7,153,36
+ CONTROL "Never timeout",IDC_RAD_NOTIMEOUT,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT | WS_GROUP,10,16,77,10,WS_EX_RIGHT
+ CONTROL "Set timeout:",IDC_RAD_TIMEOUT,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,10,28,77,10,WS_EX_RIGHT
+ EDITTEXT IDC_ED_TIMEOUT,93,26,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",IDC_SPIN_TIMEOUT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,131,26,12,14
+ EDITTEXT IDC_ED_WIDTH,238,84,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",IDC_SPIN_WIDTH,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,84,12,14
+ EDITTEXT IDC_ED_MAXHEIGHT,238,102,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",IDC_SPIN_MAXHEIGHT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,102,12,14
+ RTEXT "Width:",IDC_STATIC,174,87,60,8,0,WS_EX_RIGHT
+ RTEXT "Maximum height:",IDC_STATIC,174,104,60,8,0,WS_EX_RIGHT
+ GROUPBOX "Options",IDC_STATIC,4,116,153,94
+ EDITTEXT IDC_ED_TRANS,97,183,33,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",IDC_SPIN_TRANS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,126,183,13,12
+ RTEXT "Opacity(%):",IDC_STATIC,11,186,84,8,0,WS_EX_RIGHT
+ CONTROL "Border",IDC_CHK_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,127,121,10
+ CONTROL "Round corners (window)",IDC_CHK_ROUNDCORNERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,138,121,10
+ PUSHBUTTON "Preview",IDC_BTN_PREVIEW,161,194,130,17
+ CONTROL "Animate",IDC_CHK_ANIMATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,160,121,10
+ CONTROL "Transparent background",IDC_CHK_TRANSBG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,199,121,10
+ GROUPBOX "Layout",IDC_STATIC,161,7,129,184
+ RTEXT "Avatar size:",IDC_STATIC,174,122,60,8,0,WS_EX_RIGHT
+ EDITTEXT IDC_ED_AVSIZE,238,120,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",IDC_SPIN_AVSIZE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,120,12,14
+ GROUPBOX "Disable when",IDC_STATIC,4,44,153,70
+ CONTROL "",IDC_LST_STATUS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOLABELWRAP | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,54,148,56
+ COMBOBOX IDC_CMB_PLACEMENT,165,19,120,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_CMB_ICON,165,36,120,69,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_CMB_AV,165,53,120,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Global hover",IDC_CHK_GLOBALHOVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,171,121,10
+ COMBOBOX IDC_CMB_TIME,165,69,120,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_ED_SBWIDTH,238,138,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",IDC_SPIN_SBWIDTH,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,138,11,14
+ RTEXT "Sidebar width:",IDC_STATIC,174,141,60,8
+ EDITTEXT IDC_ED_INDENT,238,156,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",IDC_SPIN_INDENT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,269,156,12,14
+ RTEXT "Text indent:",IDC_STATIC,174,160,60,8
+ EDITTEXT IDC_ED_PADDING,238,173,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",IDC_SPIN_PADDING,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,173,12,14
+ RTEXT "Padding:",IDC_STATIC,174,176,60,8
+ CONTROL "Round corners (avatar)",IDC_CHK_ROUNDCORNERSAV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,149,121,10
+END
+
+IDD_OPT_NOTIFY DIALOGEX 0, 0, 187, 91
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_LST_HISTORY, DIALOG
+ BEGIN
+ VERTGUIDE, 4
+ VERTGUIDE, 463
+ HORZGUIDE, 3
+ HORZGUIDE, 281
+ HORZGUIDE, 297
+ HORZGUIDE, 299
+ END
+
+ IDD_OPT1, DIALOG
+ BEGIN
+ LEFTMARGIN, 4
+ RIGHTMARGIN, 290
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 211
+ END
+
+ IDD_OPT_NOTIFY, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 180
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 84
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,2,0,1
+ PRODUCTVERSION 0,2,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "Author", "Scott Ellis"
+ VALUE "FileDescription", "Yet Another Popup Plugin - provides popup notification window services (unicode and ansi) to other plugins"
+ VALUE "FileVersion", "__FILEVERSION_STRING_DOTS"
+ VALUE "InternalName", "YAPP"
+ VALUE "LegalCopyright", "© 2005,2006 Scott Ellis"
+ VALUE "OriginalFilename", "yapp.dll"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
+
+#endif // English (Australia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
-#include "popups2.rc"
-#include "version.rc"
diff --git a/yapp/services.cpp b/yapp/services.cpp index 0b99f20..ff9bb9f 100644 --- a/yapp/services.cpp +++ b/yapp/services.cpp @@ -342,9 +342,12 @@ void InitServices() { menu.position = 500010000; menu.pszPopupName = Translate("PopUps"); + hiPopupHistory = LoadIcon(hInst, MAKEINTRESOURCE(IDI_POPUP_HISTORY)); + menu.hIcon = hiPopupHistory; menu.pszService= MS_POPUP_SHOWHISTORY; menu.pszName = Translate("Popup History"); hMenuShowHistory = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&menu); + menu.hIcon = 0; menu.pszService= "PopUp/ToggleEnabled"; menu.pszName = (DBGetContactSettingByte(0, MODULE, "Enabled", 1) == 1 ? Translate("Disable Popups") : Translate("Enable Popups")); diff --git a/yapp/version.h b/yapp/version.h index c3569a6..0cd7298 100644 --- a/yapp/version.h +++ b/yapp/version.h @@ -3,21 +3,21 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __RELEASE_NUM 1
+#define __BUILD_NUM 1
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
#define __STRINGIFY(x) #x
#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS)
-#define __DESC "Yet Another Popup Plugin - provides popup notification window services (unicode and ansi) to other plugins"
+#define __DESC "Provides popup notification window services (unicode and ansi) to other plugins"
#define __AUTHOR "Scott Ellis"
#define __AUTHOREMAIL "mail@scottellis.com.au"
#define __COPYRIGHT "© 2005,2006 Scott Ellis"
#define __AUTHORWEB "http://www.scottellis.com.au"
-#define __PLUGIN_NAME "YAPP"
+#define __PLUGIN_NAME "Yet Abother Popup Plugin"
#define __FILENAME "yapp.dll"
#endif //__VERSION_H_INCLUDED
|