summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-06 18:32:33 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-06 18:32:33 +0000
commitdc7168f28261e403569eba78cd9600a79e2f63c7 (patch)
tree82aedb915f0db577fcdfb562c78c8c9aa55c566a /plugins
parenta3efd513ac5cc0d55fe66492091d51ceddb34d14 (diff)
massive update of everything in Alarms
git-svn-id: http://svn.miranda-ng.org/main/trunk@2219 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Alarms/src/alarm_win.cpp70
-rw-r--r--plugins/Alarms/src/alarmlist.cpp94
-rw-r--r--plugins/Alarms/src/alarms.cpp100
-rw-r--r--plugins/Alarms/src/frame.cpp720
-rw-r--r--plugins/Alarms/src/options.cpp52
5 files changed, 495 insertions, 541 deletions
diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp
index 751ff21243..af93717105 100644
--- a/plugins/Alarms/src/alarm_win.cpp
+++ b/plugins/Alarms/src/alarm_win.cpp
@@ -28,11 +28,13 @@ typedef struct WindowData_tag {
int win_num;
} WindowData;
-void SetAlarmWinOptions() {
+void SetAlarmWinOptions()
+{
WindowList_Broadcast(hAlarmWindowList, WMU_SETOPT, IDC_SNOOZE, 0);
}
-bool TransparencyEnabled() {
+bool TransparencyEnabled()
+{
return MySetLayeredWindowAttributes != 0;
}
@@ -125,7 +127,8 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
h=(h<v)?h:v;
hRgn1=CreateRoundRectRgn(0,0,(r.right-r.left+1),(r.bottom-r.top+1),h,h);
SetWindowRgn(hwndDlg,hRgn1,1);
- } else {
+ }
+ else {
HRGN hRgn1;
RECT r;
int v,h;
@@ -175,28 +178,26 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
case WMU_FAKEALARM:
{
SetWindowText(hwndDlg, TranslateT("Example Alarm"));
- HWND hw = GetDlgItem(hwndDlg, IDC_TITLE);
- SetWindowText(hw, TranslateT("Example Alarm"));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_TITLE), TranslateT("Example Alarm"));
SetDlgItemText(hwndDlg, IDC_ED_DESC, TranslateT("Some example text. Example, example, example."));
}
return TRUE;
case WM_TIMER:
- {
- if (wParam == ID_TIMER_SOUND) {
- WindowData *dw = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (dw) {
- ALARM *data = dw->alarm;
- if (data && data->action & AAF_SOUND) {
- if (data->sound_num <= 3) {
- char buff[128];
- sprintf(buff, "Triggered%d", data->sound_num);
- SkinPlaySound(buff);
- } else if (data->sound_num == 4) {
- if (data->szTitle != NULL && data->szTitle[0] != '\0') {
- if (ServiceExists("Speak/Say")) {
- CallService("Speak/Say", 0, (LPARAM)data->szTitle);
- }
+ if (wParam == ID_TIMER_SOUND) {
+ WindowData *dw = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (dw) {
+ ALARM *data = dw->alarm;
+ if (data && data->action & AAF_SOUND) {
+ if (data->sound_num <= 3) {
+ char buff[128];
+ sprintf(buff, "Triggered%d", data->sound_num);
+ SkinPlaySound(buff);
+ }
+ else if (data->sound_num == 4) {
+ if (data->szTitle != NULL && data->szTitle[0] != '\0') {
+ if (ServiceExists("Speak/Say")) {
+ CallService("Speak/Say", 0, (LPARAM)data->szTitle);
}
}
}
@@ -204,11 +205,9 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
}
}
return TRUE;
+
case WM_MOVE:
- {
- //WindowData *wd = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "Notify");
- }
+ Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "Notify");
break;
case WMU_ADDSNOOZER:
@@ -243,9 +242,9 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
append_to_list(data);
}
}
-
}
return TRUE;
+
case WM_COMMAND:
if ( HIWORD( wParam ) == BN_CLICKED ) {
switch( LOWORD( wParam )) {
@@ -331,9 +330,9 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ClientToScreen(hwndDlg, &newp);
WindowData *window_data = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (!window_data->moving) {
+ if (!window_data->moving)
window_data->moving = true;
- } else {
+ else {
RECT r;
GetWindowRect(hwndDlg, &r);
@@ -341,7 +340,8 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
}
window_data->p.x = newp.x;
window_data->p.y = newp.y;
- } else {
+ }
+ else {
ReleaseCapture();
WindowData *window_data = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
window_data->moving = false;
@@ -352,7 +352,8 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
return FALSE;
}
-int ReloadFonts(WPARAM wParam, LPARAM lParam) {
+int ReloadFonts(WPARAM wParam, LPARAM lParam)
+{
LOGFONT log_font;
title_font_colour = CallService(MS_FONT_GETT, (WPARAM)&title_font_id, (LPARAM)&log_font);
DeleteObject(hTitleFont);
@@ -410,20 +411,19 @@ int AlarmWinModulesLoaded(WPARAM wParam, LPARAM lParam)
return 0;
}
-void InitAlarmWin() {
+void InitAlarmWin()
+{
hUserDll = LoadLibrary(_T("user32.dll"));
- if (hUserDll) {
+ if (hUserDll)
MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes");
- //MyAnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow");
- }
hAlarmWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
HookEvent(ME_SYSTEM_MODULESLOADED, AlarmWinModulesLoaded);
}
-void DeinitAlarmWin() {
-
+void DeinitAlarmWin()
+{
WindowList_Broadcast(hAlarmWindowList, WM_COMMAND, IDC_SNOOZE, 0);
FreeLibrary(hUserDll);
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp
index ac2ec84149..4a65c58406 100644
--- a/plugins/Alarms/src/alarmlist.cpp
+++ b/plugins/Alarms/src/alarmlist.cpp
@@ -178,7 +178,7 @@ bool UpdateAlarm(SYSTEMTIME &time, Occurrence occ) {
}
void LoadAlarms() {
- int num_alarms = DBGetContactSettingWord(0, MODULE, "Count", 0);
+ int num_alarms = db_get_w(0, MODULE, "Count", 0);
char buff[256];
DBVARIANT dbv;
ALARM alarm;
@@ -192,40 +192,38 @@ void LoadAlarms() {
memset(&alarm, 0, sizeof(ALARM));
sprintf(buff, "Title%d", i);
- if (!DBGetContactSetting(0, MODULE, buff, &dbv)) {
- if (dbv.ptszVal && _tcslen(dbv.ptszVal))
- alarm.szTitle = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ if (!DBGetContactSettingTString(0, MODULE, buff, &dbv)) {
+ alarm.szTitle = mir_tstrdup(dbv.ptszVal);
+ db_free(&dbv);
}
sprintf(buff, "Desc%d", i);
- if (!DBGetContactSetting(0, MODULE, buff, &dbv)) {
- if (dbv.ptszVal && _tcslen(dbv.ptszVal))
- alarm.szDesc = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ if (!DBGetContactSettingTString(0, MODULE, buff, &dbv)) {
+ alarm.szDesc = mir_tstrdup(dbv.ptszVal);
+ db_free(&dbv);
}
sprintf(buff, "Occ%d", i);
- alarm.occurrence = (Occurrence)DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.occurrence = (Occurrence)db_get_w(0, MODULE, buff, 0);
sprintf(buff, "STHour%d", i);
- alarm.time.wHour = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wHour = db_get_w(0, MODULE, buff, 0);
sprintf(buff, "STMinute%d", i);
- alarm.time.wMinute = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wMinute = db_get_w(0, MODULE, buff, 0);
sprintf(buff, "STSecond%d", i);
- alarm.time.wSecond = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wSecond = db_get_w(0, MODULE, buff, 0);
switch(alarm.occurrence) {
case OC_ONCE:
sprintf(buff, "STYear%d", i);
- alarm.time.wYear = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wYear = db_get_w(0, MODULE, buff, 0);
sprintf(buff, "STMonth%d", i);
- alarm.time.wMonth = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wMonth = db_get_w(0, MODULE, buff, 0);
sprintf(buff, "STDay%d", i);
- alarm.time.wDay = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wDay = db_get_w(0, MODULE, buff, 0);
break;
case OC_WEEKLY:
sprintf(buff, "STDayOfWeek%d", i);
- alarm.time.wDayOfWeek = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wDayOfWeek = db_get_w(0, MODULE, buff, 0);
break;
case OC_WEEKDAYS:
break;
@@ -233,54 +231,52 @@ void LoadAlarms() {
break;
case OC_MONTHLY:
sprintf(buff, "STDay%d", i);
- alarm.time.wDay = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wDay = db_get_w(0, MODULE, buff, 0);
break;
case OC_YEARLY:
sprintf(buff, "STMonth%d", i);
- alarm.time.wMonth = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wMonth = db_get_w(0, MODULE, buff, 0);
sprintf(buff, "STDay%d", i);
- alarm.time.wDay = DBGetContactSettingWord(0, MODULE, buff, 0);
+ alarm.time.wDay = db_get_w(0, MODULE, buff, 0);
break;
}
sprintf(buff, "TriggerID%d", i);
- alarm.trigger_id = DBGetContactSettingDword(0, MODULE, buff, 0);
+ alarm.trigger_id = db_get_dw(0, MODULE, buff, 0);
if (UpdateAlarm(alarm.time, alarm.occurrence)) {
sprintf(buff, "ActionFlags%d", i);
- alarm.action = (unsigned short)DBGetContactSettingDword(0, MODULE, buff, AAF_POPUP | AAF_SOUND);
+ alarm.action = (unsigned short)db_get_dw(0, MODULE, buff, AAF_POPUP | AAF_SOUND);
if (alarm.action & AAF_COMMAND) {
sprintf(buff, "ActionCommand%d", i);
- if (!DBGetContactSetting(0, MODULE, buff, &dbv)) {
- if (dbv.ptszVal && _tcslen(dbv.ptszVal))
- alarm.szCommand = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ if (!DBGetContactSettingTString(0, MODULE, buff, &dbv)) {
+ alarm.szCommand = mir_tstrdup(dbv.ptszVal);
+ db_free(&dbv);
sprintf(buff, "ActionParams%d", i);
- if (!DBGetContactSetting(0, MODULE, buff, &dbv)) {
- if (dbv.ptszVal && _tcslen(dbv.ptszVal))
- alarm.szCommandParams = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ if (!DBGetContactSettingTString(0, MODULE, buff, &dbv)) {
+ alarm.szCommandParams = mir_tstrdup(dbv.ptszVal);
+ db_free(&dbv);
}
}
}
sprintf(buff, "SoundNum%d", i);
- alarm.sound_num = (int)DBGetContactSettingByte(0, MODULE, buff, 1);
+ alarm.sound_num = (int)db_get_b(0, MODULE, buff, 1);
sprintf(buff, "Snoozer%d", i);
- alarm.snoozer = DBGetContactSettingByte(0, MODULE, buff, 0) == 1;
+ alarm.snoozer = db_get_b(0, MODULE, buff, 0) == 1;
sprintf(buff, "Hidden%d", i);
- alarm.flags |= (DBGetContactSettingByte(0, MODULE, buff, 0) == 1 ? ALF_HIDDEN : 0);
+ alarm.flags |= (db_get_b(0, MODULE, buff, 0) == 1 ? ALF_HIDDEN : 0);
sprintf(buff, "Suspended%d", i);
- alarm.flags |= (DBGetContactSettingByte(0, MODULE, buff, 0) == 1 ? ALF_SUSPENDED : 0);
+ alarm.flags |= (db_get_b(0, MODULE, buff, 0) == 1 ? ALF_SUSPENDED : 0);
sprintf(buff, "NoStartup%d", i);
- alarm.flags |= (DBGetContactSettingByte(0, MODULE, buff, 0) == 1 ? ALF_NOSTARTUP : 0);
+ alarm.flags |= (db_get_b(0, MODULE, buff, 0) == 1 ? ALF_NOSTARTUP : 0);
sprintf(buff, "Flags%d", i);
- alarm.flags = DBGetContactSettingDword(0, MODULE, buff, alarm.flags);
+ alarm.flags = db_get_dw(0, MODULE, buff, alarm.flags);
alarm.id = next_alarm_id++;
alarms.push_back(&alarm);
@@ -308,9 +304,9 @@ void SaveAlarms() {
ALARM *i;
for(alarms.reset(); i = alarms.current(); alarms.next(), index++) {
sprintf(buff, "Title%d", index);
- DBWriteContactSettingTString(0, MODULE, buff, i->szTitle);
+ db_set_ts(0, MODULE, buff, i->szTitle);
sprintf(buff, "Desc%d", index);
- DBWriteContactSettingTString(0, MODULE, buff, i->szDesc);
+ db_set_ts(0, MODULE, buff, i->szDesc);
sprintf(buff, "Occ%d", index);
DBWriteContactSettingWord(0, MODULE, buff, i->occurrence);
@@ -347,19 +343,19 @@ void SaveAlarms() {
if (i->action & AAF_COMMAND) {
if (_tcslen(i->szCommand)) {
sprintf(buff, "ActionCommand%d", index);
- DBWriteContactSettingTString(0, MODULE, buff, i->szCommand);
+ db_set_ts(0, MODULE, buff, i->szCommand);
if (_tcslen(i->szCommandParams)) {
sprintf(buff, "ActionParams%d", index);
- DBWriteContactSettingTString(0, MODULE, buff, i->szCommandParams);
+ db_set_ts(0, MODULE, buff, i->szCommandParams);
}
}
}
sprintf(buff, "SoundNum%d", index);
- DBWriteContactSettingByte(0, MODULE, buff, i->sound_num);
+ db_set_b(0, MODULE, buff, i->sound_num);
sprintf(buff, "Snoozer%d", index);
- DBWriteContactSettingByte(0, MODULE, buff, i->snoozer ? 1 : 0);
+ db_set_b(0, MODULE, buff, i->snoozer ? 1 : 0);
sprintf(buff, "Flags%d", index);
DBWriteContactSettingDword(0, MODULE, buff, i->flags);
@@ -376,9 +372,9 @@ void copy_list(AlarmList &copy) {
copy.clear();
ALARM *i;
EnterCriticalSection(&alarm_cs);
- for(alarms.reset(); i = alarms.current(); alarms.next()) {
+ for(alarms.reset(); i = alarms.current(); alarms.next())
copy.push_back(i);
- }
+
LeaveCriticalSection(&alarm_cs);
}
@@ -386,10 +382,10 @@ void copy_list(AlarmList &copy, SYSTEMTIME &start, SYSTEMTIME &end) {
copy.clear();
ALARM *i;
EnterCriticalSection(&alarm_cs);
- for(alarms.reset(); i = alarms.current(); alarms.next()) {
+ for(alarms.reset(); i = alarms.current(); alarms.next())
if (IsBetween(i->time, start, end))
copy.push_back(i);
- }
+
LeaveCriticalSection(&alarm_cs);
}
@@ -397,9 +393,9 @@ void set_list(AlarmList &copy) {
EnterCriticalSection(&alarm_cs);
alarms.clear();
ALARM *i;
- for(copy.reset(); i = copy.current(); copy.next()) {
+ for(copy.reset(); i = copy.current(); copy.next())
alarms.push_back(i);
- }
+
LeaveCriticalSection(&alarm_cs);
SaveAlarms();
@@ -741,7 +737,7 @@ void InitList()
if (!CallService(MS_DB_CONTACT_GETSETTING, 0, (LPARAM)&dbcgs)) {
memcpy(&last_check, dbv.pbVal, sizeof(SYSTEMTIME));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
GetLocalTime(&last_check);
}
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp
index 78250aaad1..cc3164809c 100644
--- a/plugins/Alarms/src/alarms.cpp
+++ b/plugins/Alarms/src/alarms.cpp
@@ -59,34 +59,26 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_ALARMS,
static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message) {
- case WM_COMMAND:
- if (HIWORD(wParam) == STN_CLICKED) { //It was a click on the Popup.
- PUDeletePopUp(hWnd);
- return TRUE;
- }
- break;
- case UM_FREEPLUGINDATA: {
- //MY_PLUGIN_DATA * mpd = NULL;
- //mpd = (MY_PLUGIN_DATA*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,(LPARAM)mpd);
- //if (mdp > 0) free(mpd);
- return TRUE; //TRUE or FALSE is the same, it gets ignored.
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) { //It was a click on the Popup.
+ PUDeletePopUp(hWnd);
+ return TRUE;
}
- default:
- break;
+ break;
+ case UM_FREEPLUGINDATA:
+ return TRUE;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
-void ShowPopup(HANDLE hContact, const TCHAR *msg) {
+void ShowPopup(HANDLE hContact, const TCHAR *msg)
+{
if (ServiceExists(MS_POPUP_ADDPOPUP)) {
- POPUPDATAT ppd;
+ TCHAR *lpzContactName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
- ZeroMemory(&ppd, sizeof(ppd)); //This is always a good thing to do.
+ POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked.
ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
-
- TCHAR *lpzContactName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
-
lstrcpy(ppd.lptzContactName, lpzContactName);
lstrcpy(ppd.lptzText, msg);
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -100,7 +92,8 @@ void ShowPopup(HANDLE hContact, const TCHAR *msg) {
}
}
-static int PluginSendMessage(WPARAM wParam,LPARAM lParam) {
+static int PluginSendMessage(WPARAM wParam,LPARAM lParam)
+{
CallContactService((HANDLE)wParam,PSS_MESSAGE,0,lParam);
return 0;
}
@@ -127,9 +120,8 @@ static int PluginMessageReceived(WPARAM wParam,LPARAM lParam)
hWnd = FindWindow(0, _T("Windows Media Player"));
PostMessage(hWnd, WM_COMMAND, WMP_NEXT, 0);
- } else {
- mir_sntprintf(buff, SIZEOF(buff), _T("Unknown command issued: \"%s\""), msg);
}
+ else mir_sntprintf(buff, SIZEOF(buff), _T("Unknown command issued: \"%s\""), msg);
/*
ppre->szMessage = (char *)Translate(buff);
@@ -148,36 +140,36 @@ static int PluginMessageReceived(WPARAM wParam,LPARAM lParam)
HBITMAP LoadBmpFromIcon(int IdRes)
{
HBITMAP hBmp, hoBmp;
- HDC hdc, hdcMem;
- HBRUSH hBkgBrush;
+ HDC hdc, hdcMem;
+ HBRUSH hBkgBrush;
HICON hIcon;
hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IdRes));
- RECT rc;
- BITMAPINFOHEADER bih = {0};
- int widthBytes;
-
- hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
- bih.biSize = sizeof(bih);
- bih.biBitCount = 24;
- bih.biPlanes = 1;
- bih.biCompression = BI_RGB;
- bih.biHeight = 16;
- bih.biWidth = 20;
- widthBytes = ((bih.biWidth*bih.biBitCount + 31) >> 5) * 4;
- rc.top = rc.left = 0;
- rc.right = bih.biWidth;
- rc.bottom = bih.biHeight;
- hdc = GetDC(NULL);
- hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
- hdcMem = CreateCompatibleDC(hdc);
- hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
- FillRect(hdcMem, &rc, hBkgBrush);
- DrawIconEx(hdcMem, 2, 0, hIcon, 16, 16, 0, NULL, DI_NORMAL);
-
-
- SelectObject(hdcMem, hoBmp);
+ RECT rc;
+ BITMAPINFOHEADER bih = {0};
+ int widthBytes;
+
+ hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+ bih.biSize = sizeof(bih);
+ bih.biBitCount = 24;
+ bih.biPlanes = 1;
+ bih.biCompression = BI_RGB;
+ bih.biHeight = 16;
+ bih.biWidth = 20;
+ widthBytes = ((bih.biWidth*bih.biBitCount + 31) >> 5) * 4;
+ rc.top = rc.left = 0;
+ rc.right = bih.biWidth;
+ rc.bottom = bih.biHeight;
+ hdc = GetDC(NULL);
+ hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
+ hdcMem = CreateCompatibleDC(hdc);
+ hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
+ FillRect(hdcMem, &rc, hBkgBrush);
+ DrawIconEx(hdcMem, 2, 0, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+
+
+ SelectObject(hdcMem, hoBmp);
DeleteDC(hdcMem);
ReleaseDC(NULL, hdc);
DeleteObject(hBkgBrush);
@@ -207,18 +199,6 @@ static int MainInit(WPARAM wparam,LPARAM lparam)
// initialize icons
InitIcons();
- // Hotkey
- /*
- SKINHOTKEYDESCEX hk;
- hk.cbSize = sizeof(hk);
- hk.pszName = Translate("Set Alarm");
- hk.pszDescription = Translate("Set a new alarm");
- hk.pszSection = Translate("Alarms");
- hk.pszService = MODULE "/NewAlarm";
- hk.DefHotKey = (WORD)'A' + HOTKEYF_ALT * 256;
- CallService(MS_SKIN_ADDHOTKEY, 0, (LPARAM)&hk);
- */
-
// TopToolbar support
HookEvent(ME_TTB_MODULELOADED, InitTopToolbarButton);
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp
index 15fa91accc..cdcb4b755a 100644
--- a/plugins/Alarms/src/frame.cpp
+++ b/plugins/Alarms/src/frame.cpp
@@ -13,6 +13,8 @@ HFONT hFont = 0;
COLORREF fontColour, framebk;
HBRUSH bk_brush = 0;
+#define CLUIFrameTitleBarClassName "CLUIFrameTitleBar"
+
AlarmList alarm_list;
CRITICAL_SECTION list_cs;
@@ -27,7 +29,8 @@ HANDLE hMenuShowReminders = 0;
void FixMainMenu();
-int height_client_to_frame(int client_height, LONG style, LONG ex_style) {
+int height_client_to_frame(int client_height, LONG style, LONG ex_style)
+{
RECT tr;
tr.top = tr.right = tr.left = 0;
tr.bottom = client_height;
@@ -36,52 +39,56 @@ int height_client_to_frame(int client_height, LONG style, LONG ex_style) {
return 0;
}
-LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
+LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
switch(msg) {
- case WM_CREATE:
- return TRUE;
- case WM_SHOWWINDOW:
- if ((BOOL)wParam) {
- DBWriteContactSettingByte(0, MODULE, "ReminderFrameVisible", 1);
- Utils_RestoreWindowPosition(hwnd, 0, MODULE, "reminders_window");
- PostMessage(hwnd, WM_SIZE, 0, 0);
- } else {
- DBWriteContactSettingByte(0, MODULE, "ReminderFrameVisible", 0);
- Utils_SaveWindowPosition(hwnd, 0, MODULE, "reminders_window");
- }
- break;
- case WM_SIZE:
- {
- HWND child = (HWND)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- RECT r;
- GetClientRect(hwnd, &r);
-
- SetWindowPos(child, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
- InvalidateRect(child, 0, TRUE);
- InvalidateRect(hwnd, 0, TRUE);
- }
- break;
-
- case WM_CLOSE:
+ case WM_CREATE:
+ return TRUE;
+
+ case WM_SHOWWINDOW:
+ if (wParam) {
+ db_set_b(0, MODULE, "ReminderFrameVisible", 1);
+ Utils_RestoreWindowPosition(hwnd, 0, MODULE, "reminders_window");
+ PostMessage(hwnd, WM_SIZE, 0, 0);
+ } else {
+ db_set_b(0, MODULE, "ReminderFrameVisible", 0);
Utils_SaveWindowPosition(hwnd, 0, MODULE, "reminders_window");
- ShowWindow(hwnd, SW_HIDE);
- FixMainMenu();
- return TRUE;
+ }
+ break;
+ case WM_SIZE:
+ {
+ HWND child = (HWND)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ RECT r;
+ GetClientRect(hwnd, &r);
+
+ SetWindowPos(child, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ InvalidateRect(child, 0, TRUE);
+ InvalidateRect(hwnd, 0, TRUE);
+ }
+ break;
+
+ case WM_CLOSE:
+ Utils_SaveWindowPosition(hwnd, 0, MODULE, "reminders_window");
+ ShowWindow(hwnd, SW_HIDE);
+ FixMainMenu();
+ return TRUE;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}
-bool FrameIsFloating() {
+bool FrameIsFloating()
+{
if (frame_id == -1)
return true; // no frames, always floating
- return (CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLOATING, frame_id), 0) != 0);
+ return CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLOATING, frame_id), 0) != 0;
}
ALARM context_menu_alarm = {0};
-LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
+LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
MEASUREITEMSTRUCT *mis;
DRAWITEMSTRUCT *dis;
SIZE textSize;
@@ -89,360 +96,340 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
switch(msg) {
- case WM_CREATE:
- {
- hwnd_list = CreateWindow(_T("LISTBOX"), _T(""),
- (WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_STANDARD | LBS_NOTIFY | LBS_OWNERDRAWFIXED) & ~LBS_SORT
- & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst,0);
- }
- return FALSE;
- case WMU_INITIALIZE:
- PostMessage(hwnd, WMU_FILL_LIST, 0, 0);
- SetTimer(hwnd, ID_FRAME_UPDATE_TIMER, 5000, 0);
- SetTimer(hwnd, ID_FRAME_SHOWHIDE_TIMER, 200, 0);
- return TRUE;
+ case WM_CREATE:
+ hwnd_list = CreateWindow(_T("LISTBOX"), _T(""),
+ (WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_STANDARD | LBS_NOTIFY | LBS_OWNERDRAWFIXED) & ~LBS_SORT
+ & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst,0);
+ return FALSE;
- case WM_MEASUREITEM:
- mis = (MEASUREITEMSTRUCT *)lParam;
- mis->itemHeight = options.row_height;
- return TRUE;
+ case WMU_INITIALIZE:
+ PostMessage(hwnd, WMU_FILL_LIST, 0, 0);
+ SetTimer(hwnd, ID_FRAME_UPDATE_TIMER, 5000, 0);
+ SetTimer(hwnd, ID_FRAME_SHOWHIDE_TIMER, 200, 0);
+ return TRUE;
- case WM_DRAWITEM:
- dis = (DRAWITEMSTRUCT *)lParam;
- if (dis->itemID != (DWORD)-1) {
- ALARM alarm = {0};
- EnterCriticalSection(&list_cs);
- ALARM &list_alarm = alarm_list.at(dis->itemData);
- copy_alarm_data(&alarm, &list_alarm);
- LeaveCriticalSection(&list_cs);
+ case WM_MEASUREITEM:
+ mis = (MEASUREITEMSTRUCT *)lParam;
+ mis->itemHeight = options.row_height;
+ return TRUE;
- RECT r;
- GetClientRect(hwnd, &r);
+ case WM_DRAWITEM:
+ dis = (DRAWITEMSTRUCT *)lParam;
+ if (dis->itemID != (DWORD)-1) {
+ ALARM alarm = {0};
+ EnterCriticalSection(&list_cs);
+ ALARM &list_alarm = alarm_list.at(dis->itemData);
+ copy_alarm_data(&alarm, &list_alarm);
+ LeaveCriticalSection(&list_cs);
- int min = MinutesInFuture(alarm.time, alarm.occurrence);
+ RECT r;
+ GetClientRect(hwnd, &r);
- FillRect(dis->hDC, &dis->rcItem, bk_brush);
+ int min = MinutesInFuture(alarm.time, alarm.occurrence);
- dis->rcItem.left += options.indent;
+ FillRect(dis->hDC, &dis->rcItem, bk_brush);
- SetBkMode(dis->hDC, TRANSPARENT);
- SetTextColor(dis->hDC, fontColour);
+ dis->rcItem.left += options.indent;
- HICON hIcon = (min <= 5 ? hIconList2 : hIconList1);
- //DrawIconEx(dis->hDC,dis->rcItem.left,(dis->rcItem.top + dis->rcItem.bottom -GetSystemMetrics(SM_CYSMICON))>>1,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
- DrawIconEx(dis->hDC,dis->rcItem.left,(dis->rcItem.top + dis->rcItem.bottom - 16)>>1,hIcon,0, 0, 0, NULL, DI_NORMAL);
+ SetBkMode(dis->hDC, TRANSPARENT);
+ SetTextColor(dis->hDC, fontColour);
- GetTextExtentPoint32(dis->hDC,alarm.szTitle,lstrlen(alarm.szTitle),&textSize);
+ HICON hIcon = (min <= 5 ? hIconList2 : hIconList1);
+ DrawIconEx(dis->hDC,dis->rcItem.left,(dis->rcItem.top + dis->rcItem.bottom - 16)>>1,hIcon,0, 0, 0, NULL, DI_NORMAL);
- TCHAR buff[100];
- if (min >= 60) {
- mir_sntprintf(buff, 100, TranslateT("%dh %dm"), min / 60, min % 60);
- } else {
- mir_sntprintf(buff, 100, TranslateT("%dm"), min);
- }
+ GetTextExtentPoint32(dis->hDC,alarm.szTitle,lstrlen(alarm.szTitle),&textSize);
- GetTextExtentPoint32(dis->hDC,buff,lstrlen(buff),&timeSize);
-
- if (textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
- // need elipsis
- TCHAR titlebuff[512];
- int len = lstrlen(alarm.szTitle);
- if (len > 511) len = 511;
- while(len > 0 && textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
- len--;
- _tcsncpy(titlebuff, alarm.szTitle, len);
- titlebuff[len] = 0;
- _tcscat(titlebuff, _T("..."));
- GetTextExtentPoint32(dis->hDC,titlebuff,lstrlen(titlebuff),&textSize);
- }
- TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,titlebuff,lstrlen(titlebuff));
- TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,lstrlen(buff));
- } else {
- TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,alarm.szTitle,lstrlen(alarm.szTitle));
- TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,lstrlen(buff));
+ TCHAR buff[100];
+ if (min >= 60)
+ mir_sntprintf(buff, 100, TranslateT("%dh %dm"), min / 60, min % 60);
+ else
+ mir_sntprintf(buff, 100, TranslateT("%dm"), min);
+
+ GetTextExtentPoint32(dis->hDC,buff,lstrlen(buff),&timeSize);
+
+ if (textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
+ // need elipsis
+ TCHAR titlebuff[512];
+ int len = lstrlen(alarm.szTitle);
+ if (len > 511) len = 511;
+ while(len > 0 && textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
+ len--;
+ _tcsncpy(titlebuff, alarm.szTitle, len);
+ titlebuff[len] = 0;
+ _tcscat(titlebuff, _T("..."));
+ GetTextExtentPoint32(dis->hDC,titlebuff,lstrlen(titlebuff),&textSize);
}
+ TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,titlebuff,lstrlen(titlebuff));
+ TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,lstrlen(buff));
+ }
+ else {
+ TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,alarm.szTitle,lstrlen(alarm.szTitle));
+ TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,lstrlen(buff));
+ }
- SetBkMode(dis->hDC, OPAQUE);
+ SetBkMode(dis->hDC, OPAQUE);
- free_alarm_data(&alarm);
- } else {
- FillRect(dis->hDC, &dis->rcItem, bk_brush);
- }
- return TRUE;
+ free_alarm_data(&alarm);
+ }
+ else FillRect(dis->hDC, &dis->rcItem, bk_brush);
- case WM_CTLCOLORLISTBOX:
- break;
- case WM_ERASEBKGND:
- {
- HDC hdc = (HDC)wParam;
- RECT r;
- GetClientRect(hwnd, &r);
- FillRect(hdc, &r, bk_brush);
- }
- return TRUE;
+ return TRUE;
- case WM_PRINTCLIENT:
- {
- /*
- HDC hdc = (HDC)wParam;
- RECT r;
- GetClientRect(hwnd, &r);
- */
- }
- return TRUE;
+ case WM_CTLCOLORLISTBOX:
+ break;
- case WM_PAINT:
- {
- RECT r;
- if (GetUpdateRect(hwnd, &r, FALSE)) {
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(hwnd, &ps);
- SendMessage(hwnd, WM_PRINTCLIENT, (WPARAM)hdc, (LPARAM)(PRF_CLIENT | PRF_CHILDREN));
- EndPaint(hwnd, &ps);
- }
+ case WM_ERASEBKGND:
+ {
+ HDC hdc = (HDC)wParam;
+ RECT r;
+ GetClientRect(hwnd, &r);
+ FillRect(hdc, &r, bk_brush);
+ }
+ return TRUE;
+
+ case WM_PRINTCLIENT:
+ return TRUE;
+
+ case WM_PAINT:
+ {
+ RECT r;
+ if (GetUpdateRect(hwnd, &r, FALSE)) {
+ PAINTSTRUCT ps;
+ HDC hdc = BeginPaint(hwnd, &ps);
+ SendMessage(hwnd, WM_PRINTCLIENT, (WPARAM)hdc, (LPARAM)(PRF_CLIENT | PRF_CHILDREN));
+ EndPaint(hwnd, &ps);
}
- return TRUE;
+ }
+ return TRUE;
- case WM_SHOWWINDOW:
- if ((BOOL)wParam) PostMessage(hwnd, WMU_SIZE_LIST, 0, 0);
- break;
+ case WM_SHOWWINDOW:
+ if ((BOOL)wParam) PostMessage(hwnd, WMU_SIZE_LIST, 0, 0);
+ break;
- case WM_SIZE:
- if (IsWindowVisible(hwnd)) {
- SendMessage(hwnd, WMU_SIZE_LIST, 0, 0);
-
- if (frame_id != -1) {
- //CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)(FU_TBREDRAW | FU_FMREDRAW));
- CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)FU_TBREDRAW);
- }
- InvalidateRect(hwnd, 0, TRUE);
- }
- break;
+ case WM_SIZE:
+ if (IsWindowVisible(hwnd)) {
+ SendMessage(hwnd, WMU_SIZE_LIST, 0, 0);
- case WMU_SIZE_LIST:
- {
- if (SendMessage(hwnd_list, LB_GETITEMHEIGHT, 0, 0) != options.row_height)
- SendMessage(hwnd_list, LB_SETITEMHEIGHT, 0, options.row_height);
-
- int itemheight = SendMessage(hwnd_list, LB_GETITEMHEIGHT, 0, 0),
- count = SendMessage(hwnd_list, LB_GETCOUNT, 0, 0);
-
- if (options.auto_size_vert && IsWindowVisible(hwnd)) {
- if (FrameIsFloating()) {
-
-#define CLUIFrameTitleBarClassName "CLUIFrameTitleBar"
-
- int height = height_client_to_frame(itemheight * count, GetWindowLongPtr(GetParent(hwnd), GWL_STYLE), GetWindowLongPtr(GetParent(hwnd), GWL_EXSTYLE));
- HWND titleBarHwnd = FindWindowEx(GetParent(hwnd), 0, _T(CLUIFrameTitleBarClassName), 0);
- if (titleBarHwnd) {
- RECT tbr;
- GetWindowRect(titleBarHwnd, &tbr);
- height += (tbr.bottom - tbr.top);
- }
- RECT rp_window;
- GetWindowRect(GetParent(hwnd), &rp_window);
- SetWindowPos(GetParent(hwnd), 0, 0, 0, rp_window.right - rp_window.left, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
-
- /*
- RECT rp_client, rp_window, r_window;
- GetClientRect(GetParent(hwnd), &rp_client);
- GetWindowRect(GetParent(hwnd), &rp_window);
- GetWindowRect(hwnd, &r_window);
- int diff = (rp_window.bottom - rp_window.top) - (rp_client.bottom - rp_client.top);
- if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
- diff += rp_window.top - r_window.top;
- SetWindowPos(GetParent(hwnd), 0, 0, 0, rp_window.right - rp_window.left, count * itemheight + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
- */
- } else if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME) && frame_id != -1) {
- int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0);
- CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, frame_id), (LPARAM)(count * itemheight));
- CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)(FU_TBREDRAW | FU_FMREDRAW | FU_FMPOS));
+ if (frame_id != -1) {
+ //CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)(FU_TBREDRAW | FU_FMREDRAW));
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)FU_TBREDRAW);
+ }
+ InvalidateRect(hwnd, 0, TRUE);
+ }
+ break;
+
+ case WMU_SIZE_LIST:
+ {
+ if (SendMessage(hwnd_list, LB_GETITEMHEIGHT, 0, 0) != options.row_height)
+ SendMessage(hwnd_list, LB_SETITEMHEIGHT, 0, options.row_height);
+
+ int itemheight = SendMessage(hwnd_list, LB_GETITEMHEIGHT, 0, 0),
+ count = SendMessage(hwnd_list, LB_GETCOUNT, 0, 0);
+
+ if (options.auto_size_vert && IsWindowVisible(hwnd)) {
+ if (FrameIsFloating()) {
+ int height = height_client_to_frame(itemheight * count, GetWindowLongPtr(GetParent(hwnd), GWL_STYLE), GetWindowLongPtr(GetParent(hwnd), GWL_EXSTYLE));
+ HWND titleBarHwnd = FindWindowEx(GetParent(hwnd), 0, _T(CLUIFrameTitleBarClassName), 0);
+ if (titleBarHwnd) {
+ RECT tbr;
+ GetWindowRect(titleBarHwnd, &tbr);
+ height += (tbr.bottom - tbr.top);
}
+ RECT rp_window;
+ GetWindowRect(GetParent(hwnd), &rp_window);
+ SetWindowPos(GetParent(hwnd), 0, 0, 0, rp_window.right - rp_window.left, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+ }
+ else if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME) && frame_id != -1) {
+ int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0);
+ CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, frame_id), (LPARAM)(count * itemheight));
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)(FU_TBREDRAW | FU_FMREDRAW | FU_FMPOS));
}
+ }
- RECT r, r2;
- GetClientRect(hwnd, &r);
- GetClientRect(hwnd_list, &r2);
- int width, height, winheight;
+ RECT r, r2;
+ GetClientRect(hwnd, &r);
+ GetClientRect(hwnd_list, &r2);
+ int width, height, winheight;
- width = r.right - r.left;
- winheight = r.bottom - r.top;
+ width = r.right - r.left;
+ winheight = r.bottom - r.top;
- height = min(count * itemheight, winheight - (winheight % itemheight));
- if (r2.right - r2.left != width || (r.bottom - r.top > 0 && r2.bottom - r2.top != height)) {
- SetWindowPos(hwnd_list, 0, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
- InvalidateRect(hwnd_list, 0, FALSE);
- }
-
- if (options.auto_showhide) {
- if (ServiceExists(MS_CLIST_FRAMES_SHFRAME) && frame_id != -1) {
- if (IsWindowVisible(hwnd) && count == 0) {
- CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0);
- } else if (!IsWindowVisible(hwnd) && count > 0) {
- // we have reminders - show if not linked to clist or if clist is visible
- if ((!options.hide_with_clist && FrameIsFloating()) || IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))) {
- CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0);
- CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)(FU_FMREDRAW | FU_FMPOS));
- }
+ height = min(count * itemheight, winheight - (winheight % itemheight));
+ if (r2.right - r2.left != width || (r.bottom - r.top > 0 && r2.bottom - r2.top != height)) {
+ SetWindowPos(hwnd_list, 0, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+ InvalidateRect(hwnd_list, 0, FALSE);
+ }
+
+ if (options.auto_showhide) {
+ if (ServiceExists(MS_CLIST_FRAMES_SHFRAME) && frame_id != -1) {
+ if (IsWindowVisible(hwnd) && count == 0) {
+ CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0);
+ }
+ else if (!IsWindowVisible(hwnd) && count > 0) {
+ // we have reminders - show if not linked to clist or if clist is visible
+ if ((!options.hide_with_clist && FrameIsFloating()) || IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))) {
+ CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0);
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)(FU_FMREDRAW | FU_FMPOS));
}
- } else {
- if (IsWindowVisible(hwnd) && count == 0)
- SetReminderFrameVisible(false);
- else if (!IsWindowVisible(hwnd) && count > 0)
- // we have reminders - show if not linked to clist or if clist is visible
- if (!options.hide_with_clist || IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0)))
- SetReminderFrameVisible(true);
}
}
-
- }
- return TRUE;
- case WMU_FILL_LIST:
- {
- // calculate the period to display alarms for
- SYSTEMTIME t1, t2;
- GetLocalTime(&t1);
- TimeForMinutesInFuture(60 * options.reminder_period, &t2);
-
- int sel = SendMessage(hwnd_list, LB_GETCURSEL, 0, 0),
- top = SendMessage(hwnd_list, LB_GETTOPINDEX, 0, 0);
-
- SendMessage(hwnd_list, WM_SETREDRAW, (WPARAM)FALSE, 0);
-
- EnterCriticalSection(&list_cs);
- SendMessage(hwnd_list, LB_RESETCONTENT, 0, 0);
- copy_list(alarm_list, t1, t2);
- alarm_list.sort();
- int index = 0;
- ALARM *i;
- for(alarm_list.reset(); i = alarm_list.current(); alarm_list.next(), index++) {
- if (i->flags & (ALF_HIDDEN | ALF_SUSPENDED | ALF_NOREMINDER))
- continue;
- SendMessage(hwnd_list, LB_ADDSTRING, 0, (LPARAM)index);
+ else {
+ if (IsWindowVisible(hwnd) && count == 0)
+ SetReminderFrameVisible(false);
+ else if (!IsWindowVisible(hwnd) && count > 0)
+ // we have reminders - show if not linked to clist or if clist is visible
+ if (!options.hide_with_clist || IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0)))
+ SetReminderFrameVisible(true);
}
- LeaveCriticalSection(&list_cs);
+ }
+ }
+ return TRUE;
+
+ case WMU_FILL_LIST:
+ {
+ // calculate the period to display alarms for
+ SYSTEMTIME t1, t2;
+ GetLocalTime(&t1);
+ TimeForMinutesInFuture(60 * options.reminder_period, &t2);
+
+ int sel = SendMessage(hwnd_list, LB_GETCURSEL, 0, 0),
+ top = SendMessage(hwnd_list, LB_GETTOPINDEX, 0, 0);
+
+ SendMessage(hwnd_list, WM_SETREDRAW, (WPARAM)FALSE, 0);
+
+ EnterCriticalSection(&list_cs);
+ SendMessage(hwnd_list, LB_RESETCONTENT, 0, 0);
+ copy_list(alarm_list, t1, t2);
+ alarm_list.sort();
+ int index = 0;
+ ALARM *i;
+ for(alarm_list.reset(); i = alarm_list.current(); alarm_list.next(), index++) {
+ if (i->flags & (ALF_HIDDEN | ALF_SUSPENDED | ALF_NOREMINDER))
+ continue;
+ SendMessage(hwnd_list, LB_ADDSTRING, 0, (LPARAM)index);
+ }
+ LeaveCriticalSection(&list_cs);
- SendMessage(hwnd, WMU_SIZE_LIST, 0, 0);
- SendMessage(hwnd_list, WM_SETREDRAW, (WPARAM)TRUE, 0);
+ SendMessage(hwnd, WMU_SIZE_LIST, 0, 0);
+ SendMessage(hwnd_list, WM_SETREDRAW, (WPARAM)TRUE, 0);
- if (sel != LB_ERR && sel < index) SendMessage(hwnd_list, LB_SETCURSEL, (WPARAM)sel, 0);
- if (top != LB_ERR && top < index) SendMessage(hwnd_list, LB_SETTOPINDEX, (WPARAM)top, 0);
+ if (sel != LB_ERR && sel < index) SendMessage(hwnd_list, LB_SETCURSEL, (WPARAM)sel, 0);
+ if (top != LB_ERR && top < index) SendMessage(hwnd_list, LB_SETTOPINDEX, (WPARAM)top, 0);
+ }
+ return TRUE;
+
+ case WM_TIMER:
+ if (wParam == ID_FRAME_UPDATE_TIMER)
+ SendMessage(hwnd, WMU_FILL_LIST, 0, 0);
+ else if (wParam == ID_FRAME_SHOWHIDE_TIMER && options.hide_with_clist) { // link show/hide with clist
+ // hide if we're visible and clist isn't (possible only when floating if frames are present)
+ if (!IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0)) && IsWindowVisible(hwnd)) {
+ if (ServiceExists(MS_CLIST_FRAMES_SHFRAME))
+ CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0);
+ else
+ SetReminderFrameVisible(false);
}
- return TRUE;
-
- case WM_TIMER:
- if (wParam == ID_FRAME_UPDATE_TIMER)
- SendMessage(hwnd, WMU_FILL_LIST, 0, 0);
- else if (wParam == ID_FRAME_SHOWHIDE_TIMER && options.hide_with_clist) { // link show/hide with clist
- // hide if we're visible and clist isn't (possible only when floating if frames are present)
- if (!IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0)) && IsWindowVisible(hwnd)) {
+ // we're not visible but clist is - show depending on hide_with_clist and auto_showhide options
+ if (!IsWindowVisible(hwnd) && IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))) {
+ // if not auto show/hide, show (reminders or not) if we're not visible and the clist is
+ // otherwise, show only if there are reminders
+ int count = SendMessage(hwnd_list, LB_GETCOUNT, 0, 0);
+ if (!options.auto_showhide || count > 0) {
if (ServiceExists(MS_CLIST_FRAMES_SHFRAME))
CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0);
else
- SetReminderFrameVisible(false);
- }
- // we're not visible but clist is - show depending on hide_with_clist and auto_showhide options
- if (!IsWindowVisible(hwnd) && IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))) {
- // if not auto show/hide, show (reminders or not) if we're not visible and the clist is
- // otherwise, show only if there are reminders
- int count = SendMessage(hwnd_list, LB_GETCOUNT, 0, 0);
- if (!options.auto_showhide || count > 0) {
- if (ServiceExists(MS_CLIST_FRAMES_SHFRAME))
- CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0);
- else
- SetReminderFrameVisible(true);
- }
+ SetReminderFrameVisible(true);
}
}
- return TRUE;
+ }
+ return TRUE;
+
+ case WM_CONTEXTMENU:
+ {
+ POINT pt;
+ GetCursorPos(&pt);
+ ScreenToClient(hwnd_list, &pt);
+
+ EnterCriticalSection(&list_cs);
+ DWORD item = SendMessage(hwnd_list, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y));
+
+ HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)), submenu = GetSubMenu(menu, 0);
+ TranslateMenu(submenu);
+
+ if (HIWORD(item) == 0) {
+ int sel = LOWORD(item);
+ if (sel >= 0) {
+ // one-off alarms can't be suspended
+ int index = SendMessage(hwnd_list, LB_GETITEMDATA, (WPARAM)sel, 0);
+ ALARM &list_alarm = alarm_list.at(index);
+ copy_alarm_data(&context_menu_alarm, &list_alarm);
+ if (context_menu_alarm.occurrence == OC_ONCE)
+ EnableMenuItem(submenu, ID_REMINDERFRAMECONTEXT_SUSPEND, MF_BYCOMMAND | MF_GRAYED);
- case WM_CONTEXTMENU:
- {
- /*
- */
- POINT pt;
- GetCursorPos(&pt);
- ScreenToClient(hwnd_list, &pt);
+ }
+ }
+ else {
+ EnableMenuItem(submenu, ID_REMINDERFRAMECONTEXT_SUSPEND, MF_BYCOMMAND | MF_GRAYED);
+ EnableMenuItem(submenu, ID_REMINDERFRAMECONTEXT_EDIT, MF_BYCOMMAND | MF_GRAYED);
+ EnableMenuItem(submenu, ID_REMINDERFRAMECONTEXT_DELETE, MF_BYCOMMAND | MF_GRAYED);
+ }
+ LeaveCriticalSection(&list_cs);
- EnterCriticalSection(&list_cs);
- DWORD item = SendMessage(hwnd_list, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y));
+ //ClientToScreen(hwnd_list, &pt);
+ GetCursorPos(&pt);
- HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)), submenu = GetSubMenu(menu, 0);
- TranslateMenu(submenu);
-
- if (HIWORD(item) == 0) {
- int sel = LOWORD(item);
- if (sel >= 0) {
- // one-off alarms can't be suspended
- int index = SendMessage(hwnd_list, LB_GETITEMDATA, (WPARAM)sel, 0);
- ALARM &list_alarm = alarm_list.at(index);
- copy_alarm_data(&context_menu_alarm, &list_alarm);
- if (context_menu_alarm.occurrence == OC_ONCE)
- EnableMenuItem(submenu, ID_REMINDERFRAMECONTEXT_SUSPEND, MF_BYCOMMAND | MF_GRAYED);
+ BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ DestroyMenu(menu);
+ if (ret) PostMessage(hwnd, WM_COMMAND, ret, 0);
+ }
+ return TRUE;
- }
- } else {
- EnableMenuItem(submenu, ID_REMINDERFRAMECONTEXT_SUSPEND, MF_BYCOMMAND | MF_GRAYED);
- EnableMenuItem(submenu, ID_REMINDERFRAMECONTEXT_EDIT, MF_BYCOMMAND | MF_GRAYED);
- EnableMenuItem(submenu, ID_REMINDERFRAMECONTEXT_DELETE, MF_BYCOMMAND | MF_GRAYED);
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case ID_REMINDERFRAMECONTEXT_OPTIONS:
+ {
+ OPENOPTIONSDIALOG oop;
+ oop.cbSize = sizeof(oop);
+ oop.pszGroup = Translate("Events");
+ oop.pszPage = Translate("Alarms");
+ oop.pszTab = 0;
+ Options_Open(&oop);
+ }
+ break;
+ case ID_REMINDERFRAMECONTEXT_SUSPEND:
+ if (context_menu_alarm.occurrence != OC_ONCE) {
+ suspend(context_menu_alarm.id);
+ PostMessage(hwnd, WMU_FILL_LIST, 0, 0);
+ if (hwndOptionsDialog) {
+ // refresh options list
+ PostMessage(hwndOptionsDialog, WMU_INITOPTLIST, 0, 0);
}
- LeaveCriticalSection(&list_cs);
-
- //ClientToScreen(hwnd_list, &pt);
- GetCursorPos(&pt);
-
- BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
- DestroyMenu(menu);
- if (ret) PostMessage(hwnd, WM_COMMAND, ret, 0);
}
- return TRUE;
-
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case ID_REMINDERFRAMECONTEXT_OPTIONS:
- {
- OPENOPTIONSDIALOG oop;
- oop.cbSize = sizeof(oop);
- oop.pszGroup = Translate("Events");
- oop.pszPage = Translate("Alarms");
- oop.pszTab = 0;
- Options_Open(&oop);
- }
- break;
- case ID_REMINDERFRAMECONTEXT_SUSPEND:
- if (context_menu_alarm.occurrence != OC_ONCE) {
- suspend(context_menu_alarm.id);
- PostMessage(hwnd, WMU_FILL_LIST, 0, 0);
- if (hwndOptionsDialog) {
- // refresh options list
- PostMessage(hwndOptionsDialog, WMU_INITOPTLIST, 0, 0);
- }
- }
- break;
- case ID_REMINDERFRAMECONTEXT_EDIT:
- EditNonModal(context_menu_alarm);
- break;
- case ID_REMINDERFRAMECONTEXT_DELETE:
- remove(context_menu_alarm.id);
- PostMessage(hwnd, WMU_FILL_LIST, 0, 0);
- if (hwndOptionsDialog) {
- // refresh options list
- PostMessage(hwndOptionsDialog, WMU_INITOPTLIST, 0, 0);
- }
- break;
-
- case ID_REMINDERFRAMECONTEXT_NEWALARM:
- NewAlarmMenuFunc(0, 0);
- break;
- }
- return TRUE;
-
- case WM_DESTROY:
- KillTimer(hwnd, ID_FRAME_UPDATE_TIMER);
- KillTimer(hwnd, ID_FRAME_SHOWHIDE_TIMER);
- free_alarm_data(&context_menu_alarm);
break;
+ case ID_REMINDERFRAMECONTEXT_EDIT:
+ EditNonModal(context_menu_alarm);
+ break;
+ case ID_REMINDERFRAMECONTEXT_DELETE:
+ remove(context_menu_alarm.id);
+ PostMessage(hwnd, WMU_FILL_LIST, 0, 0);
+ if (hwndOptionsDialog) {
+ // refresh options list
+ PostMessage(hwndOptionsDialog, WMU_INITOPTLIST, 0, 0);
+ }
+ break;
+
+ case ID_REMINDERFRAMECONTEXT_NEWALARM:
+ NewAlarmMenuFunc(0, 0);
+ break;
+ }
+ return TRUE;
+
+ case WM_DESTROY:
+ KillTimer(hwnd, ID_FRAME_UPDATE_TIMER);
+ KillTimer(hwnd, ID_FRAME_SHOWHIDE_TIMER);
+ free_alarm_data(&context_menu_alarm);
+ break;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -458,7 +445,7 @@ int ReloadFont(WPARAM wParam, LPARAM lParam)
SendMessage(hwnd_list, WM_SETFONT, (WPARAM)hFont, (LPARAM)TRUE);
DeleteObject(bk_brush);
- bk_brush = CreateSolidBrush(DBGetContactSettingDword(0, "Alarm", "clFrameBack", GetSysColor(COLOR_3DFACE)));
+ bk_brush = CreateSolidBrush(db_get_dw(0, "Alarm", "clFrameBack", GetSysColor(COLOR_3DFACE)));
RefreshReminderFrame();
return 0;
@@ -485,6 +472,7 @@ void FixMainMenu()
/////////////////////////
// only used when no multiwindow functionality is available
+
bool ReminderFrameVisible()
{
return IsWindowVisible(hwnd_frame) ? true : false;
@@ -506,6 +494,7 @@ INT_PTR ShowHideMenuFunc(WPARAM wParam, LPARAM lParam)
FixMainMenu();
return 0;
}
+
//////////////////////////////
int CreateFrame()
@@ -518,28 +507,25 @@ int CreateFrame()
wndclass.hInstance = hInst;
wndclass.hIcon = NULL;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
- wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1);
+ wndclass.hbrBackground = 0;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = _T("AlarmsFrame");
RegisterClass(&wndclass);
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
-
hwnd_plugin = CreateWindow(_T("AlarmsFrame"), TranslateT("Alarms"),
WS_CHILD | WS_CLIPCHILDREN,
0,0,10,10, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL,hInst,NULL);
- CLISTFrame Frame = {0};
-
- Frame.cbSize=sizeof(CLISTFrame);
- Frame.name = Frame.TBname = Translate("Alarms");
- Frame.hWnd=hwnd_plugin;
- Frame.align=alBottom;
- Frame.Flags=F_VISIBLE|F_SHOWTB|F_SHOWTBTIP;
- Frame.height=30;
-
- frame_id=CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,0);
- } else {
+ CLISTFrame Frame = { sizeof(CLISTFrame) };
+ Frame.tname = TranslateT("Alarms");
+ Frame.hWnd = hwnd_plugin;
+ Frame.align = alBottom;
+ Frame.Flags = F_TCHAR | F_VISIBLE | F_SHOWTB | F_SHOWTBTIP;
+ Frame.height = 30;
+ frame_id = CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,0);
+ }
+ else {
wndclass.style = 0;//CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = FrameContainerWindowProc;
wndclass.cbClsExtra = 0;
@@ -567,15 +553,12 @@ int CreateFrame()
// create menu item
CreateServiceFunction(MODULE "/ShowHideReminders", ShowHideMenuFunc);
- CLISTMENUITEM mi = {0};
-
- mi.cbSize=sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ALL;
-
mi.hIcon=hIconMenuShowHide;
- mi.pszName = Translate("Show Reminders");
- mi.pszService= MODULE "/ShowHideReminders";
- mi.pszPopupName = Translate("Alarms");
+ mi.pszName = LPGEN("Show Reminders");
+ mi.pszService = MODULE "/ShowHideReminders";
+ mi.pszPopupName = LPGEN("Alarms");
mi.position = 500010000;
hMenuShowReminders = Menu_AddMainMenuItem(&mi);
/////////////////////
@@ -585,16 +568,15 @@ int CreateFrame()
if (IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))) {
ShowWindow(hwnd_frame, SW_SHOW);
RefreshReminderFrame();
- } else {
- ShowWindow(hwnd_frame, SW_HIDE);
}
- } else {
- if (DBGetContactSettingByte(0, MODULE, "ReminderFrameVisible", 1) == 1) {
+ else ShowWindow(hwnd_frame, SW_HIDE);
+ }
+ else {
+ if (db_get_b(0, MODULE, "ReminderFrameVisible", 1) == 1) {
ShowWindow(hwnd_frame, SW_SHOW);
RefreshReminderFrame();
- } else {
- ShowWindow(hwnd_frame, SW_HIDE);
}
+ else ShowWindow(hwnd_frame, SW_HIDE);
}
}
@@ -629,7 +611,7 @@ int CreateFrame()
HookEvent(ME_FONT_RELOAD, ReloadFont);
// create the brush used for the background in the absence of clist_modern skinning features - match clist
- bk_brush = CreateSolidBrush(DBGetContactSettingDword(0, "Alarm", "clFrameBack", GetSysColor(COLOR_3DFACE)));
+ bk_brush = CreateSolidBrush(db_get_dw(0, "Alarm", "clFrameBack", GetSysColor(COLOR_3DFACE)));
SendMessage(hwnd_list, WM_SETFONT, (WPARAM)hFont, (LPARAM)TRUE);
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp
index 8bb50da8a9..2c1bb60950 100644
--- a/plugins/Alarms/src/options.cpp
+++ b/plugins/Alarms/src/options.cpp
@@ -533,12 +533,10 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
TCHAR buff[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_TITLE, buff, MAX_PATH);
- if (add_edit_alarm->szTitle) free(add_edit_alarm->szTitle);
- add_edit_alarm->szTitle = mir_tstrdup(buff);
+ replaceStrT(add_edit_alarm->szTitle, buff);
GetDlgItemText(hwndDlg, IDC_DESC, buff, MAX_PATH);
- if (add_edit_alarm->szDesc) free(add_edit_alarm->szDesc);
- add_edit_alarm->szDesc = mir_tstrdup(buff);
+ replaceStrT(add_edit_alarm->szDesc, buff);
if (add_edit_alarm->szTitle == 0 || _tcslen(add_edit_alarm->szTitle) == 0) {
MessageBox(hwndDlg, TranslateT("Please enter a title for this alarm."), TranslateT("Error"), MB_OK | MB_ICONERROR);
@@ -565,11 +563,9 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (add_edit_alarm->action & AAF_COMMAND) {
GetDlgItemText(hwndDlg, IDC_ED_COMMAND, buff, MAX_PATH);
- if (add_edit_alarm->szCommand) free(add_edit_alarm->szCommand);
- add_edit_alarm->szCommand = mir_tstrdup(buff);
+ replaceStrT(add_edit_alarm->szCommand, buff);
GetDlgItemText(hwndDlg, IDC_ED_PARAMS, buff, MAX_PATH);
- if (add_edit_alarm->szCommandParams) free(add_edit_alarm->szCommandParams);
- add_edit_alarm->szCommandParams = mir_tstrdup(buff);
+ replaceStrT(add_edit_alarm->szCommandParams, buff);
}
if (add_edit_alarm->action & AAF_SOUND) {
@@ -1162,35 +1158,35 @@ int OptInit(WPARAM wParam,LPARAM lParam)
void LoadOptions()
{
- options.use_popup_module = (DBGetContactSettingByte(0, MODULE, "UsePopupModule", 0) == 1);
- options.snooze_minutes = (int)DBGetContactSettingDword(0, MODULE, "SnoozeMinutes", 10);
- options.row_height = (int)DBGetContactSettingDword(0, MODULE, "RowHeight", 20);
- options.indent = (int)DBGetContactSettingDword(0, MODULE, "Indent", 5);
- options.aw_trans = (int)DBGetContactSettingByte(0, MODULE, "Transparency", 0);
- options.aw_roundcorners = (DBGetContactSettingByte(0, MODULE, "RoundCorners", 1) == 1);
- options.aw_dontstealfocus = (DBGetContactSettingByte(0, MODULE, "DontStealFocus", 1) == 1);
- options.auto_showhide = (DBGetContactSettingByte(0, MODULE, "AutoShowHide", 0) == 1);
- options.hide_with_clist = (DBGetContactSettingByte(0, MODULE, "HideWithClist", 0) == 1);
- options.loop_sound = (DBGetContactSettingByte(0, MODULE, "LoopSound", 1) == 1);
- options.auto_size_vert = (DBGetContactSettingByte(0, MODULE, "AutoSize", 0) == 1);
- options.reminder_period = (int)DBGetContactSettingDword(0, MODULE, "ReminderPeriod", 8);
+ options.use_popup_module = (db_get_b(0, MODULE, "UsePopupModule", 0) == 1);
+ options.snooze_minutes = (int)db_get_dw(0, MODULE, "SnoozeMinutes", 10);
+ options.row_height = (int)db_get_dw(0, MODULE, "RowHeight", 20);
+ options.indent = (int)db_get_dw(0, MODULE, "Indent", 5);
+ options.aw_trans = (int)db_get_b(0, MODULE, "Transparency", 0);
+ options.aw_roundcorners = (db_get_b(0, MODULE, "RoundCorners", 1) == 1);
+ options.aw_dontstealfocus = (db_get_b(0, MODULE, "DontStealFocus", 1) == 1);
+ options.auto_showhide = (db_get_b(0, MODULE, "AutoShowHide", 0) == 1);
+ options.hide_with_clist = (db_get_b(0, MODULE, "HideWithClist", 0) == 1);
+ options.loop_sound = (db_get_b(0, MODULE, "LoopSound", 1) == 1);
+ options.auto_size_vert = (db_get_b(0, MODULE, "AutoSize", 0) == 1);
+ options.reminder_period = (int)db_get_dw(0, MODULE, "ReminderPeriod", 8);
HookEvent(ME_SYSTEM_MODULESLOADED, OptionsModulesLoaded);
}
void SaveOptions()
{
- DBWriteContactSettingByte(0, MODULE, "UsePopupModule", options.use_popup_module ? 1 : 0);
+ db_set_b(0, MODULE, "UsePopupModule", options.use_popup_module ? 1 : 0);
DBWriteContactSettingDword(0, MODULE, "SnoozeMinutes", options.snooze_minutes);
DBWriteContactSettingDword(0, MODULE, "RowHeight", options.row_height);
DBWriteContactSettingDword(0, MODULE, "Indent", options.indent);
- DBWriteContactSettingByte(0, MODULE, "Transparency", options.aw_trans);
- DBWriteContactSettingByte(0, MODULE, "RoundCorners", options.aw_roundcorners ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "DontStealFocus", options.aw_dontstealfocus ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "AutoShowHide", options.auto_showhide ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "HideWithClist", options.hide_with_clist ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "LoopSound", options.loop_sound ? 1 : 0);
- DBWriteContactSettingByte(0, MODULE, "AutoSize", options.auto_size_vert ? 1 : 0);
+ db_set_b(0, MODULE, "Transparency", options.aw_trans);
+ db_set_b(0, MODULE, "RoundCorners", options.aw_roundcorners ? 1 : 0);
+ db_set_b(0, MODULE, "DontStealFocus", options.aw_dontstealfocus ? 1 : 0);
+ db_set_b(0, MODULE, "AutoShowHide", options.auto_showhide ? 1 : 0);
+ db_set_b(0, MODULE, "HideWithClist", options.hide_with_clist ? 1 : 0);
+ db_set_b(0, MODULE, "LoopSound", options.loop_sound ? 1 : 0);
+ db_set_b(0, MODULE, "AutoSize", options.auto_size_vert ? 1 : 0);
DBWriteContactSettingDword(0, MODULE, "ReminderPeriod", options.reminder_period);
}