diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-25 19:25:38 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-25 19:25:38 +0000 |
commit | 2cf824fd2efaec5fa0125fdde5fd513dd906d844 (patch) | |
tree | aadae8304f8cf90c06c73ca49180c62faeef539b /plugins/NotesAndReminders | |
parent | a01f62f394fc01e3c6ed89924be804d2438787e5 (diff) |
plugins cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@6233 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NotesAndReminders')
-rw-r--r-- | plugins/NotesAndReminders/src/main.cpp | 26 | ||||
-rw-r--r-- | plugins/NotesAndReminders/src/miscutils.cpp | 5 | ||||
-rw-r--r-- | plugins/NotesAndReminders/src/miscutils.h | 5 | ||||
-rw-r--r-- | plugins/NotesAndReminders/src/notes.cpp | 8 | ||||
-rw-r--r-- | plugins/NotesAndReminders/src/options.cpp | 4 | ||||
-rw-r--r-- | plugins/NotesAndReminders/src/reminders.cpp | 161 |
6 files changed, 4 insertions, 205 deletions
diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 3bb0919e47..e9776abf1e 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -9,9 +9,7 @@ HANDLE hkTopToolbarInit = NULL; HANDLE hkModulesLoaded = NULL;
HANDLE hkFontChange = NULL;
HANDLE hkColorChange = NULL;
-HMODULE hUserDll = NULL;
HMODULE hRichedDll = NULL;
-HMODULE hKernelDll = NULL;
extern TREEELEMENT *g_Stickies;
extern TREEELEMENT *RemindersList;
@@ -286,10 +284,6 @@ extern "C" __declspec(dllexport) int Unload(void) if (hRichedDll)
FreeLibrary(hRichedDll);
- if (hUserDll)
- FreeLibrary(hUserDll);
- if (hKernelDll)
- FreeLibrary(hKernelDll);
return 0;
}
@@ -317,26 +311,6 @@ extern "C" __declspec(dllexport) int Load(void) return 0;
}
- hUserDll = LoadLibrary(_T("user32.dll"));
- if (hUserDll) {
- MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll,"SetLayeredWindowAttributes");
- MyMonitorFromWindow = (HANDLE (WINAPI*)(HWND,DWORD))GetProcAddress(hUserDll,"MonitorFromWindow");
- }
- else {
- MySetLayeredWindowAttributes = NULL;
- MyMonitorFromWindow = NULL;
- }
-
- hKernelDll = LoadLibrary(_T("kernel32.dll"));
- if (hKernelDll) {
- MyTzSpecificLocalTimeToSystemTime = (BOOL (WINAPI*)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME))GetProcAddress(hKernelDll,"TzSpecificLocalTimeToSystemTime");
- MySystemTimeToTzSpecificLocalTime = (BOOL (WINAPI*)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME))GetProcAddress(hKernelDll,"SystemTimeToTzSpecificLocalTime");
- }
- else {
- MyTzSpecificLocalTimeToSystemTime = NULL;
- MySystemTimeToTzSpecificLocalTime = NULL;
- }
-
InitServices();
WS_Init();
diff --git a/plugins/NotesAndReminders/src/miscutils.cpp b/plugins/NotesAndReminders/src/miscutils.cpp index f29ef4c233..71dc3644dd 100644 --- a/plugins/NotesAndReminders/src/miscutils.cpp +++ b/plugins/NotesAndReminders/src/miscutils.cpp @@ -1,10 +1,5 @@ #include "globals.h"
-BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
-HANDLE (WINAPI *MyMonitorFromWindow)(HWND,DWORD);
-BOOL (WINAPI *MyTzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME);
-BOOL (WINAPI *MySystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME);
-
WORD ConvertHotKeyToControl(WORD HK)
{
WORD R = 0;
diff --git a/plugins/NotesAndReminders/src/miscutils.h b/plugins/NotesAndReminders/src/miscutils.h index 9b8106a7ff..2b7c779b9e 100644 --- a/plugins/NotesAndReminders/src/miscutils.h +++ b/plugins/NotesAndReminders/src/miscutils.h @@ -10,11 +10,6 @@ void WriteSettingIntArray(HANDLE hContact,char *ModuleName, bool ReadSettingIntArray(HANDLE hContact,char *ModuleName,
char *SettingName,int *Value, int Size);
-extern BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
-extern HANDLE (WINAPI *MyMonitorFromWindow)(HWND,DWORD);
-extern BOOL (WINAPI *MyTzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME);
-extern BOOL (WINAPI *MySystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME);
-
WORD ConvertHotKeyToControl(WORD HK);
WORD ConvertControlToHotKey(WORD HK);
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 5c19457227..c8146bd1e7 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -303,7 +303,7 @@ STICKYNOTE* NewNoteEx(int Ax,int Ay,int Aw,int Ah,char *Data,ULARGE_INTEGER *ID, TSN->pCustomFont = pCustomFont;
L1 = WS_EX_TOOLWINDOW;
- if (MySetLayeredWindowAttributes && g_Transparency < 255) L1 |= WS_EX_LAYERED;
+ if (g_Transparency < 255) L1 |= WS_EX_LAYERED;
if (OnTop) L1 |= WS_EX_TOPMOST;
L2 = WS_POPUP | WS_THICKFRAME | WS_CAPTION;
@@ -313,14 +313,14 @@ STICKYNOTE* NewNoteEx(int Ax,int Ay,int Aw,int Ah,char *Data,ULARGE_INTEGER *ID, // we don't have to worry about notes "drifting" between sessions
TSN->SNHwnd = CreateWindowEx(L1, NOTE_WND_CLASS, _T("StickyNote"), L2, Ax,Ay,Aw,Ah, NULL, 0, hmiranda, TSN);
- if (MySetLayeredWindowAttributes && g_Transparency < 255)
- MySetLayeredWindowAttributes(TSN->SNHwnd,0,(BYTE)g_Transparency,LWA_ALPHA);
+ if (g_Transparency < 255)
+ SetLayeredWindowAttributes(TSN->SNHwnd,0,(BYTE)g_Transparency,LWA_ALPHA);
// ensure that window is not placed off-screen (if previous session had different monitor count or resolution)
// NOTE: SetWindowPlacement should do this, but it's extremly flakey
if (Data)
{
- if (MyMonitorFromWindow && !MyMonitorFromWindow(TSN->SNHwnd, MONITOR_DEFAULTTONULL) )
+ if (!MonitorFromWindow(TSN->SNHwnd, MONITOR_DEFAULTTONULL) )
{
TWP.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(GetDesktopWindow(), &TWP);
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 1cbb55f47b..cb1c01a988 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -376,10 +376,6 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPar SetDlgItemText(hdlg,IDC_EDIT_EMAILSMS,"");
SetDlgItemText(hdlg,IDC_EDIT_ALTBROWSER,g_lpszAltBrowser ? g_lpszAltBrowser : _T(""));
- if (!MySetLayeredWindowAttributes)
- { // layered UI not available
- EnableWindow(GetDlgItem(hdlg,IDC_SLIDER_TRANSPARENCY), FALSE);
- }
return TRUE;
}
case WM_HSCROLL:
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index c2fc4306ea..21d9626fdd 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -68,167 +68,6 @@ static int ReminderSortCb(TREEELEMENT *v1, TREEELEMENT *v2) return (((REMINDERDATA*)v1->ptrdata)->When.QuadPart < ((REMINDERDATA*)v2->ptrdata)->When.QuadPart) ? -1 : 1;
}
-
-#ifndef WINXP_MINIMUM
-// TzSpecificLocalTimeToSystemTime/SystemTimeToTzSpecificLocalTime (re-)implemented to work on win2k and older
-
-static const int DaysInMonth[2][12] =
-{
- { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, // normal year
- { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } // leap year
-};
-
-static __inline BOOL IsLeapYear(UINT Y)
-{
- return !(Y & 3) && ((Y % 100) || !(Y % 400));
-}
-
-static int TZDateComp(const SYSTEMTIME *lpDate, const SYSTEMTIME *lpDateRef)
-{
- int boundaryDay, day;
-
- if (lpDate->wMonth < lpDateRef->wMonth)
- return -1;
- if (lpDate->wMonth > lpDateRef->wMonth)
- return 1;
-
- if (!lpDateRef->wYear)
- {
- const int week = (int)lpDateRef->wDay;
- const WORD wFirst = (6 + lpDateRef->wDayOfWeek - lpDate->wDayOfWeek + lpDate->wDay) % 7 + 1;
- boundaryDay = (int)wFirst + 7 * (week - 1);
- if (boundaryDay > DaysInMonth[ IsLeapYear(lpDate->wYear) ][lpDate->wMonth-1])
- boundaryDay -= 7;
- }
- else
- boundaryDay = (int)lpDateRef->wDay;
-
- boundaryDay = ((boundaryDay * 24 + (int)lpDateRef->wHour) * 60 + (int)lpDateRef->wMinute) * 60;
- day = (((int)lpDate->wDay * 24 + (int)lpDate->wHour) * 60 + (int)lpDate->wMinute) * 60 + (int)lpDate->wSecond;
-
- return (day < boundaryDay) ? -1 : (day > boundaryDay);
-}
-
-static UINT TZGetType(LPTIME_ZONE_INFORMATION lpTZI, ULARGE_INTEGER *lpFT, BOOL bLocal)
-{
- if (lpTZI->DaylightDate.wMonth)
- {
- ULARGE_INTEGER ft = *lpFT;
- SYSTEMTIME tm;
- BOOL BeforeStandardDate, AfterDaylightDate;
- UINT id;
-
- if (!lpTZI->StandardDate.wMonth || (!lpTZI->StandardDate.wYear
- && (!lpTZI->StandardDate.wDay || lpTZI->StandardDate.wDay > 5
- || !lpTZI->DaylightDate.wDay || lpTZI->DaylightDate.wDay > 5)))
- return TIME_ZONE_ID_INVALID;
-
- if (!bLocal)
- ft.QuadPart -= (LONGLONG)(lpTZI->Bias + lpTZI->DaylightBias) * (LONGLONG)600000000;
-
- FileTimeToSystemTime((FILETIME*)&ft, &tm);
-
- BeforeStandardDate = (TZDateComp(&tm, &lpTZI->StandardDate) < 0);
-
- if (!bLocal)
- {
- ft.QuadPart -= (LONGLONG)(lpTZI->StandardBias - lpTZI->DaylightBias) * (LONGLONG)600000000;
- FileTimeToSystemTime((FILETIME*)&ft, &tm);
- }
-
- AfterDaylightDate = (TZDateComp(&tm, &lpTZI->DaylightDate) >= 0);
-
- id = TIME_ZONE_ID_STANDARD;
- if (lpTZI->DaylightDate.wMonth < lpTZI->StandardDate.wMonth)
- {
- if (BeforeStandardDate && AfterDaylightDate)
- id = TIME_ZONE_ID_DAYLIGHT;
- }
- else
- {
- if (BeforeStandardDate || AfterDaylightDate)
- id = TIME_ZONE_ID_DAYLIGHT;
- }
-
- return id;
- }
-
- return TIME_ZONE_ID_UNKNOWN;
-}
-
-static BOOL TZGetBias(LPTIME_ZONE_INFORMATION lpTZI, ULARGE_INTEGER *lpFT, BOOL bLocal, LONG *pBias)
-{
- LONG Bias = lpTZI->Bias;
-
- switch ( TZGetType(lpTZI, lpFT, bLocal) )
- {
- case TIME_ZONE_ID_INVALID: return FALSE;
- case TIME_ZONE_ID_DAYLIGHT: Bias += lpTZI->DaylightBias; break;
- case TIME_ZONE_ID_STANDARD: Bias += lpTZI->StandardBias; break;
- }
-
- *pBias = Bias;
-
- return TRUE;
-}
-
-#define TzSpecificLocalTimeToSystemTime _TzSpecificLocalTimeToSystemTime
-static BOOL _TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTZI, LPSYSTEMTIME lpLocal, LPSYSTEMTIME lpUtc)
-{
- TIME_ZONE_INFORMATION tzi;
- ULARGE_INTEGER ft;
- LONG Bias;
-
- // if possible use the real function (shouldn't be necessary, be feels more comfortable)
- if (MyTzSpecificLocalTimeToSystemTime)
- return MyTzSpecificLocalTimeToSystemTime(lpTZI, lpLocal, lpUtc);
-
- if (!lpTZI)
- {
- if (GetTimeZoneInformation(&tzi) == TIME_ZONE_ID_INVALID)
- return FALSE;
- lpTZI = &tzi;
- }
-
- if (!SystemTimeToFileTime(lpLocal, (FILETIME*)&ft)
- || !TZGetBias(lpTZI, &ft, TRUE, &Bias))
- return FALSE;
-
- ft.QuadPart += (LONGLONG)Bias * (LONGLONG)600000000;
-
- return FileTimeToSystemTime((FILETIME*)&ft, lpUtc);
-}
-
-#define SystemTimeToTzSpecificLocalTime _SystemTimeToTzSpecificLocalTime
-static BOOL _SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTZI, LPSYSTEMTIME lpUtc, LPSYSTEMTIME lpLocal)
-{
- TIME_ZONE_INFORMATION tzi;
- ULARGE_INTEGER ft;
- LONG Bias;
-
- // if possible use the real function (shouldn't be necessary, be feels more comfortable)
- if (MySystemTimeToTzSpecificLocalTime)
- return MySystemTimeToTzSpecificLocalTime(lpTZI, lpUtc, lpLocal);
-
- if (!lpTZI)
- {
- if (GetTimeZoneInformation(&tzi) == TIME_ZONE_ID_INVALID)
- return FALSE;
- lpTZI = &tzi;
- }
-
- if (!SystemTimeToFileTime(lpUtc, (FILETIME*)&ft)
- || !TZGetBias(lpTZI, &ft, FALSE, &Bias))
- return FALSE;
-
- ft.QuadPart -= (LONGLONG)Bias * (LONGLONG)600000000;
-
- return FileTimeToSystemTime((FILETIME*)&ft, lpLocal);
-}
-
-#endif
-
-
// time convertsion routines that take local time-zone specific daylight saving configuration into account
// (unlike the standard FileTimeToLocalFileTime functions)
|