diff options
Diffstat (limited to 'plugins/FloatingContacts/src')
-rw-r--r-- | plugins/FloatingContacts/src/filedrop.cpp | 4 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/fltcont.h | 33 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/main.cpp | 602 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/options.cpp | 1355 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/resource.h | 19 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/stdhdr.h | 2 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/thumbs.cpp | 57 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/version.h | 8 |
8 files changed, 552 insertions, 1528 deletions
diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index eb3b336200..a08a1d7fbe 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -282,8 +282,8 @@ static void SaveFiles( char *szItem, char **ppFiles, int *pnCount ) }
else
{
- int nSize = sizeof(char) * ( strlen( szItem ) + strlen( fd.cFileName ) + sizeof( char ));
- char *szFile = (char*) malloc( nSize ) ;
+ size_t nSize = sizeof(char) * ( strlen( szItem ) + strlen( fd.cFileName ) + sizeof( char ));
+ char *szFile = (char*) malloc( nSize ) ;
strncpy( szFile, szItem, nSize - 1 );
diff --git a/plugins/FloatingContacts/src/fltcont.h b/plugins/FloatingContacts/src/fltcont.h index 4f32f30f4e..54ce7304d2 100644 --- a/plugins/FloatingContacts/src/fltcont.h +++ b/plugins/FloatingContacts/src/fltcont.h @@ -67,7 +67,7 @@ enum /////////////////////////////////////////////////////////////////////////////
//
-#define sModule "FloatingContacts"
+#define MODULE "FloatingContacts"
#define TOTOPTIME_P 1000
#define TOTOPTIME_MAX (15*(60000/TOTOPTIME_P))
@@ -79,7 +79,7 @@ enum #define DB_POS_MAKE_XY(x, y) MAKELONG((short)(((float)x*MAXRCOOR)/(float)GetSystemMetrics(SM_CXSCREEN)+0.5), (short)(((float)y*MAXRCOOR)/(float)GetSystemMetrics(SM_CYSCREEN)+0.5))
extern HINSTANCE hInst;
-extern BOOL bNT;
+
//extern BOOL bHideOffline;
//extern BOOL bHideAll;
//extern BOOL bHideWhenFullscreen;
@@ -156,35 +156,20 @@ void SendMsgDialog ( HWND hwnd, TCHAR *pText ); void SaveContactsPos ( void );
/////////////////////////////////////////////////////////////////////////////
-//
-void
-GetFontSetting
- ( IN BOOL bFltContacts
- , IN int nFontId
- , IN LOGFONTA* lf
- , IN COLORREF* colour
- );
+void ApplyOptionsChanges();
-void
-ApplyOptionsChanges();
+void OnStatusChanged();
-void
-OnStatusChanged();
+void SetThumbsOpacity(BYTE btAlpha);
-void
-SetThumbsOpacity
- ( IN BYTE btAlpha
- );
-
-int
-OnOptionsInitialize
- ( IN WPARAM wParam
- , IN LPARAM lParam
- );
+int OnOptionsInitialize(WPARAM wParam, LPARAM lParam);
/////////////////////////////////////////////////////////////////////////////
+typedef HRESULT (STDAPICALLTYPE *pfnSHAutoComplete)(HWND,DWORD);
+extern pfnSHAutoComplete fnSHAutoComplete;
+
#endif // #ifndef __FLTCONT_H__
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 216188c5b0..e2c8a30fe2 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -16,6 +16,8 @@ No warranty for any misbehaviour. #include "stdhdr.h"
+#include "../Utils/mir_fonts.h"
+
BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD);
BOOL (WINAPI *pUpdateLayeredWindow)
(HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc,
@@ -33,8 +35,6 @@ static void LoadMenus (); static void CreateThumbWnd ( TCHAR *ptszName, HANDLE hContact, int nX, int nY );
static void RegisterWindowClass ( void );
static void UnregisterWindowClass ( void );
-static void CleanUp ( void );
-static BOOL GetOSPlatform ( void );
static void LoadDBSettings ( void );
static void CreateThumbsFont ( void );
static void CreateBackgroundBrush ( void );
@@ -46,24 +46,9 @@ static int ClcStatusToPf2 ( int status ); static LRESULT __stdcall CommWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
-static int OnContactDeleted ( WPARAM wParam, LPARAM lParam );
-static int OnContactIconChanged ( WPARAM wParam, LPARAM lParam );
-static int OnContactDrag ( WPARAM wParam, LPARAM lParam );
-static int OnContactDrop ( WPARAM wParam, LPARAM lParam );
-static int OnContactDragStop ( WPARAM wParam, LPARAM lParam );
-static int OnSkinIconsChanged ( WPARAM wParam, LPARAM lParam );
-static int OnContactSettingChanged ( WPARAM wParam, LPARAM lParam );
-static int OnStatusModeChange ( WPARAM wParam, LPARAM lParam );
-static int OnModulesLoded ( WPARAM wParam, LPARAM lParam );
-static int OnPrebuildContactMenu ( WPARAM wParam, LPARAM lParam );
-
-static INT_PTR OnContactMenu_Remove ( WPARAM wParam, LPARAM lParam );
-static INT_PTR OnMainMenu_HideAll ( WPARAM wParam, LPARAM lParam );
-static INT_PTR OnHotKey_HideWhenCListShow( WPARAM wParam, LPARAM lParam );
static VOID CALLBACK ToTopTimerProc ( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
HINSTANCE hInst = NULL;
-HMODULE hUserDll = NULL;
HFONT hFont[FLT_FONTIDS] = {NULL};
COLORREF tColor[FLT_FONTIDS] = {0};
HIMAGELIST himl = NULL;
@@ -78,7 +63,6 @@ WORD nBackgroundBmpUse = CLB_STRETCH; HWND hwndMiranda = NULL;
BOOL bVersionOK = FALSE;
-BOOL bNT = FALSE;
BOOL bDockHorz = TRUE;
//UINT nStatus = 0;
HMENU hContactMenu = NULL;
@@ -91,11 +75,10 @@ BOOL bEnableTip = FALSE; UINT_PTR ToTopTimerID = 0;
BOOL bIsCListShow = TRUE;
-HANDLE hRemoveThumb = NULL;
-HANDLE hMainHideAllThumbs = NULL;
-HANDLE hHideWhenCListShow = NULL;
int hLangpack;
+pfnSHAutoComplete fnSHAutoComplete = NULL;
+
//Options
FCOptions fcOpt = {0};
@@ -138,124 +121,27 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda ///////////////////////////////////////////////////////
// Load / unload
+
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
hInst = hinstDLL;
return TRUE;
}
-extern "C" int __declspec(dllexport) Load()
-{
- SetLastError(0);
- InitOptions();
-
- mir_getLP(&pluginInfoEx);
-
- HookEvent( ME_SYSTEM_MODULESLOADED, OnModulesLoded );
- bNT = GetOSPlatform();
-
- if (hUserDll = LoadLibrary(_T("user32.dll"))) {
- pSetLayeredWindowAttributes =
- (BOOL (WINAPI *)(HWND, COLORREF, BYTE, DWORD))
- GetProcAddress(hUserDll, "SetLayeredWindowAttributes");
- pUpdateLayeredWindow =
- (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD))
- GetProcAddress(hUserDll, "UpdateLayeredWindow");
- }
- else {
- pSetLayeredWindowAttributes = NULL;
- pUpdateLayeredWindow = NULL;
- }
-
- return 0;
-}
-
-extern "C" int __declspec(dllexport) Unload()
-{
- CleanUp();
- return 0;
-}
-
-static void CleanUp()
+/////////////////////////////////////////////////////////////////////////////
+// Fonts
+
+static LPCTSTR s_fonts[FLT_FONTIDS] =
{
- int nFontId;
-
- if (hRemoveThumb)
- DestroyServiceFunction(hRemoveThumb);
- if (hMainHideAllThumbs)
- DestroyServiceFunction(hMainHideAllThumbs);
- if (hHideWhenCListShow)
- DestroyServiceFunction(hHideWhenCListShow);
-
- if (ServiceExists(MS_HOTKEY_UNREGISTER)) {
- CallService(MS_HOTKEY_UNREGISTER, 0, (LPARAM)(sModule "/MainHideAllThumbs"));
- CallService(MS_HOTKEY_UNREGISTER, 0, (LPARAM)(sModule "/HideWhenCListShow"));
- }
-
- if (NULL != hLTEdgesPen)
- DeleteObject(hLTEdgesPen);
- if (NULL != hRBEdgesPen)
- DeleteObject(hRBEdgesPen);
- if (NULL != hBmpBackground)
- DeleteObject(hBmpBackground);
- if (NULL != hBkBrush) {
- SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL);
- DeleteObject(hBkBrush);
- hBkBrush = NULL;
- }
-
- for (nFontId = 0; nFontId < FLT_FONTIDS; nFontId++)
- if (NULL != hFont[nFontId])
- DeleteObject(hFont[nFontId]);
-
- UnregisterWindowClass();
-
- FreeFileDropping();
-
- if ( hUserDll != NULL )
- FreeLibrary( hUserDll );
-}
-
-
+ { LPGENT("Standard contacts") },
+ { LPGENT("Online contacts to whom you have a different visibility") },
+ { LPGENT("Offline contacts") },
+ { LPGENT("Offline contacts to whom you have a different visibility") },
+ { LPGENT("Contacts which are 'not on list'") }
+};
///////////////////////////////////////////////////////
// Hooked events
-static int OnModulesLoded( WPARAM wParam, LPARAM lParam )
-{
- HookEvent( ME_CLIST_CONTACTICONCHANGED, OnContactIconChanged );
- HookEvent( ME_SKIN_ICONSCHANGED, OnSkinIconsChanged );
- HookEvent( ME_CLUI_CONTACTDRAGGING, OnContactDrag );
- HookEvent( ME_CLUI_CONTACTDROPPED, OnContactDrop );
- HookEvent( ME_CLUI_CONTACTDRAGSTOP, OnContactDragStop );
- HookEvent( ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged );
- HookEvent( ME_DB_CONTACT_DELETED, OnContactDeleted );
- HookEvent( ME_OPT_INITIALISE, OnOptionsInitialize );
- HookEvent( ME_CLIST_STATUSMODECHANGE, OnStatusModeChange );
- HookEvent( ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu );
-
- hwndMiranda = (HWND)CallService( MS_CLUI_GETHWND, 0, 0 );
- mir_subclassWindow(hwndMiranda, newMirandaWndProc);
-
- // No thumbs yet
- bEnableTip = ServiceExists("mToolTip/ShowTip");
-
- RegisterWindowClass();
- InitFileDropping();
- GetScreenRect();
- LoadDBSettings();
- CreateBackgroundBrush();
- CreateThumbsFont();
- LoadContacts();
- LoadMenus();
-
- if (fcOpt.bToTop){
- fcOpt.ToTopTime = (fcOpt.ToTopTime<1)?1:fcOpt.ToTopTime;
- fcOpt.ToTopTime = (fcOpt.ToTopTime>TOTOPTIME_MAX)?TOTOPTIME_MAX:fcOpt.ToTopTime;
- ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
- }
- return( 0 );
-}
-
static int OnContactDeleted( WPARAM wParam, LPARAM lParam )
{
@@ -272,11 +158,10 @@ static int OnContactDeleted( WPARAM wParam, LPARAM lParam ) static int OnContactIconChanged( WPARAM wParam, LPARAM lParam )
{
- HANDLE hContact = ( HANDLE )wParam;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
+ HANDLE hContact = ( HANDLE )wParam;
+ ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
- if ( pThumb )
- {
+ if ( pThumb ) {
pThumb->RefreshContactIcon( ( int )lParam );
//pThumb->ThumbSelect( FALSE );
//SetTimer( pThumb->hwnd, TIMERID_SELECT_T, 1000, NULL );
@@ -384,7 +269,7 @@ static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam ) if ( hContact == NULL )
{
- if (( 0 == _stricmp( pdbcws->szModule, "CLC" )) || ( 0 == _stricmp( pdbcws->szModule, sModule )) ) {
+ if (( 0 == _stricmp( pdbcws->szModule, "CLC" )) || ( 0 == _stricmp( pdbcws->szModule, MODULE )) ) {
LoadDBSettings();
ApplyOptionsChanges();
}
@@ -469,26 +354,26 @@ static int OnPrebuildContactMenu( WPARAM wParam, LPARAM lParam ) static void LoadDBSettings()
{
- fcOpt.thumbAlpha = (BYTE)((double)DBGetContactSettingByte( NULL, sModule, "Opacity", 100 ) * 2.55 );
- fcOpt.bHideOffline = (BOOL)DBGetContactSettingByte( NULL, sModule, "HideOffline", 0 );
- fcOpt.bHideAll = (BOOL)DBGetContactSettingByte( NULL, sModule, "HideAll", 0 );
- fcOpt.bHideWhenFullscreen = (BOOL)DBGetContactSettingByte( NULL, sModule, "HideWhenFullscreen", 0 );
- fcOpt.bMoveTogether = (BOOL)DBGetContactSettingByte( NULL, sModule, "MoveTogether", 0 );
- fcOpt.bFixedWidth = (BOOL)DBGetContactSettingByte( NULL, sModule, "FixedWidth", 0 );
- fcOpt.nThumbWidth = (DWORD)DBGetContactSettingDword( NULL, sModule, "Width", 0 );
- dwOfflineModes = DBGetContactSettingDword( NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES );
- fcOpt.bShowTip = (BOOL)DBGetContactSettingByte( NULL, sModule, "ShowTip", 1 );
- fcOpt.TimeIn = (WORD)DBGetContactSettingWord( NULL, sModule, "TimeIn", 0 );
- fcOpt.bToTop = (BOOL)DBGetContactSettingByte( NULL, sModule, "ToTop", 0 );
- fcOpt.ToTopTime = (WORD)DBGetContactSettingWord( NULL, sModule, "ToTopTime", TOTOPTIME_DEF );
- fcOpt.bHideWhenCListShow = (BOOL)DBGetContactSettingByte( NULL, sModule, "HideWhenCListShow", 0 );
- fcOpt.bUseSingleClick = (BOOL)DBGetContactSettingByte( NULL, sModule, "UseSingleClick", 0 );
- fcOpt.bShowIdle = (BOOL)DBGetContactSettingByte( NULL, sModule, "ShowIdle", 0 );
-
- if (DBGetContactSettingByte(NULL, "ModernData", "HideBehind", 0))
- bIsCListShow = (DBGetContactSettingByte(NULL, "ModernData", "BehindEdge", 0) == 0);
+ fcOpt.thumbAlpha = (BYTE)((double)db_get_b( NULL, MODULE, "Opacity", 100 ) * 2.55 );
+ fcOpt.bHideOffline = (BOOL)db_get_b( NULL, MODULE, "HideOffline", 0 );
+ fcOpt.bHideAll = (BOOL)db_get_b( NULL, MODULE, "HideAll", 0 );
+ fcOpt.bHideWhenFullscreen = (BOOL)db_get_b( NULL, MODULE, "HideWhenFullscreen", 0 );
+ fcOpt.bMoveTogether = (BOOL)db_get_b( NULL, MODULE, "MoveTogether", 0 );
+ fcOpt.bFixedWidth = (BOOL)db_get_b( NULL, MODULE, "FixedWidth", 0 );
+ fcOpt.nThumbWidth = (DWORD)db_get_dw( NULL, MODULE, "Width", 0 );
+ dwOfflineModes = db_get_dw( NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES );
+ fcOpt.bShowTip = (BOOL)db_get_b( NULL, MODULE, "ShowTip", 1 );
+ fcOpt.TimeIn = (WORD)db_get_w( NULL, MODULE, "TimeIn", 0 );
+ fcOpt.bToTop = (BOOL)db_get_b( NULL, MODULE, "ToTop", 0 );
+ fcOpt.ToTopTime = (WORD)db_get_w( NULL, MODULE, "ToTopTime", TOTOPTIME_DEF );
+ fcOpt.bHideWhenCListShow = (BOOL)db_get_b( NULL, MODULE, "HideWhenCListShow", 0 );
+ fcOpt.bUseSingleClick = (BOOL)db_get_b( NULL, MODULE, "UseSingleClick", 0 );
+ fcOpt.bShowIdle = (BOOL)db_get_b( NULL, MODULE, "ShowIdle", 0 );
+
+ if (db_get_b(NULL, "ModernData", "HideBehind", 0))
+ bIsCListShow = (db_get_b(NULL, "ModernData", "BehindEdge", 0) == 0);
else
- bIsCListShow = (DBGetContactSettingByte(NULL, "CList", "State", 0) == 2);
+ bIsCListShow = (db_get_b(NULL, "CList", "State", 0) == 2);
}
void SendMsgDialog( HWND hwnd, TCHAR *pText )
@@ -587,7 +472,7 @@ static LRESULT __stdcall CommWndProc( HWND hwnd, case WM_LBUTTONUP:
if (pThumb) pThumb->OnLButtonUp();
- //if (bMouseMoved || !DBGetContactSettingByte(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT))
+ //if (bMouseMoved || !db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT))
break;
// FALL THRU
@@ -668,7 +553,7 @@ void ApplyOptionsChanges() CreateThumbsFont();
CreateBackgroundBrush();
-// dwOfflineModes = DBGetContactSettingDword( NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES );
+// dwOfflineModes = db_get_dw( NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES );
if (!fcOpt.bToTop && ToTopTimerID){
KillTimer(NULL, ToTopTimerID);
ToTopTimerID = 0;
@@ -720,139 +605,92 @@ static void UnregisterWindowClass() UnregisterClass( WND_CLASS, hInst );
}
-
-
-static void CreateThumbWnd( TCHAR *ptszName, HANDLE hContact, int nX, int nY )
+static void CreateThumbWnd(TCHAR *ptszName, HANDLE hContact, int nX, int nY)
{
- HWND hwnd = NULL;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
+ ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
+ if (pThumb != NULL)
+ return;
// Prepare for window creation
- if ( pThumb == NULL )
- {
- hwnd = CreateWindowEx( WS_EX_TOOLWINDOW | WS_EX_TOPMOST,
- WND_CLASS,
- ptszName,
- WS_POPUP,
- nX,
- nY,
- 50,
- 20,
- NULL /*hwndMiranda*/,
- NULL,
- hInst,
- NULL
- );
-
- if ( hwnd != NULL )
- {
- pThumb = thumbList.AddThumb( hwnd, ptszName, hContact );
- SetWindowLongPtr( hwnd, GWLP_USERDATA, (long)pThumb );
- pThumb->ResizeThumb();
-
- pThumb->SetThumbOpacity( fcOpt.thumbAlpha );
- ShowWindow( hwnd, ( fcOpt.bHideAll || HideOnFullScreen() || fcOpt.bHideOffline || (fcOpt.bHideWhenCListShow && bIsCListShow))? SW_HIDE : SW_SHOWNA );
- pThumb->PositionThumb( (short)nX, (short)nY );
-
- // force repaint
- pThumb->UpdateContent();
- }
- }
-}
-
-
+ HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, WND_CLASS, ptszName,
+ WS_POPUP, nX, nY, 50, 20, NULL, NULL, hInst, NULL);
+ if (hwnd == NULL)
+ return;
-static BOOL GetOSPlatform()
-{
- OSVERSIONINFO VersionInfo;
+ pThumb = thumbList.AddThumb( hwnd, ptszName, hContact );
+ SetWindowLongPtr( hwnd, GWLP_USERDATA, (long)pThumb );
+ pThumb->ResizeThumb();
- // Get OS platform
- ZeroMemory( &VersionInfo, sizeof( VersionInfo ));
- VersionInfo.dwOSVersionInfoSize = sizeof( VersionInfo );
+ pThumb->SetThumbOpacity( fcOpt.thumbAlpha );
+ ShowWindow( hwnd, ( fcOpt.bHideAll || HideOnFullScreen() || fcOpt.bHideOffline || (fcOpt.bHideWhenCListShow && bIsCListShow))? SW_HIDE : SW_SHOWNA );
+ pThumb->PositionThumb( (short)nX, (short)nY );
- GetVersionEx( &VersionInfo );
- return( VersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT );
+ // force repaint
+ pThumb->UpdateContent();
}
-
-
static void CreateThumbsFont()
{
- int nFontId;
- LOGFONTA lf;
-
- for (nFontId = 0; nFontId < FLT_FONTIDS; nFontId++)
- {
- if (NULL != hFont[nFontId])
- {
+ for (int nFontId = 0; nFontId < FLT_FONTIDS; nFontId++) {
+ if (NULL != hFont[nFontId]) {
DeleteObject(hFont[nFontId]);
hFont[nFontId] = NULL;
}
- GetFontSetting(TRUE, nFontId, &lf, &tColor[nFontId]);
- {
- LONG height;
- HDC hdc = GetDC(NULL);
- height = lf.lfHeight;
- lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- ReleaseDC(NULL, hdc);
- hFont[nFontId] = CreateFontIndirectA(&lf);
-
- lf.lfHeight = height;
- }
- }
-}
+ LOGFONT lf;
+ FontService_GetFont( LPGENT("Floating contacts"), s_fonts[nFontId], &tColor[nFontId], &lf);
+ HDC hdc = GetDC(NULL);
+ LONG height = lf.lfHeight;
+ lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
+ ReleaseDC(NULL, hdc);
+ hFont[nFontId] = CreateFontIndirect(&lf);
+ lf.lfHeight = height;
+ }
+}
+
static void CreateBackgroundBrush()
{
-// LOGBRUSH lb;
- bkColor = DBGetContactSettingDword(NULL, sModule, "BkColor", FLT_DEFAULT_BKGNDCOLOR);
-
+ bkColor = db_get_dw(NULL, MODULE, "BkColor", FLT_DEFAULT_BKGNDCOLOR);
- if (NULL != hLTEdgesPen)
- {
+ if (NULL != hLTEdgesPen) {
DeleteObject(hLTEdgesPen);
hLTEdgesPen = NULL;
}
- if (NULL != hRBEdgesPen)
- {
+
+ if (NULL != hRBEdgesPen) {
DeleteObject(hRBEdgesPen);
hRBEdgesPen = NULL;
}
- if (NULL != hBmpBackground)
- {
+
+ if (NULL != hBmpBackground) {
DeleteObject(hBmpBackground);
hBmpBackground = NULL;
}
- if (NULL != hBkBrush)
- {
+
+ if (NULL != hBkBrush) {
SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL);
DeleteObject( hBkBrush );
hBkBrush = NULL;
}
- if (DBGetContactSettingByte(NULL, sModule, "DrawBorder", FLT_DEFAULT_DRAWBORDER))
- {
- COLORREF cr;
-
- cr = (COLORREF)DBGetContactSettingDword(NULL, sModule, "LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR);
+ if ( db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER)) {
+ COLORREF cr = (COLORREF)db_get_dw(NULL, MODULE, "LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR);
hLTEdgesPen = CreatePen(PS_SOLID, 1, cr);
- cr = (COLORREF)DBGetContactSettingDword(NULL, sModule, "RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR);
+ cr = (COLORREF)db_get_dw(NULL, MODULE, "RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR);
hRBEdgesPen = CreatePen(PS_SOLID, 1, cr);
}
- if (DBGetContactSettingByte(NULL, sModule, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP))
- {
+
+ if (db_get_b(NULL, MODULE, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP)) {
DBVARIANT dbv;
-
- if (!DBGetContactSetting(NULL, sModule, "BkBitmap", &dbv))
- {
- hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
- DBFreeVariant(&dbv);
+ if ( !DBGetContactSettingTString(NULL, MODULE, "BkBitmap", &dbv)) {
+ hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal);
+ db_free(&dbv);
}
}
- nBackgroundBmpUse = (WORD)DBGetContactSettingWord(NULL, sModule, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
+ nBackgroundBmpUse = (WORD)db_get_w(NULL, MODULE, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
// Create brush
hBkBrush = CreateSolidBrush(bkColor);
@@ -861,27 +699,18 @@ static void CreateBackgroundBrush() SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)hBkBrush);
}
-
static int GetContactStatus( HANDLE hContact )
{
- char *szProto = NULL;
- int idStatus = ID_STATUS_OFFLINE;
-
- if ( hContact == NULL )
- {
+ if (hContact == NULL) {
assert( !"Contact is NULL" );
- return( 0 );
- }
-
- szProto = ( char* )CallService( "Proto/GetContactBaseProto", (WPARAM)hContact, 0 );
-
- if ( NULL != szProto )
- {
- idStatus = DBGetContactSettingWord( hContact, szProto, "Status", ID_STATUS_OFFLINE );
+ return 0;
}
+ char *szProto = GetContactProto(hContact);
+ if (szProto == NULL)
+ return ID_STATUS_OFFLINE;
- return( idStatus );
+ return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
}
@@ -907,46 +736,30 @@ BOOL IsStatusVisible( int status ) return ( 0 == ( dwOfflineModes & ClcStatusToPf2( status )) );
}
-
-
void RegHotkey( HANDLE hContact, HWND hwnd )
{
char szBuf[ MAX_PATH ] = {0};
-/* char szPath[ MAX_PATH ] = {0};
- GetModuleFileName( NULL, szPath, MAX_PATH );
- PathRemoveFileSpec( szPath );
- strcat( szPath, "\\Thumbs.ini" );
- GetPrivateProfileString( "Hotkeys", szName, "", szBuf, MAX_PATH - 1, szPath );*/
DBVARIANT dbv;
- if (DBGetContactSettingString ( hContact, sModule, "Hotkey", &dbv)) return;
+ if (DBGetContactSettingString(hContact, MODULE, "Hotkey", &dbv)) return;
strncpy(szBuf, dbv.pszVal, MAX_PATH - 1);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
- if ( 0 != strlen( szBuf ))
- {
- UINT nModifiers = 0;
- char chKey = 0;
- char szMod[ 2 ][ 20 ] = {0};
- char szKey[ 20 ] = {0};
- int i = 0;
+ if ( 0 != strlen( szBuf )) {
+ UINT nModifiers = 0;
+ char chKey = 0;
+ char szMod[2][20] = {0};
+ char szKey[20] = {0};
- sscanf( szBuf, "%[^'+']+%[^'+']+%[^'+']", szMod[ 0 ], szMod[ 1 ], szKey );
+ sscanf( szBuf, "%[^'+']+%[^'+']+%[^'+']", szMod[0], szMod[1], szKey );
- for ( i = 0; i < 2; ++i )
- {
+ for (int i=0; i < 2; i++) {
if ( 0 == strncmp( szMod[ i ], "ALT", 19 ))
- {
nModifiers = nModifiers | MOD_ALT;
- }
else if ( 0 == strncmp( szMod[ i ], "CTRL", 19 ))
- {
nModifiers = nModifiers | MOD_CONTROL;
- }
else if ( 0 == strncmp( szMod[ i ], "SHIFT", 19 ))
- {
nModifiers = nModifiers | MOD_SHIFT;
- }
}
chKey = szKey[ 0 ];
@@ -971,7 +784,7 @@ void SaveContactsPos() thumbList[i]->GetThumbRect( &rc );
if ( 0 == GetLastError())
- DBWriteContactSettingDword( thumbList[i]->hContact, sModule, "ThumbsPos", DB_POS_MAKE_XY(rc.left, rc.top));
+ db_set_dw( thumbList[i]->hContact, MODULE, "ThumbsPos", DB_POS_MAKE_XY(rc.left, rc.top));
}
}
@@ -985,51 +798,83 @@ static void LoadContacts() }
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Menus
+
+static INT_PTR OnMainMenu_HideAll( WPARAM wParam, LPARAM lParam )
+{
+ fcOpt.bHideAll = !fcOpt.bHideAll;
+ db_set_b(NULL, MODULE, "HideAll", (BYTE)fcOpt.bHideAll);
+ OnStatusChanged();
+
+ CLISTMENUITEM clmi = { sizeof(clmi) };
+ clmi.flags = CMIM_NAME | CMIM_ICON|CMIF_TCHAR;
+ clmi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE ));
+ clmi.ptszName = fcOpt.bHideAll ? LPGENT("Show all thumbs") : LPGENT("Hide all thumbs");
+ CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMainMenuItemHideAll, ( LPARAM )&clmi );
+ return 0;
+}
+
+static INT_PTR OnContactMenu_Remove( WPARAM wParam, LPARAM lParam )
+{
+ HANDLE hContact = ( HANDLE )wParam;
+ ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
+
+ if (pThumb) {
+ pThumb->DeleteContactPos();
+ thumbList.RemoveThumb(pThumb);
+ }
+ DestroyMenu( hContactMenu );
+ return 0;
+}
+static INT_PTR OnHotKey_HideWhenCListShow( WPARAM wParam, LPARAM lParam )
+{
+ fcOpt.bHideWhenCListShow = !fcOpt.bHideWhenCListShow;
+ db_set_b(NULL, MODULE, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
+ OnStatusChanged();
+ return 0;
+}
static void LoadMenus()
{
// Remove thumb menu item
- hRemoveThumb = CreateServiceFunction( sModule "/RemoveThumb", OnContactMenu_Remove );
+ CreateServiceFunction(MODULE "/RemoveThumb", OnContactMenu_Remove);
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 0xFFFFF;
mi.flags = CMIF_TCHAR;
- mi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( IDI_HIDE ));
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_HIDE));
mi.ptszName = LPGENT("Remove thumb");
- mi.pszService = sModule "/RemoveThumb";
+ mi.pszService = MODULE "/RemoveThumb";
hMenuItemRemove = Menu_AddContactMenuItem(&mi);
// Hide all thumbs main menu item
- hMainHideAllThumbs = CreateServiceFunction( sModule "/MainHideAllThumbs", OnMainMenu_HideAll );
- ZeroMemory( &mi, sizeof( mi ));
+ CreateServiceFunction(MODULE "/MainHideAllThumbs", OnMainMenu_HideAll );
- mi.cbSize = sizeof( mi );
- mi.position = 0xFFFFF;
- mi.flags = CMIF_TCHAR;
mi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE ));
mi.ptszName = fcOpt.bHideAll ? LPGENT("Show all thumbs") : LPGENT("Hide all thumbs");
- mi.pszService = sModule "/MainHideAllThumbs";
+ mi.pszService = MODULE "/MainHideAllThumbs";
Menu_AddMainMenuItem(&mi);
// Register hotkeys
- HOTKEYDESC hkd = {0};
- hkd.cbSize = sizeof(hkd);
+ HOTKEYDESC hkd = { sizeof(hkd) };
hkd.pszSection = "Floating Contacts";
- hkd.pszName = sModule "/MainHideAllThumbs";
+ hkd.pszName = MODULE "/MainHideAllThumbs";
hkd.pszDescription = LPGEN("Show/Hide all thumbs");
- hkd.pszService = sModule "/MainHideAllThumbs";
+ hkd.pszService = MODULE "/MainHideAllThumbs";
Hotkey_Register(&hkd);
- hHideWhenCListShow = CreateServiceFunction( sModule "/HideWhenCListShow", OnHotKey_HideWhenCListShow );
- hkd.pszName = sModule "/HideWhenCListShow";
+ CreateServiceFunction(MODULE "/HideWhenCListShow", OnHotKey_HideWhenCListShow );
+ hkd.pszName = MODULE "/HideWhenCListShow";
hkd.pszDescription = LPGEN("Hide when contact list is shown");
- hkd.pszService = sModule "/HideWhenCListShow";
+ hkd.pszService = MODULE "/HideWhenCListShow";
Hotkey_Register(&hkd);
}
+/////////////////////////////////////////////////////////////////////////////////////////
static void LoadContact( HANDLE hContact )
{
@@ -1041,7 +886,7 @@ static void LoadContact( HANDLE hContact ) if ( hContact == NULL ) return;
- dwPos = DBGetContactSettingDword( hContact, sModule, "ThumbsPos", (DWORD)-1 );
+ dwPos = db_get_dw( hContact, MODULE, "ThumbsPos", (DWORD)-1 );
if ( dwPos != -1 )
{
@@ -1090,44 +935,6 @@ BOOL HideOnFullScreen() return bFullscreen && fcOpt.bHideWhenFullscreen;
}
-
-static INT_PTR OnContactMenu_Remove( WPARAM wParam, LPARAM lParam )
-{
- HANDLE hContact = ( HANDLE )wParam;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
-
- if (pThumb) {
- pThumb->DeleteContactPos();
- thumbList.RemoveThumb(pThumb);
- }
-
- DestroyMenu( hContactMenu );
- return 0;
-}
-
-static INT_PTR OnHotKey_HideWhenCListShow( WPARAM wParam, LPARAM lParam )
-{
- fcOpt.bHideWhenCListShow = !fcOpt.bHideWhenCListShow;
- DBWriteContactSettingByte(NULL, sModule, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
- OnStatusChanged();
- return 0;
-}
-
-
-static INT_PTR OnMainMenu_HideAll( WPARAM wParam, LPARAM lParam )
-{
- fcOpt.bHideAll = !fcOpt.bHideAll;
- DBWriteContactSettingByte(NULL, sModule, "HideAll", (BYTE)fcOpt.bHideAll);
- OnStatusChanged();
-
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_NAME | CMIM_ICON|CMIF_TCHAR;
- clmi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE ));
- clmi.ptszName = fcOpt.bHideAll ? LPGENT("Show all thumbs") : LPGENT("Hide all thumbs");
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMainMenuItemHideAll, ( LPARAM )&clmi );
- return 0;
-}
-
static VOID CALLBACK ToTopTimerProc ( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
for (int i = 0; i < thumbList.getCount(); ++i)
@@ -1173,9 +980,9 @@ static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, HideThumbsOnShowCList();
}
else if (!(wp->flags&SWP_NOMOVE)) {
- BYTE method = DBGetContactSettingByte(NULL, "ModernData", "HideBehind", 0);
+ BYTE method = db_get_b(NULL, "ModernData", "HideBehind", 0);
if (method) {
- WORD wBehindEdgeBorderSize = DBGetContactSettingWord(NULL, "ModernData", "HideBehindBorderSize", 0);
+ WORD wBehindEdgeBorderSize = db_get_w(NULL, "ModernData", "HideBehindBorderSize", 0);
RECT rc = {wp->x, wp->y, wp->x+wp->cx, wp->y+wp->cy};
RECT rcScreen = {wBehindEdgeBorderSize*(2-method), 0, GetSystemMetrics(SM_CXSCREEN)-wBehindEdgeBorderSize*(method-1), GetSystemMetrics(SM_CYSCREEN)};
RECT rcOverlap;
@@ -1195,3 +1002,106 @@ static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, }
return mir_callNextSubclass(hwnd, newMirandaWndProc, uMsg, wParam, lParam);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static int OnModulesLoded( WPARAM wParam, LPARAM lParam )
+{
+ HookEvent(ME_CLIST_CONTACTICONCHANGED, OnContactIconChanged);
+ HookEvent(ME_SKIN_ICONSCHANGED, OnSkinIconsChanged);
+ HookEvent(ME_CLUI_CONTACTDRAGGING, OnContactDrag);
+ HookEvent(ME_CLUI_CONTACTDROPPED, OnContactDrop);
+ HookEvent(ME_CLUI_CONTACTDRAGSTOP, OnContactDragStop);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
+ HookEvent(ME_DB_CONTACT_DELETED, OnContactDeleted);
+ HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize);
+ HookEvent(ME_CLIST_STATUSMODECHANGE, OnStatusModeChange);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu);
+
+ hwndMiranda = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
+ mir_subclassWindow(hwndMiranda, newMirandaWndProc);
+
+ // No thumbs yet
+ bEnableTip = ServiceExists("mToolTip/ShowTip");
+
+ RegisterWindowClass();
+ InitFileDropping();
+ GetScreenRect();
+ LoadDBSettings();
+ CreateBackgroundBrush();
+ CreateThumbsFont();
+ LoadContacts();
+ LoadMenus();
+
+ if (fcOpt.bToTop){
+ fcOpt.ToTopTime = (fcOpt.ToTopTime<1)?1:fcOpt.ToTopTime;
+ fcOpt.ToTopTime = (fcOpt.ToTopTime>TOTOPTIME_MAX)?TOTOPTIME_MAX:fcOpt.ToTopTime;
+ ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
+ }
+ return( 0 );
+}
+
+extern "C" int __declspec(dllexport) Load()
+{
+ mir_getLP(&pluginInfoEx);
+
+ InitOptions();
+
+ for (int i=0; i < SIZEOF(s_fonts); i++) {
+ LOGFONT lf;
+ SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, FALSE);
+ if (i == FLT_FONTID_OFFINVIS || i == FLT_FONTID_INVIS)
+ lf.lfItalic = !lf.lfItalic;
+
+ COLORREF defColor = GetSysColor((i == FLT_FONTID_NOTONLIST) ? COLOR_3DSHADOW : COLOR_WINDOWTEXT);
+
+ char szId[20];
+ mir_snprintf(szId, SIZEOF(szId), "Font%d", i);
+ FontService_RegisterFont(MODULE, szId, LPGENT("Floating contacts"), s_fonts[i], i+1, false, &lf, defColor);
+ }
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoded);
+
+ HMODULE hUserDll = GetModuleHandleA("user32.dll");
+ if (hUserDll) {
+ pSetLayeredWindowAttributes =
+ (BOOL (WINAPI *)(HWND, COLORREF, BYTE, DWORD))
+ GetProcAddress(hUserDll, "SetLayeredWindowAttributes");
+ pUpdateLayeredWindow =
+ (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD))
+ GetProcAddress(hUserDll, "UpdateLayeredWindow");
+ }
+ else {
+ pSetLayeredWindowAttributes = NULL;
+ pUpdateLayeredWindow = NULL;
+ }
+
+ fnSHAutoComplete = (pfnSHAutoComplete)GetProcAddress(GetModuleHandle(_T("shlwapi")), "SHAutoComplete");
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" int __declspec(dllexport) Unload()
+{
+ if (hLTEdgesPen)
+ DeleteObject(hLTEdgesPen);
+ if (hRBEdgesPen)
+ DeleteObject(hRBEdgesPen);
+ if (hBmpBackground)
+ DeleteObject(hBmpBackground);
+ if (hBkBrush) {
+ SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL);
+ DeleteObject(hBkBrush);
+ hBkBrush = NULL;
+ }
+
+ for (int nFontId = 0; nFontId < FLT_FONTIDS; nFontId++)
+ if (NULL != hFont[nFontId])
+ DeleteObject(hFont[nFontId]);
+
+ UnregisterWindowClass();
+
+ FreeFileDropping();
+ return 0;
+}
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index b794b79156..7525300237 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -1,1168 +1,327 @@ #include "stdhdr.h"
-/////////////////////////////////////////////////////////////////////////////
-//
-
-#define SAMEASF_FACE 1
-#define SAMEASF_SIZE 2
-#define SAMEASF_STYLE 4
-#define SAMEASF_COLOUR 8
-
-typedef struct _SFontSettings
-{
- BYTE sameAsFlags,sameAs;
- COLORREF colour;
- char size;
- BYTE style;
- BYTE charset;
- char szFace[LF_FACESIZE];
-} SFontSettings;
-
-static SFontSettings s_rgFontSettings[FLT_FONTIDS];
-static SFontSettings s_rgFontSettingsMiranda[FLT_FONTIDS];
-
-#define FLT_SAME_AS_NONE ((BYTE)0xFF)
-#define FLT_SAME_AS_MIRANDA ((BYTE)0xFE)
-
-static char* s_rgszFontSizes[] = {"8","10","14","16","18","20","24","28"};
-
-static const TCHAR* s_rgszFontIdDescr[FLT_FONTIDS] =
-{
- LPGENT("Standard contacts"),
- LPGENT("Online contacts to whom you have a different visibility"),
- LPGENT("Offline contacts"),
- LPGENT("Offline contacts to whom you have a different visibility"),
- LPGENT("Contacts which are 'not on list'"),
-};
-
-static WORD s_rgwFontSameAsDefault[FLT_FONTIDS] =
-{
- MAKEWORD(FLT_SAME_AS_MIRANDA, 0x0F),
- MAKEWORD(FLT_SAME_AS_MIRANDA, 0x0F),
- MAKEWORD(FLT_SAME_AS_MIRANDA, 0x0F),
- MAKEWORD(FLT_SAME_AS_MIRANDA, 0x0F),
- MAKEWORD(FLT_SAME_AS_MIRANDA, 0x0F),
-};
-
-static int s_rgnMirandaFontId[FLT_FONTIDS] =
-{
- FONTID_CONTACTS,
- FONTID_INVIS,
- FONTID_OFFLINE,
- FONTID_OFFINVIS,
- FONTID_NOTONLIST
-};
-
-#define M_REBUILDFONTGROUP (WM_USER + 10)
-#define M_REMAKESAMPLE (WM_USER + 11)
-#define M_RECALCONEFONT (WM_USER + 12)
-#define M_RECALCOTHERFONTS (WM_USER + 13)
-#define M_SAVEFONT (WM_USER + 14)
-#define M_REFRESHSAMEASBOXES (WM_USER + 15)
-#define M_FILLSCRIPTCOMBO (WM_USER + 16)
-#define M_LOADFONT (WM_USER + 17)
#define M_GUESSSAMEASBOXES (WM_USER + 18)
-#define M_SETSAMEASBOXES (WM_USER + 19)
#define M_REFRESHBKGBOXES (WM_USER + 20)
#define M_REFRESHBORDERPICKERS (WM_USER + 21)
-/////////////////////////////////////////////////////////////////////////////
-//
-
-static
-INT_PTR
-APIENTRY
-OptWndProc
- ( IN HWND hwndDlg
- , IN UINT uMsg
- , IN WPARAM wParam
- , IN LPARAM lParam
- );
+/////////////////////////////////////////////////////////////////////////////////////////
-static
-INT_PTR
-APIENTRY
-OptSknWndProc
- ( IN HWND hwndDlg
- , IN UINT uMsg
- , IN WPARAM wParam
- , IN LPARAM lParam
- );
-
-/////////////////////////////////////////////////////////////////////////////
-//
-
-int
-OnOptionsInitialize
- ( IN WPARAM wParam
- , IN LPARAM lParam
- )
+static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.cbSize = sizeof(odp);
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FLTCONT);
- odp.pszTitle = LPGEN("Floating Contacts");
- odp.pszGroup = LPGEN("Contact List");
- odp.pszTab = LPGEN("Main Features");
- odp.flags = ODPF_BOLDGROUPS;
- odp.pfnDlgProc = OptWndProc;
- Options_AddPage(wParam, &odp);
+ switch ( uMsg ) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN);
- odp.pszTab = LPGEN("Appearance");
- odp.pfnDlgProc = OptSknWndProc;
- Options_AddPage(wParam, &odp);
+ // Properties
+ CheckDlgButton(hwndDlg, IDC_CHK_HIDE_OFFLINE, (fcOpt.bHideOffline ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_CHK_HIDE_ALL, (fcOpt.bHideAll ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_CHK_HIDE_WHEN_FULSCREEN, (fcOpt.bHideWhenFullscreen ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_CHK_STICK, (fcOpt.bMoveTogether ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_CHK_WIDTH, (fcOpt.bFixedWidth ? BST_CHECKED : BST_UNCHECKED));
- return 0;
-}
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_WIDTH), fcOpt.bFixedWidth);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_WIDTH), fcOpt.bFixedWidth);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_WIDTHSPIN), fcOpt.bFixedWidth);
-static
-int
-CALLBACK
-EnumFontsProc
- ( IN ENUMLOGFONTEXA* lpelfe
- , IN NEWTEXTMETRICEXA* lpntme
- , IN int FontType
- , IN LPARAM lParam
- )
-{
- if (IsWindow((HWND)lParam))
- {
- if (CB_ERR == SendMessageA((HWND)lParam, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)lpelfe->elfLogFont.lfFaceName))
- SendMessageA((HWND)lParam, CB_ADDSTRING, 0, (LPARAM)lpelfe->elfLogFont.lfFaceName);
- return TRUE;
- }
- return FALSE;
-}
+ SendDlgItemMessage(hwndDlg, IDC_WIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(255,0));
+ SendDlgItemMessage(hwndDlg, IDC_WIDTHSPIN, UDM_SETPOS, 0, fcOpt.nThumbWidth);
-void
-FillFontListThread
- ( IN HWND hwndDlg
- )
-{
- LOGFONTA lf = {0};
- HDC hdc = GetDC(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_CHK_TIP, (fcOpt.bShowTip ? BST_CHECKED : BST_UNCHECKED));
- lf.lfCharSet = DEFAULT_CHARSET;
- lf.lfFaceName[0] = 0;
- lf.lfPitchAndFamily = 0;
- EnumFontFamiliesExA(hdc, &lf, (FONTENUMPROCA)EnumFontsProc, (LPARAM)GetDlgItem(hwndDlg,IDC_TYPEFACE), 0);
- ReleaseDC(hwndDlg, hdc);
- return;
-}
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_TIP), bEnableTip);
-static
-int
-CALLBACK
-EnumFontScriptsProc
- ( IN ENUMLOGFONTEX* lpelfe
- , IN NEWTEXTMETRICEX* lpntme
- , IN int FontType
- , IN LPARAM lParam
- )
-{
- if (CB_ERR == SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)lpelfe->elfScript))
- {
- int i = SendMessage((HWND)lParam, CB_ADDSTRING, 0, (LPARAM)lpelfe->elfScript);
- SendMessage((HWND)lParam, CB_SETITEMDATA, i, lpelfe->elfLogFont.lfCharSet);
- }
- return TRUE;
-}
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN), bEnableTip && fcOpt.bShowTip);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN_CMT), bEnableTip && fcOpt.bShowTip);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TIMEIN), bEnableTip && fcOpt.bShowTip);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TIMEINSPIN), bEnableTip && fcOpt.bShowTip);
-static
-void
-GetDefaultFontSetting
- ( IN BOOL bFltContacts
- , IN int nFontId
- , IN LOGFONTA* lf
- , IN COLORREF* colour
- )
-{
- SystemParametersInfoA(SPI_GETICONTITLELOGFONT, sizeof(LOGFONTA), lf, FALSE);
- *colour = GetSysColor(COLOR_WINDOWTEXT);
- if (bFltContacts)
- {
- switch (nFontId)
- {
- case FLT_FONTID_OFFINVIS:
- case FLT_FONTID_INVIS:
- lf->lfItalic = !lf->lfItalic;
- break;
+ SendDlgItemMessage(hwndDlg, IDC_TIMEINSPIN, UDM_SETRANGE, 0, MAKELONG(5000,0));
+ SendDlgItemMessage(hwndDlg, IDC_TIMEINSPIN, UDM_SETPOS, 0, fcOpt.TimeIn);
- case FLT_FONTID_NOTONLIST:
- *colour = GetSysColor(COLOR_3DSHADOW);
- break;
- }
- }
- else
- {
- switch (s_rgnMirandaFontId[nFontId])
- {
- case FONTID_OFFINVIS:
- case FONTID_INVIS:
- lf->lfItalic = !lf->lfItalic;
- break;
+ CheckDlgButton(hwndDlg, IDC_CHK_TOTOP, (fcOpt.bToTop ? BST_CHECKED : BST_UNCHECKED));
- case FONTID_NOTONLIST:
- *colour = GetSysColor(COLOR_3DSHADOW);
- break;
- }
- }
-}
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TOTOP), fcOpt.bToTop);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TOTOPTIME), fcOpt.bToTop);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TOTOPTIMESPIN), fcOpt.bToTop);
-void
-GetFontSetting
- ( IN BOOL bFltContacts
- , IN int nFontId
- , IN LOGFONTA* lf
- , IN COLORREF* colour
- )
-{
- DBVARIANT dbv;
- char idstr[10];
- BYTE style;
- const char* pModule = (bFltContacts ? sModule : "CLC");
-
- GetDefaultFontSetting(bFltContacts, nFontId, lf, colour);
- if (!bFltContacts)
- nFontId = s_rgnMirandaFontId[nFontId];
- wsprintfA(idstr, "Font%dName", nFontId);
- if (!DBGetContactSetting(NULL, pModule, idstr, &dbv))
- {
- lstrcpyA(lf->lfFaceName, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
-
- wsprintfA(idstr, "Font%dCol", nFontId);
- *colour = DBGetContactSettingDword(NULL, pModule, idstr, *colour);
-
- wsprintfA(idstr, "Font%dSize", nFontId);
- lf->lfHeight = (char)DBGetContactSettingByte(NULL, pModule, idstr, lf->lfHeight);
-
- wsprintfA(idstr, "Font%dSty", nFontId);
- style = (BYTE)DBGetContactSettingByte(NULL, pModule, idstr
- , (lf->lfWeight == FW_NORMAL ? 0 : DBFONTF_BOLD)
- | (lf->lfItalic ? DBFONTF_ITALIC : 0)
- | (lf->lfUnderline ? DBFONTF_UNDERLINE : 0)
- );
- lf->lfWidth = lf->lfEscapement = lf->lfOrientation = 0;
- lf->lfWeight = ((style & DBFONTF_BOLD) ? FW_BOLD : FW_NORMAL);
- lf->lfItalic = (0 != (style & DBFONTF_ITALIC));
- lf->lfUnderline = (0 != (style & DBFONTF_UNDERLINE));
- lf->lfStrikeOut = 0;
-
- wsprintfA(idstr, "Font%dSet", nFontId);
- lf->lfCharSet = (BYTE)DBGetContactSettingByte(NULL, pModule, idstr, lf->lfCharSet);
- lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
- lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lf->lfQuality = DEFAULT_QUALITY;
- lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
+ SendDlgItemMessage(hwndDlg, IDC_TOTOPTIMESPIN, UDM_SETRANGE, 0, MAKELONG(TOTOPTIME_MAX,1));
+ SendDlgItemMessage(hwndDlg, IDC_TOTOPTIMESPIN, UDM_SETPOS, 0, fcOpt.ToTopTime);
- if (bFltContacts)
- {
- WORD wSameAs;
- BYTE bySameAs;
- BYTE bySameAsFlags;
+ CheckDlgButton(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW, (fcOpt.bHideWhenCListShow ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_CHK_SINGLECLK, (fcOpt.bUseSingleClick ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_CHK_SHOWIDLE, (fcOpt.bShowIdle ? BST_CHECKED : BST_UNCHECKED));
- wsprintfA(idstr, "Font%dAs", nFontId);
- wSameAs = (WORD)DBGetContactSettingWord(NULL, sModule, idstr, s_rgwFontSameAsDefault[nFontId]);
- bySameAs = LOBYTE(wSameAs);
- bySameAsFlags = HIBYTE(wSameAs);
+ return TRUE;
- if (FLT_SAME_AS_MIRANDA == bySameAs)
- {
- LOGFONTA lfMiranda;
- COLORREF colourMiranda;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_CHK_WIDTH:
+ if (BN_CLICKED == HIWORD(wParam)) {
+ BOOL bChecked = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
- GetFontSetting(FALSE, nFontId, &lfMiranda, &colourMiranda);
- if (bySameAsFlags & SAMEASF_FACE)
- {
- lstrcpyA(lf->lfFaceName, lfMiranda.lfFaceName);
- lf->lfCharSet = lfMiranda.lfCharSet;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_WIDTH ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_WIDTH ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_WIDTHSPIN), bChecked);
}
- if (bySameAsFlags & SAMEASF_SIZE)
- lf->lfHeight = lfMiranda.lfHeight;
- if (bySameAsFlags & SAMEASF_STYLE)
- {
- lf->lfWeight = lfMiranda.lfWeight;
- lf->lfItalic = lfMiranda.lfItalic;
- lf->lfUnderline = lfMiranda.lfUnderline;
- }
- if (bySameAsFlags & SAMEASF_COLOUR)
- *colour = colourMiranda;
- }
- }
-}
-
-static
-INT_PTR
-APIENTRY
-OptWndProc
- ( IN HWND hwndDlg
- , IN UINT uMsg
- , IN WPARAM wParam
- , IN LPARAM lParam
- )
-{
- switch ( uMsg )
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- // Properties
- CheckDlgButton(hwndDlg, IDC_CHK_HIDE_OFFLINE, (fcOpt.bHideOffline ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_CHK_HIDE_ALL, (fcOpt.bHideAll ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_CHK_HIDE_WHEN_FULSCREEN, (fcOpt.bHideWhenFullscreen ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_CHK_STICK, (fcOpt.bMoveTogether ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_CHK_WIDTH, (fcOpt.bFixedWidth ? BST_CHECKED : BST_UNCHECKED));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_WIDTH), fcOpt.bFixedWidth);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_WIDTH), fcOpt.bFixedWidth);
- EnableWindow(GetDlgItem(hwndDlg, IDC_WIDTHSPIN), fcOpt.bFixedWidth);
-
- SendDlgItemMessage(hwndDlg, IDC_WIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(255,0));
- SendDlgItemMessage(hwndDlg, IDC_WIDTHSPIN, UDM_SETPOS, 0, fcOpt.nThumbWidth);
-
- CheckDlgButton(hwndDlg, IDC_CHK_TIP, (fcOpt.bShowTip ? BST_CHECKED : BST_UNCHECKED));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_TIP), bEnableTip);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN), bEnableTip && fcOpt.bShowTip);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN_CMT), bEnableTip && fcOpt.bShowTip);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TIMEIN), bEnableTip && fcOpt.bShowTip);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TIMEINSPIN), bEnableTip && fcOpt.bShowTip);
-
- SendDlgItemMessage(hwndDlg, IDC_TIMEINSPIN, UDM_SETRANGE, 0, MAKELONG(5000,0));
- SendDlgItemMessage(hwndDlg, IDC_TIMEINSPIN, UDM_SETPOS, 0, fcOpt.TimeIn);
-
- CheckDlgButton(hwndDlg, IDC_CHK_TOTOP, (fcOpt.bToTop ? BST_CHECKED : BST_UNCHECKED));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TOTOP), fcOpt.bToTop);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TOTOPTIME), fcOpt.bToTop);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TOTOPTIMESPIN), fcOpt.bToTop);
+ break;
- SendDlgItemMessage(hwndDlg, IDC_TOTOPTIMESPIN, UDM_SETRANGE, 0, MAKELONG(TOTOPTIME_MAX,1));
- SendDlgItemMessage(hwndDlg, IDC_TOTOPTIMESPIN, UDM_SETPOS, 0, fcOpt.ToTopTime);
+ case IDC_TXT_TIMEIN:
+ case IDC_TXT_TOTOPTIME:
+ case IDC_TXT_WIDTH:
+ if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
+ return 0;
+ break;
- CheckDlgButton(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW, (fcOpt.bHideWhenCListShow ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_CHK_SINGLECLK, (fcOpt.bUseSingleClick ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_CHK_SHOWIDLE, (fcOpt.bShowIdle ? BST_CHECKED : BST_UNCHECKED));
+ case IDC_CHK_TIP:
+ if (BN_CLICKED == HIWORD(wParam)) {
+ BOOL bChecked = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
- return TRUE;
- }
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_CHK_WIDTH:
- {
- if (BN_CLICKED == HIWORD(wParam))
- {
- BOOL bChecked = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_WIDTH ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_WIDTH ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_WIDTHSPIN), bChecked);
- }
- break;
- }
- case IDC_TXT_WIDTH:
- {
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return 0;
- break;
- }
- case IDC_CHK_TIP:
- {
- if (BN_CLICKED == HIWORD(wParam))
- {
- BOOL bChecked = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN_CMT ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TIMEIN ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TIMEINSPIN), bChecked);
- }
- break;
- }
- case IDC_TXT_TIMEIN:
- {
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return 0;
- break;
- }
- case IDC_CHK_TOTOP:
- {
- if (BN_CLICKED == HIWORD(wParam))
- {
- BOOL bChecked = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TOTOP ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TOTOPTIME ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TOTOPTIMESPIN), bChecked);
- }
- break;
- }
- case IDC_TXT_TOTOPTIME:
- {
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return 0;
- break;
- }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN_CMT ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TIMEIN ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TIMEINSPIN), bChecked);
}
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- }
- case WM_NOTIFY:
- {
- LPNMHDR phdr = (LPNMHDR)(lParam);
-
- if (0 == phdr->idFrom)
- {
- switch (phdr->code)
- {
- case PSN_APPLY:
- {
- BOOL bSuccess = FALSE;
- fcOpt.bHideOffline = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_OFFLINE);
- DBWriteContactSettingByte(NULL, sModule, "HideOffline", (BYTE)fcOpt.bHideOffline);
-
- fcOpt.bHideAll = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_ALL);
- DBWriteContactSettingByte(NULL, sModule, "HideAll", (BYTE)fcOpt.bHideAll);
-
- fcOpt.bHideWhenFullscreen = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_FULSCREEN);
- DBWriteContactSettingByte(NULL, sModule, "HideWhenFullscreen", (BYTE)fcOpt.bHideWhenFullscreen);
-
- fcOpt.bMoveTogether = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_STICK);
- DBWriteContactSettingByte(NULL, sModule, "MoveTogether", (BYTE)fcOpt.bMoveTogether);
-
- fcOpt.bFixedWidth = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
- DBWriteContactSettingByte(NULL, sModule, "FixedWidth", (BYTE)fcOpt.bFixedWidth);
- fcOpt.nThumbWidth = GetDlgItemInt(hwndDlg, IDC_TXT_WIDTH, &bSuccess, FALSE);
- DBWriteContactSettingDword(NULL, sModule, "Width", fcOpt.nThumbWidth );
-
- if (bEnableTip)
- {
- fcOpt.bShowTip = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
- DBWriteContactSettingByte(NULL, sModule, "ShowTip", (BYTE)fcOpt.bShowTip);
- fcOpt.TimeIn = GetDlgItemInt(hwndDlg, IDC_TXT_TIMEIN, &bSuccess, FALSE);
- DBWriteContactSettingWord(NULL, sModule, "TimeIn", fcOpt.TimeIn );
- }
+ case IDC_CHK_TOTOP:
+ if (BN_CLICKED == HIWORD(wParam)) {
+ BOOL bChecked = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
- fcOpt.bToTop = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
- DBWriteContactSettingByte(NULL, sModule, "ToTop", (BYTE)fcOpt.bToTop);
- fcOpt.ToTopTime = GetDlgItemInt(hwndDlg, IDC_TXT_TOTOPTIME, &bSuccess, FALSE);
- DBWriteContactSettingWord(NULL, sModule, "ToTopTime", fcOpt.ToTopTime );
-
- fcOpt.bHideWhenCListShow = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW);
- DBWriteContactSettingByte(NULL, sModule, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
-
- fcOpt.bUseSingleClick = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_SINGLECLK);
- DBWriteContactSettingByte(NULL, sModule, "UseSingleClick", (BYTE)fcOpt.bUseSingleClick);
-
- fcOpt.bShowIdle = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWIDLE);
- DBWriteContactSettingByte(NULL, sModule, "ShowIdle", (BYTE)fcOpt.bShowIdle);
-
- ApplyOptionsChanges();
- OnStatusChanged();
- return TRUE;
- }
- }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TOTOP ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TOTOPTIME ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TOTOPTIMESPIN), bChecked);
}
break;
}
- }
- return FALSE;
-}
-
-static
-INT_PTR
-APIENTRY
-OptSknWndProc
- ( IN HWND hwndDlg
- , IN UINT uMsg
- , IN WPARAM wParam
- , IN LPARAM lParam
- )
-{
- static HFONT hFontSample;
-
- switch ( uMsg )
- {
- case WM_INITDIALOG:
- {
- BYTE btOpacity;
- char szPercent[20];
-
- TranslateDialogDefault(hwndDlg);
-
- // Border
- CheckDlgButton(hwndDlg, IDC_DRAWBORDER
- , DBGetContactSettingByte(NULL, sModule, "DrawBorder", FLT_DEFAULT_DRAWBORDER)
- ? BST_CHECKED : BST_UNCHECKED
- );
- SendMessage(hwndDlg, M_REFRESHBORDERPICKERS, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_SETDEFAULTCOLOUR, 0, FLT_DEFAULT_LTEDGESCOLOR);
- SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_SETCOLOUR, 0
- , DBGetContactSettingDword(NULL, sModule, "LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR)
- );
- SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_SETDEFAULTCOLOUR, 0, FLT_DEFAULT_RBEDGESCOLOR);
- SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_SETCOLOUR, 0
- , DBGetContactSettingDword(NULL, sModule, "RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR)
- );
-
- // Background
- CheckDlgButton(hwndDlg, IDC_CHK_WIDTH, (fcOpt.bFixedWidth ? BST_CHECKED : BST_UNCHECKED));
-
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, FLT_DEFAULT_BKGNDCOLOR);
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0
- , DBGetContactSettingDword(NULL, sModule, "BkColor", FLT_DEFAULT_BKGNDCOLOR)
- );
- CheckDlgButton(hwndDlg, IDC_BITMAP
- , DBGetContactSettingByte(NULL, sModule, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP)
- ? BST_CHECKED : BST_UNCHECKED
- );
- SendMessage(hwndDlg, M_REFRESHBKGBOXES, 0, 0);
- {
- DBVARIANT dbv;
-
- if (!DBGetContactSetting(NULL, sModule, "BkBitmap", &dbv))
- {
- SetDlgItemTextA(hwndDlg, IDC_FILENAME, dbv.pszVal);
- DBFreeVariant(&dbv);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ LPNMHDR phdr = (LPNMHDR)(lParam);
+ if (0 == phdr->idFrom) {
+ switch (phdr->code) {
+ case PSN_APPLY:
+ BOOL bSuccess = FALSE;
+
+ fcOpt.bHideOffline = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_OFFLINE);
+ db_set_b(NULL, MODULE, "HideOffline", (BYTE)fcOpt.bHideOffline);
+
+ fcOpt.bHideAll = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_ALL);
+ db_set_b(NULL, MODULE, "HideAll", (BYTE)fcOpt.bHideAll);
+
+ fcOpt.bHideWhenFullscreen = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_FULSCREEN);
+ db_set_b(NULL, MODULE, "HideWhenFullscreen", (BYTE)fcOpt.bHideWhenFullscreen);
+
+ fcOpt.bMoveTogether = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_STICK);
+ db_set_b(NULL, MODULE, "MoveTogether", (BYTE)fcOpt.bMoveTogether);
+
+ fcOpt.bFixedWidth = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
+ db_set_b(NULL, MODULE, "FixedWidth", (BYTE)fcOpt.bFixedWidth);
+ fcOpt.nThumbWidth = GetDlgItemInt(hwndDlg, IDC_TXT_WIDTH, &bSuccess, FALSE);
+ db_set_dw(NULL, MODULE, "Width", fcOpt.nThumbWidth );
+
+ if (bEnableTip) {
+ fcOpt.bShowTip = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
+ db_set_b(NULL, MODULE, "ShowTip", (BYTE)fcOpt.bShowTip);
+ fcOpt.TimeIn = GetDlgItemInt(hwndDlg, IDC_TXT_TIMEIN, &bSuccess, FALSE);
+ db_set_w(NULL, MODULE, "TimeIn", fcOpt.TimeIn );
}
- }
- {
- WORD bmpUse = (WORD)DBGetContactSettingWord(NULL, sModule, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
- CheckDlgButton(hwndDlg, IDC_STRETCHH, ((bmpUse & CLB_STRETCHH) ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_STRETCHV, ((bmpUse & CLB_STRETCHV) ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_TILEH, ((bmpUse & CLBF_TILEH) ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_TILEV, ((bmpUse & CLBF_TILEV) ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_PROPORTIONAL, ((bmpUse & CLBF_PROPORTIONAL) ? BST_CHECKED : BST_UNCHECKED));
- }
- {
- HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND,DWORD);
+ fcOpt.bToTop = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
+ db_set_b(NULL, MODULE, "ToTop", (BYTE)fcOpt.bToTop);
+ fcOpt.ToTopTime = GetDlgItemInt(hwndDlg, IDC_TXT_TOTOPTIME, &bSuccess, FALSE);
+ db_set_w(NULL, MODULE, "ToTopTime", fcOpt.ToTopTime );
- MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(GetModuleHandle(_T("shlwapi")), "SHAutoComplete");
- if (MySHAutoComplete)
- MySHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
- }
+ fcOpt.bHideWhenCListShow = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW);
+ db_set_b(NULL, MODULE, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
- // Windows 2K/XP
- btOpacity = (BYTE)DBGetContactSettingByte(NULL, sModule, "Opacity", 100);
- SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETRANGE, TRUE, MAKELONG(0, 100));
- SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETPOS, TRUE, btOpacity);
-
- wsprintfA(szPercent, "%d%%", btOpacity);
- SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
+ fcOpt.bUseSingleClick = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_SINGLECLK);
+ db_set_b(NULL, MODULE, "UseSingleClick", (BYTE)fcOpt.bUseSingleClick);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), (NULL != pSetLayeredWindowAttributes));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), (NULL != pSetLayeredWindowAttributes));
+ fcOpt.bShowIdle = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWIDLE);
+ db_set_b(NULL, MODULE, "ShowIdle", (BYTE)fcOpt.bShowIdle);
- // Fonts
- hFontSample = NULL;
- SetDlgItemText(hwndDlg, IDC_SAMPLE, TranslateT("Sample"));
- FillFontListThread(hwndDlg);
- {
- int i;
- int itemId;
- LOGFONTA lf;
- COLORREF colour;
- WORD sameAs;
- char str[32];
-
- for (i = 0; i < FLT_FONTIDS; i++)
- {
- // Floating contacts fonts
- GetFontSetting(TRUE, i, &lf, &colour);
- wsprintfA(str, "Font%dAs", i);
- sameAs = (WORD)DBGetContactSettingWord(NULL, sModule, str, s_rgwFontSameAsDefault[i]);
- s_rgFontSettings[i].sameAs = LOBYTE(sameAs);
- s_rgFontSettings[i].sameAsFlags = HIBYTE(sameAs);
- s_rgFontSettings[i].style = (FW_NORMAL == lf.lfWeight? 0 : DBFONTF_BOLD)
- | (lf.lfItalic ? DBFONTF_ITALIC : 0)
- | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0);
- if (lf.lfHeight < 0)
- {
- HDC hdc;
- SIZE size;
- HFONT hFont = CreateFontIndirectA(&lf);
-
- hdc = GetDC(hwndDlg);
- SelectObject(hdc, hFont);
- GetTextExtentPoint32A(hdc, "x", 1, &size);
- ReleaseDC(hwndDlg, hdc);
- DeleteObject(hFont);
- s_rgFontSettings[i].size = (char)size.cy;
- }
- else
- s_rgFontSettings[i].size = (char)lf.lfHeight;
- s_rgFontSettings[i].charset = lf.lfCharSet;
- s_rgFontSettings[i].colour = colour;
- lstrcpyA(s_rgFontSettings[i].szFace, lf.lfFaceName);
- itemId = SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_ADDSTRING, 0, (LPARAM)TranslateTS(s_rgszFontIdDescr[i]));
- SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_SETITEMDATA, itemId, i);
-
- // Miranda contact list fonts
- GetFontSetting(FALSE, i, &lf, &colour);
- s_rgFontSettingsMiranda[i].sameAs = 0;
- s_rgFontSettingsMiranda[i].sameAsFlags = 0;
- lstrcpyA(s_rgFontSettingsMiranda[i].szFace, lf.lfFaceName);
- s_rgFontSettingsMiranda[i].charset = lf.lfCharSet;
- s_rgFontSettingsMiranda[i].style = (FW_NORMAL == lf.lfWeight? 0 : DBFONTF_BOLD)
- | (lf.lfItalic ? DBFONTF_ITALIC : 0)
- | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0);
- if (lf.lfHeight < 0)
- {
- HDC hdc;
- SIZE size;
- HFONT hFont = CreateFontIndirectA(&lf);
-
- hdc = GetDC(hwndDlg);
- SelectObject(hdc, hFont);
- GetTextExtentPoint32A(hdc, "x", 1, &size);
- ReleaseDC(hwndDlg, hdc);
- DeleteObject(hFont);
- s_rgFontSettingsMiranda[i].size = (char)size.cy;
- }
- else
- s_rgFontSettingsMiranda[i].size = (char)lf.lfHeight;
- s_rgFontSettingsMiranda[i].colour = colour;
- }
- SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_SETCURSEL, 0, 0);
- for (i = 0; i < sizeof(s_rgszFontSizes)/sizeof(s_rgszFontSizes[0]); i++)
- SendDlgItemMessageA(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM)s_rgszFontSizes[i]);
+ ApplyOptionsChanges();
+ OnStatusChanged();
+ return TRUE;
}
- SendMessage(hwndDlg, M_REBUILDFONTGROUP, 0, 0);
- SendMessage(hwndDlg, M_SAVEFONT, 0, 0);
- return TRUE;
}
- case M_REFRESHBKGBOXES:
- {
- BOOL bEnable = IsDlgButtonChecked(hwndDlg, IDC_BITMAP);
+ break;
+ }
+ return FALSE;
+}
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STRETCHH), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STRETCHV), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TILEH), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TILEV), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PROPORTIONAL), bEnable);
- break;
- }
- case M_REFRESHBORDERPICKERS:
- {
- BOOL bEnable = IsDlgButtonChecked(hwndDlg, IDC_DRAWBORDER);
+/////////////////////////////////////////////////////////////////////////////////////////
- EnableWindow(GetDlgItem(hwndDlg, IDC_LTEDGESCOLOR), bEnable);
- EnableWindow(GetDlgItem(hwndDlg, IDC_RBEDGESCOLOR), bEnable);
- break;
- }
- // remake all the needed controls when the user changes the font selector at the top
- case M_REBUILDFONTGROUP:
+static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ BOOL bEnable;
+
+ switch ( uMsg ) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ // Border
+ CheckDlgButton(hwndDlg, IDC_DRAWBORDER, db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER));
+ SendMessage(hwndDlg, M_REFRESHBORDERPICKERS, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_SETDEFAULTCOLOUR, 0, FLT_DEFAULT_LTEDGESCOLOR);
+ SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULE, "LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR));
+ SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_SETDEFAULTCOLOUR, 0, FLT_DEFAULT_RBEDGESCOLOR);
+ SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULE, "RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR));
+
+ // Background
+ CheckDlgButton(hwndDlg, IDC_CHK_WIDTH, (fcOpt.bFixedWidth ? BST_CHECKED : BST_UNCHECKED));
+
+ SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, FLT_DEFAULT_BKGNDCOLOR);
+ SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULE, "BkColor", FLT_DEFAULT_BKGNDCOLOR));
+ CheckDlgButton(hwndDlg, IDC_BITMAP, db_get_b(NULL, MODULE, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP));
+ SendMessage(hwndDlg, M_REFRESHBKGBOXES, 0, 0);
{
- int i = SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETCURSEL, 0, 0);
- int j;
- int itemId;
- int nSameAs = FLT_SAME_AS_NONE;
- char szText[256];
-
- SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_RESETCONTENT, 0, 0);
- itemId = SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_ADDSTRING, 0, (LPARAM)TranslateT("<none>"));
- SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETITEMDATA, itemId, FLT_SAME_AS_NONE);
- SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETCURSEL, itemId, 0);
- itemId = SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Contact List Text>"));
- SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETITEMDATA, itemId, FLT_SAME_AS_MIRANDA);
- if (FLT_SAME_AS_MIRANDA == s_rgFontSettings[i].sameAs)
- {
- SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETCURSEL, itemId, 0);
- nSameAs = FLT_SAME_AS_MIRANDA;
+ DBVARIANT dbv;
+ if ( !DBGetContactSettingTString(NULL, MODULE, "BkBitmap", &dbv)) {
+ SetDlgItemText(hwndDlg, IDC_FILENAME, dbv.ptszVal);
+ db_free(&dbv);
}
- for (j = 0; j < FLT_FONTIDS; j++)
- {
- int nDependsOn = j;
- while (nDependsOn != i)
- {
- if (FLT_SAME_AS_NONE == nDependsOn || FLT_SAME_AS_MIRANDA == nDependsOn)
- {
- SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETLBTEXT, j, (LPARAM)szText);
- itemId = SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_ADDSTRING, 0, (LPARAM)szText);
- SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETITEMDATA, itemId, j);
- if (j == s_rgFontSettings[i].sameAs)
- {
- SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETCURSEL, itemId, 0);
- nSameAs = j;
- }
- break;
- }
- else
- nDependsOn = s_rgFontSettings[nDependsOn].sameAs;
- }
- }
- if (FLT_SAME_AS_NONE == nSameAs)
- s_rgFontSettings[i].sameAsFlags = 0;
+ WORD bmpUse = (WORD)db_get_w(NULL, MODULE, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
+ CheckDlgButton(hwndDlg, IDC_STRETCHH, ((bmpUse & CLB_STRETCHH) ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_STRETCHV, ((bmpUse & CLB_STRETCHV) ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_TILEH, ((bmpUse & CLBF_TILEH) ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_TILEV, ((bmpUse & CLBF_TILEV) ? BST_CHECKED : BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_PROPORTIONAL, ((bmpUse & CLBF_PROPORTIONAL) ? BST_CHECKED : BST_UNCHECKED));
- SendMessage(hwndDlg, M_LOADFONT, i, 0);
- SendMessage(hwndDlg, M_SETSAMEASBOXES, i, 0);
- SendMessage(hwndDlg, M_REFRESHSAMEASBOXES, i, 0);
- SendMessage(hwndDlg, M_REMAKESAMPLE, 0, 0);
- break;
+ if (fnSHAutoComplete)
+ fnSHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
}
- //fill the script combo box and set the selection to the value for fontid wParam
- case M_FILLSCRIPTCOMBO:
- {
- int i;
- HDC hdc = GetDC(hwndDlg);
- LOGFONT lf = {0};
+ return TRUE;
- lf.lfCharSet = DEFAULT_CHARSET;
- lf.lfPitchAndFamily = 0;
- GetDlgItemText(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, sizeof(lf.lfFaceName));
- SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_RESETCONTENT, 0, 0);
- EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontScriptsProc, (LPARAM)GetDlgItem(hwndDlg, IDC_SCRIPT), 0);
- ReleaseDC(hwndDlg, hdc);
- for (i = SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--)
- {
- if (SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, i, 0) == s_rgFontSettings[wParam].charset)
- {
- SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_SETCURSEL, i, 0);
- break;
- }
- }
- if (i < 0)
- SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_SETCURSEL, 0, 0);
- break;
- }
- // set the check mark in the 'same as' boxes to the right value for fontid wParam
- case M_SETSAMEASBOXES:
- {
- CheckDlgButton(hwndDlg, IDC_SAMETYPE, (s_rgFontSettings[wParam].sameAsFlags & SAMEASF_FACE ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_SAMESIZE, (s_rgFontSettings[wParam].sameAsFlags & SAMEASF_SIZE ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_SAMESTYLE, (s_rgFontSettings[wParam].sameAsFlags & SAMEASF_STYLE ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_SAMECOLOUR, (s_rgFontSettings[wParam].sameAsFlags & SAMEASF_COLOUR ? BST_CHECKED : BST_UNCHECKED));
+ case M_REFRESHBKGBOXES:
+ bEnable = IsDlgButtonChecked(hwndDlg, IDC_BITMAP);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STRETCHH), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STRETCHV), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TILEH), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TILEV), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROPORTIONAL), bEnable);
+ break;
+
+ case M_REFRESHBORDERPICKERS:
+ bEnable = IsDlgButtonChecked(hwndDlg, IDC_DRAWBORDER);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LTEDGESCOLOR), bEnable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RBEDGESCOLOR), bEnable);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_DRAWBORDER:
+ SendMessage(hwndDlg, M_REFRESHBORDERPICKERS, 0, 0);
break;
- }
- // set the disabled flag on the 'same as' checkboxes to the values for fontid wParam
- case M_REFRESHSAMEASBOXES:
- {
- BOOL bSameAsNone = (FLT_SAME_AS_NONE == s_rgFontSettings[wParam].sameAs);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SAMETYPE), !bSameAsNone);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SAMESIZE), !bSameAsNone);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SAMESTYLE), !bSameAsNone);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SAMECOLOUR), !bSameAsNone);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEFACE), bSameAsNone || !(s_rgFontSettings[wParam].sameAsFlags & SAMEASF_FACE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_SCRIPT), bSameAsNone || !(s_rgFontSettings[wParam].sameAsFlags & SAMEASF_FACE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_FONTSIZE), bSameAsNone || !(s_rgFontSettings[wParam].sameAsFlags & SAMEASF_SIZE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOLD), bSameAsNone || !(s_rgFontSettings[wParam].sameAsFlags & SAMEASF_STYLE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_ITALIC), bSameAsNone || !(s_rgFontSettings[wParam].sameAsFlags & SAMEASF_STYLE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_UNDERLINE), bSameAsNone || !(s_rgFontSettings[wParam].sameAsFlags & SAMEASF_STYLE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_COLOUR), bSameAsNone || !(s_rgFontSettings[wParam].sameAsFlags & SAMEASF_COLOUR));
- break;
- }
- // remake the sample edit box font based on the settings in the controls
- case M_REMAKESAMPLE:
- {
- LOGFONTA lf;
-
- if (hFontSample)
- {
- SendDlgItemMessage(hwndDlg, IDC_SAMPLE, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDC_FONTID, WM_GETFONT, 0, 0), 0);
- DeleteObject(hFontSample);
- }
- lf.lfHeight = GetDlgItemInt(hwndDlg, IDC_FONTSIZE, NULL, FALSE);
+ case IDC_BROWSE:
{
- HDC hdc = GetDC(NULL);
- lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- ReleaseDC(NULL,hdc);
+ char str[MAX_PATH];
+ OPENFILENAMEA ofn = {0};
+ char filter[512];
+
+ GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, sizeof(str));
+ ofn.lStructSize = sizeof(OPENFILENAMEA);
+ ofn.hwndOwner = hwndDlg;
+ ofn.hInstance = NULL;
+ CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof(filter), (LPARAM)filter);
+ ofn.lpstrFilter = filter;
+ ofn.lpstrFile = str;
+ ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
+ ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.lpstrDefExt = "bmp";
+ if (!GetOpenFileNameA(&ofn))
+ return FALSE;
+ SetDlgItemTextA(hwndDlg, IDC_FILENAME, str);
}
- lf.lfWidth = 0;
- lf.lfEscapement = 0;
- lf.lfOrientation = 0;
- lf.lfWeight = (IsDlgButtonChecked(hwndDlg, IDC_BOLD) ? FW_BOLD : FW_NORMAL);
- lf.lfItalic = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ITALIC);
- lf.lfUnderline = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE);
- lf.lfStrikeOut = 0;
- lf.lfCharSet = (BYTE)SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCURSEL, 0, 0), 0);
- lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
- lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lf.lfQuality = DEFAULT_QUALITY;
- lf.lfPitchAndFamily = (DEFAULT_PITCH | FF_DONTCARE);
- GetDlgItemTextA(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, sizeof(lf.lfFaceName));
- if (NULL != (hFontSample = CreateFontIndirectA(&lf)))
- SendDlgItemMessage(hwndDlg, IDC_SAMPLE, WM_SETFONT, (WPARAM)hFontSample, TRUE);
break;
- }
- // copy the 'same as' settings for fontid wParam from their sources
- case M_RECALCONEFONT:
- {
- if (FLT_SAME_AS_NONE != s_rgFontSettings[wParam].sameAs)
- {
- SFontSettings* pSameAs = ((FLT_SAME_AS_MIRANDA == s_rgFontSettings[wParam].sameAs)
- ? &s_rgFontSettingsMiranda[wParam]
- : &s_rgFontSettings[s_rgFontSettings[wParam].sameAs]
- );
- if (s_rgFontSettings[wParam].sameAsFlags & SAMEASF_FACE)
- {
- lstrcpyA(s_rgFontSettings[wParam].szFace, pSameAs->szFace);
- s_rgFontSettings[wParam].charset = pSameAs->charset;
- }
- if (s_rgFontSettings[wParam].sameAsFlags & SAMEASF_SIZE)
- s_rgFontSettings[wParam].size = pSameAs->size;
- if (s_rgFontSettings[wParam].sameAsFlags & SAMEASF_STYLE)
- s_rgFontSettings[wParam].style = pSameAs->style;
- if (s_rgFontSettings[wParam].sameAsFlags & SAMEASF_COLOUR)
- s_rgFontSettings[wParam].colour = pSameAs->colour;
- }
+ case IDC_FILENAME:
+ if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
+ return FALSE;
break;
- }
- // recalculate the 'same as' settings for all fonts but wParam
- case M_RECALCOTHERFONTS:
- {
- int nFont;
- int nDepth;
- int nRecalcedFonts = 1;
- int nRecalcDepth;
- int nFontId = (int)wParam;
- int nSameAs;
- for (nRecalcDepth = 0; nRecalcedFonts < FLT_FONTIDS && nRecalcDepth < FLT_FONTIDS; nRecalcDepth++)
- {
- for (nFont = 0; nFont < FLT_FONTIDS; nFont++)
- {
- if (nFontId == nFont)
- continue;
-
- nSameAs = s_rgFontSettings[nFont].sameAs;
- for (nDepth = 0; nDepth < nRecalcDepth; nDepth++)
- {
- if (FLT_SAME_AS_NONE == nSameAs || FLT_SAME_AS_MIRANDA == nSameAs || nFontId == nSameAs)
- break;
-
- nSameAs = s_rgFontSettings[nSameAs].sameAs;
- }
- if (nDepth == nRecalcDepth)
- {
- if (nFontId == nSameAs)
- {
- SendMessage(hwndDlg, M_RECALCONEFONT, nFont, 0);
- nRecalcedFonts++;
- }
- else if (FLT_SAME_AS_NONE == nSameAs || FLT_SAME_AS_MIRANDA == nSameAs)
- nRecalcedFonts++;
- }
- }
- }
- break;
- }
- //save the font settings from the controls to font wParam
- case M_SAVEFONT:
- {
- s_rgFontSettings[wParam].sameAsFlags = (IsDlgButtonChecked(hwndDlg, IDC_SAMETYPE) ? SAMEASF_FACE : 0)
- | (IsDlgButtonChecked(hwndDlg, IDC_SAMESIZE) ? SAMEASF_SIZE : 0)
- | (IsDlgButtonChecked(hwndDlg, IDC_SAMESTYLE) ? SAMEASF_STYLE : 0)
- | (IsDlgButtonChecked(hwndDlg, IDC_SAMECOLOUR) ? SAMEASF_COLOUR : 0);
- s_rgFontSettings[wParam].sameAs = (BYTE)SendDlgItemMessage(hwndDlg
- , IDC_SAMEAS
- , CB_GETITEMDATA
- , SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_GETCURSEL, 0, 0)
- , 0
- );
- GetDlgItemTextA(hwndDlg, IDC_TYPEFACE, s_rgFontSettings[wParam].szFace, sizeof(s_rgFontSettings[wParam].szFace));
- s_rgFontSettings[wParam].charset = (BYTE)SendDlgItemMessage(hwndDlg
- , IDC_SCRIPT
- , CB_GETITEMDATA
- , SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCURSEL, 0, 0)
- , 0
- );
- s_rgFontSettings[wParam].size = (char)GetDlgItemInt(hwndDlg, IDC_FONTSIZE, NULL, FALSE);
- s_rgFontSettings[wParam].style = (IsDlgButtonChecked(hwndDlg, IDC_BOLD) ? DBFONTF_BOLD : 0)
- | (IsDlgButtonChecked(hwndDlg, IDC_ITALIC) ? DBFONTF_ITALIC : 0)
- | (IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE) ? DBFONTF_UNDERLINE : 0);
- s_rgFontSettings[wParam].colour = SendDlgItemMessage(hwndDlg, IDC_COLOUR, CPM_GETCOLOUR, 0, 0);
+ case IDC_BITMAP:
+ SendMessage(hwndDlg, M_REFRESHBKGBOXES, 0, 0);
break;
}
- // load font wParam into the controls
- case M_LOADFONT:
- {
- LOGFONTA lf;
- COLORREF colour;
- SetDlgItemTextA(hwndDlg, IDC_TYPEFACE, s_rgFontSettings[wParam].szFace);
- SendMessage(hwndDlg, M_FILLSCRIPTCOMBO, wParam, 0);
- SetDlgItemInt(hwndDlg, IDC_FONTSIZE, s_rgFontSettings[wParam].size, FALSE);
- CheckDlgButton(hwndDlg, IDC_BOLD, ((s_rgFontSettings[wParam].style & DBFONTF_BOLD) ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_ITALIC, ((s_rgFontSettings[wParam].style & DBFONTF_ITALIC) ? BST_CHECKED : BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_UNDERLINE, ((s_rgFontSettings[wParam].style & DBFONTF_UNDERLINE) ? BST_CHECKED : BST_UNCHECKED));
- GetDefaultFontSetting(TRUE, wParam, &lf, &colour);
- SendDlgItemMessage(hwndDlg, IDC_COLOUR, CPM_SETDEFAULTCOLOUR, 0, colour);
- SendDlgItemMessage(hwndDlg, IDC_COLOUR, CPM_SETCOLOUR, 0, s_rgFontSettings[wParam].colour);
- break;
- }
- // guess suitable values for the 'same as' checkboxes for fontId wParam
- case M_GUESSSAMEASBOXES:
- {
- s_rgFontSettings[wParam].sameAsFlags = 0;
- if (FLT_SAME_AS_NONE != s_rgFontSettings[wParam].sameAs)
- {
- SFontSettings* pSameAs = ((FLT_SAME_AS_MIRANDA == s_rgFontSettings[wParam].sameAs)
- ? &s_rgFontSettingsMiranda[wParam]
- : &s_rgFontSettings[s_rgFontSettings[wParam].sameAs]
- );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- if (!lstrcmpA(s_rgFontSettings[wParam].szFace, pSameAs->szFace) && s_rgFontSettings[wParam].charset == pSameAs->charset)
- s_rgFontSettings[wParam].sameAsFlags |= SAMEASF_FACE;
- if (s_rgFontSettings[wParam].size == pSameAs->size)
- s_rgFontSettings[wParam].sameAsFlags |= SAMEASF_SIZE;
- if (s_rgFontSettings[wParam].style == pSameAs->style)
- s_rgFontSettings[wParam].sameAsFlags |= SAMEASF_STYLE;
- if (s_rgFontSettings[wParam].colour == pSameAs->colour)
- s_rgFontSettings[wParam].sameAsFlags |= SAMEASF_COLOUR;
- SendMessage(hwndDlg,M_SETSAMEASBOXES,wParam,0);
- }
- break;
- }
- case WM_CTLCOLORSTATIC:
- {
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SAMPLE))
- {
- SetTextColor((HDC)wParam, SendDlgItemMessage(hwndDlg, IDC_COLOUR, CPM_GETCOLOUR, 0, 0));
- SetBkColor((HDC)wParam, GetSysColor(COLOR_3DFACE));
- return (BOOL)GetSysColorBrush(COLOR_3DFACE);
- }
- break;
- }
- case WM_HSCROLL:
- {
- if (wParam != TB_ENDTRACK)
- {
- int nPos;
- char szPercent[20];
-
- nPos = (BYTE)SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_GETPOS, 0, 0);
- fcOpt.thumbAlpha = (BYTE)(( nPos * 255 ) / 100 );
+ case WM_NOTIFY:
+ if (0 == ((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ fcOpt.thumbAlpha = (BYTE)((double)db_get_b(NULL, MODULE, "Opacity", 100) * 2.55);
SetThumbsOpacity(fcOpt.thumbAlpha);
-
- wsprintfA(szPercent, "%d%%", nPos);
- SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- }
- case WM_COMMAND:
- {
- int nFontId = SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETITEMDATA
- , SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETCURSEL, 0, 0)
- , 0
- );
-
- switch (LOWORD(wParam))
- {
- case IDC_DRAWBORDER:
- {
- SendMessage(hwndDlg, M_REFRESHBORDERPICKERS, 0, 0);
- break;
- }
- case IDC_BROWSE:
- {
- char str[MAX_PATH];
- OPENFILENAMEA ofn = {0};
- char filter[512];
-
- GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, sizeof(str));
- ofn.lStructSize = sizeof(OPENFILENAMEA);
- ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
- CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof(filter), (LPARAM)filter);
- ofn.lpstrFilter = filter;
- ofn.lpstrFile = str;
- ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = sizeof(str);
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.lpstrDefExt = "bmp";
- if (!GetOpenFileNameA(&ofn))
- return FALSE;
- SetDlgItemTextA(hwndDlg, IDC_FILENAME, str);
- break;
- }
- case IDC_FILENAME:
- {
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return FALSE;
- break;
- }
- case IDC_BITMAP:
- {
- SendMessage(hwndDlg, M_REFRESHBKGBOXES, 0, 0);
- break;
- }
- case IDC_FONTID:
- {
- if (CBN_SELCHANGE == HIWORD(wParam))
- SendMessage(hwndDlg, M_REBUILDFONTGROUP, 0, 0);
- return FALSE;
- }
- case IDC_SAMETYPE:
- case IDC_SAMESIZE:
- case IDC_SAMESTYLE:
- case IDC_SAMECOLOUR:
- {
- SendMessage(hwndDlg, M_SAVEFONT, nFontId, 0);
- SendMessage(hwndDlg, M_RECALCONEFONT, nFontId, 0);
- SendMessage(hwndDlg, M_RECALCOTHERFONTS, nFontId, 0);
- SendMessage(hwndDlg, M_LOADFONT, nFontId, 0);
- SendMessage(hwndDlg, M_REFRESHSAMEASBOXES, nFontId, 0);
- SendMessage(hwndDlg, M_REMAKESAMPLE, 0, 0);
- break;
- }
- case IDC_SAMEAS:
- {
- if (CBN_SELCHANGE != HIWORD(wParam))
- return FALSE;
- SendMessage(hwndDlg, M_SAVEFONT, nFontId, 0);
- SendMessage(hwndDlg, M_GUESSSAMEASBOXES, nFontId, 0);
- SendMessage(hwndDlg, M_REFRESHSAMEASBOXES, nFontId, 0);
- break;
- }
- case IDC_TYPEFACE:
- case IDC_SCRIPT:
- case IDC_FONTSIZE:
- {
- if (CBN_EDITCHANGE != HIWORD(wParam) && CBN_SELCHANGE != HIWORD(wParam))
- return FALSE;
- if (CBN_SELCHANGE == HIWORD(wParam))
- SendDlgItemMessage(hwndDlg, LOWORD(wParam), CB_SETCURSEL, SendDlgItemMessage(hwndDlg, LOWORD(wParam), CB_GETCURSEL, 0, 0), 0);
- if (IDC_TYPEFACE == LOWORD(wParam))
- SendMessage(hwndDlg, M_FILLSCRIPTCOMBO, nFontId, 0);
- // FALL THRU
- }
- case IDC_BOLD:
- case IDC_ITALIC:
- case IDC_UNDERLINE:
- case IDC_COLOUR:
- {
- SendMessage(hwndDlg, M_SAVEFONT, nFontId, 0);
- //SendMessage(hwndDlg, M_GUESSSAMEASBOXES, nFontId, 0);
- //SendMessage(hwndDlg, M_REFRESHSAMEASBOXES, nFontId, 0);
- SendMessage(hwndDlg, M_RECALCOTHERFONTS, nFontId, 0);
- SendMessage(hwndDlg, M_REMAKESAMPLE, 0, 0);
- break;
- }
- case IDC_SAMPLE:
- return 0;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- case WM_NOTIFY:
- {
- LPNMHDR phdr = (LPNMHDR)(lParam);
-
- if (0 == phdr->idFrom)
- {
- switch (phdr->code)
- {
- case PSN_APPLY:
- {
- int i;
- char str[20];
- //BOOL bSuccess = FALSE;
-
- // Border
- DBWriteContactSettingByte(NULL, sModule, "DrawBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAWBORDER));
- {
- COLORREF col;
-
- col = SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_GETCOLOUR, 0, 0);
- DBWriteContactSettingDword(NULL, sModule, "LTEdgesColor", col);
- col = SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_GETCOLOUR, 0, 0);
- DBWriteContactSettingDword(NULL, sModule, "RBEdgesColor", col);
- }
-
- // Backgroud
- {
- COLORREF col;
-
- col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
- DBWriteContactSettingDword(NULL, sModule, "BkColor", col);
- }
- DBWriteContactSettingByte(NULL, sModule, "BkUseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- {
- char str[MAX_PATH];
-
- GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, sizeof(str));
- DBWriteContactSettingString(NULL, sModule, "BkBitmap", str);
- }
- {
- WORD flags = 0;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH))
- flags |= CLB_STRETCHH;
- if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHV))
- flags |= CLB_STRETCHV;
- if (IsDlgButtonChecked(hwndDlg, IDC_TILEH))
- flags |= CLBF_TILEH;
- if (IsDlgButtonChecked(hwndDlg, IDC_TILEV))
- flags |= CLBF_TILEV;
- if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL))
- flags |= CLBF_PROPORTIONAL;
- DBWriteContactSettingWord(NULL, sModule, "BkBitmapOpt", flags);
- }
-
- DBWriteContactSettingByte(NULL, sModule, "Opacity"
- , (BYTE)SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_GETPOS, 0, 0)
- );
-
- for (i = 0; i < FLT_FONTIDS; i++)
- {
- wsprintfA(str, "Font%dName", i);
- DBWriteContactSettingString(NULL, sModule, str, s_rgFontSettings[i].szFace);
- wsprintfA(str, "Font%dSet", i);
- DBWriteContactSettingByte(NULL, sModule, str, s_rgFontSettings[i].charset);
- wsprintfA(str, "Font%dSize", i);
- DBWriteContactSettingByte(NULL, sModule, str, s_rgFontSettings[i].size);
- wsprintfA(str, "Font%dSty", i);
- DBWriteContactSettingByte(NULL, sModule, str, s_rgFontSettings[i].style);
- wsprintfA(str, "Font%dCol", i);
- DBWriteContactSettingDword(NULL, sModule, str, s_rgFontSettings[i].colour);
- wsprintfA(str, "Font%dAs", i);
- DBWriteContactSettingWord(NULL, sModule, str, MAKEWORD(s_rgFontSettings[i].sameAs, s_rgFontSettings[i].sameAsFlags));
- }
-
- ApplyOptionsChanges();
- OnStatusChanged();
- return TRUE;
- }
- case PSN_RESET:
- //case PSN_KILLACTIVE:
- {
- fcOpt.thumbAlpha = (BYTE)((double)DBGetContactSettingByte(NULL, sModule, "Opacity", 100) * 2.55);
- SetThumbsOpacity(fcOpt.thumbAlpha);
- break;
- }
- }
+ break;
+
+ case PSN_APPLY:
+ // Border
+ db_set_b(NULL, MODULE, "DrawBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAWBORDER));
+
+ COLORREF col = SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_GETCOLOUR, 0, 0);
+ db_set_dw(NULL, MODULE, "LTEdgesColor", col);
+ col = SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_GETCOLOUR, 0, 0);
+ db_set_dw(NULL, MODULE, "RBEdgesColor", col);
+
+ // Backgroud
+ col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
+ db_set_dw(NULL, MODULE, "BkColor", col);
+
+ db_set_b(NULL, MODULE, "BkUseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
+
+ TCHAR str[MAX_PATH];
+ GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
+ DBWriteContactSettingTString(NULL, MODULE, "BkBitmap", str);
+
+ WORD flags = 0;
+ if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH))
+ flags |= CLB_STRETCHH;
+ if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHV))
+ flags |= CLB_STRETCHV;
+ if (IsDlgButtonChecked(hwndDlg, IDC_TILEH))
+ flags |= CLBF_TILEH;
+ if (IsDlgButtonChecked(hwndDlg, IDC_TILEV))
+ flags |= CLBF_TILEV;
+ if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL))
+ flags |= CLBF_PROPORTIONAL;
+ db_set_w(NULL, MODULE, "BkBitmapOpt", flags);
+
+ ApplyOptionsChanges();
+ OnStatusChanged();
+ return TRUE;
}
- break;
}
- case WM_DESTROY:
- {
- if (hFontSample)
- {
- SendDlgItemMessage(hwndDlg, IDC_SAMPLE, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDC_FONTID, WM_GETFONT, 0, 0), 0);
- DeleteObject(hFontSample);
- }
- break;
- }
-
+ break;
}
return FALSE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int OnOptionsInitialize(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FLTCONT);
+ odp.pszTitle = LPGEN("Floating Contacts");
+ odp.pszGroup = LPGEN("Contact List");
+ odp.pszTab = LPGEN("Main Features");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = OptWndProc;
+ Options_AddPage(wParam, &odp);
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN);
+ odp.pszTab = LPGEN("Appearance");
+ odp.pfnDlgProc = OptSknWndProc;
+ Options_AddPage(wParam, &odp);
+ return 0;
+}
diff --git a/plugins/FloatingContacts/src/resource.h b/plugins/FloatingContacts/src/resource.h index 4674f60fd7..d41877bc12 100644 --- a/plugins/FloatingContacts/src/resource.h +++ b/plugins/FloatingContacts/src/resource.h @@ -8,8 +8,6 @@ #define IDI_SHOW 105
#define IDD_OPT_FNT 106
#define IDD_OPT_SKIN 106
-#define IDC_SLIDER_OPACITY 1001
-#define IDC_OPACITY 1002
#define IDC_CHK_HIDE_OFFLINE 1003
#define IDC_CHK_STICK 1004
#define IDC_CHK_WIDTH 1005
@@ -32,24 +30,7 @@ #define IDC_CHK_SINGLECLK 1020
#define IDC_CHECK2 1021
#define IDC_CHK_SHOWIDLE 1021
-#define IDC_FONTID 1100
-#define IDC_SAMEAS 1101
#define IDC_LBL_TIMEIN_CMT 1101
-#define IDC_SAMETYPE 1102
-#define IDC_SAMESIZE 1103
-#define IDC_SAMESTYLE 1104
-#define IDC_SAMECOLOUR 1105
-#define IDC_TYPEFACE 1106
-#define IDC_SCRIPT 1107
-#define IDC_FONTSIZE 1108
-#define IDC_BOLD 1109
-#define IDC_ITALIC 1110
-#define IDC_UNDERLINE 1111
-#define IDC_COLOUR 1112
-#define IDC_SAMPLE 1113
-#define IDC_STSAMETEXT 1114
-#define IDC_STASTEXT 1115
-#define IDC_STHORZBAR 1116
#define IDC_BKGCOLOUR 1200
#define IDC_BITMAP 1201
#define IDC_FILENAME 1202
diff --git a/plugins/FloatingContacts/src/stdhdr.h b/plugins/FloatingContacts/src/stdhdr.h index 2a9e49c535..c7a46e6f56 100644 --- a/plugins/FloatingContacts/src/stdhdr.h +++ b/plugins/FloatingContacts/src/stdhdr.h @@ -11,6 +11,7 @@ #include <newpluginapi.h>
#include <m_system_cpp.h>
#include <m_skin.h>
+#include <m_fontservice.h>
#include <m_langpack.h>
#include <m_protosvc.h>
#include <m_database.h>
@@ -20,6 +21,7 @@ #include <m_clistint.h>
#include <m_hotkeys.h>
#include <m_png.h>
+#include <win2k.h>
#include "bitmap_funcs.h"
#include "fltcont.h"
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index 1a427c4e86..613de3d734 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -298,7 +298,7 @@ void ThumbInfo::ResizeThumb() hdc = GetWindowDC(hwnd);
- if (!DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (!db_get_b(hContact, "CList", "NotOnList", 0))
{
int nStatus;
int nContactStatus;
@@ -310,8 +310,8 @@ void ThumbInfo::ResizeThumb() if ( NULL != szProto )
{
nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
- nContactStatus = DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- nApparentMode = DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0);
+ nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0);
if ( (nStatus == ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_ONLINE)
|| (nStatus != ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_OFFLINE)
@@ -344,8 +344,7 @@ void ThumbInfo::ResizeThumb() hOldFont = (HFONT)SelectObject( hdc, hFont[ index ] );
// Get text and icon sizes
- GetTextExtentPoint32( hdc, ptszName, _tcslen( ptszName ), &sizeText );
-
+ GetTextExtentPoint32( hdc, ptszName, (DWORD)_tcslen(ptszName), &sizeText);
SelectObject( hdc, hOldFont );
@@ -408,7 +407,7 @@ void ThumbInfo::RefreshContactStatus(int idStatus) void ThumbInfo::DeleteContactPos()
{
- DBDeleteContactSetting( hContact, sModule, "ThumbsPos" );
+ DBDeleteContactSetting( hContact, MODULE, "ThumbsPos" );
}
void ThumbInfo::OnLButtonDown(short nX, short nY)
@@ -716,7 +715,7 @@ void ThumbInfo::UpdateContent() oldBkMode = SetBkMode( hdcDraw, TRANSPARENT );
- if (!DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (!db_get_b(hContact, "CList", "NotOnList", 0))
{
int nStatus;
int nContactStatus;
@@ -729,8 +728,8 @@ void ThumbInfo::UpdateContent() if ( NULL != szProto )
{
nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
- nContactStatus = DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- nApparentMode = DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0);
+ nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0);
if ( (nStatus == ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_ONLINE) ||
(nStatus != ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_OFFLINE))
@@ -742,7 +741,7 @@ void ThumbInfo::UpdateContent() else
{
index = FLT_FONTID_INVIS;
- if (fcOpt.bShowIdle && DBGetContactSettingDword(hContact, szProto, "IdleTS", 0)) {
+ if (fcOpt.bShowIdle && db_get_dw(hContact, szProto, "IdleTS", 0)) {
fStyle|=ILD_BLEND50;
}
}
@@ -754,7 +753,7 @@ void ThumbInfo::UpdateContent() else
{
index = FLT_FONTID_CONTACTS;
- if (fcOpt.bShowIdle && DBGetContactSettingDword(hContact, szProto, "IdleTS", 0)) {
+ if (fcOpt.bShowIdle && db_get_dw(hContact, szProto, "IdleTS", 0)) {
fStyle|=ILD_BLEND50;
}
}
@@ -769,36 +768,24 @@ void ThumbInfo::UpdateContent() oldColor = SetTextColor( hdcDraw, tColor[ index ] );
-/* ImageList_DrawEx( himl,
- iIcon,
- hdcDraw,
- 2,
- ( szSize.cy - size.cx ) / 2,
- 0,
- 0,
- CLR_NONE,
- CLR_NONE,
- fStyle);
-*/
- {
- HICON icon = ImageList_GetIcon(himl, iIcon, ILD_NORMAL);
- MyBitmap bmptmp(size.cx, size.cy);
- bmptmp.DrawIcon(icon,0,0);//bmpContent
- BLENDFUNCTION blend;
- blend.BlendOp = AC_SRC_OVER;
- blend.BlendFlags = 0;
- blend.SourceConstantAlpha = (fStyle&ILD_BLEND50)?128:255;
- blend.AlphaFormat = AC_SRC_ALPHA;
- AlphaBlend(hdcDraw, 2,( szSize.cy - size.cx ) / 2, bmptmp.getWidth(), bmptmp.getHeight(), bmptmp.getDC(), 0, 0, bmptmp.getWidth(), bmptmp.getHeight(), blend);
- DestroyIcon(icon);
- }
+ HICON icon = ImageList_GetIcon(himl, iIcon, ILD_NORMAL);
+ MyBitmap bmptmp(size.cx, size.cy);
+ bmptmp.DrawIcon(icon,0,0);//bmpContent
+ BLENDFUNCTION blend;
+ blend.BlendOp = AC_SRC_OVER;
+ blend.BlendFlags = 0;
+ blend.SourceConstantAlpha = (fStyle&ILD_BLEND50)?128:255;
+ blend.AlphaFormat = AC_SRC_ALPHA;
+ AlphaBlend(hdcDraw, 2,( szSize.cy - size.cx ) / 2, bmptmp.getWidth(), bmptmp.getHeight(), bmptmp.getDC(), 0, 0, bmptmp.getWidth(), bmptmp.getHeight(), blend);
+ DestroyIcon(icon);
+
SetRect(&rcText, 0, 0, szSize.cx, szSize.cy);
rcText.left += size.cx + 4;
hOldFont = (HFONT)SelectObject( hdcDraw, hFont[ index ] );
SIZE szText;
- GetTextExtentPoint32(hdcDraw, ptszName, _tcslen(ptszName), &szText);
+ GetTextExtentPoint32(hdcDraw, ptszName, (DWORD)_tcslen(ptszName), &szText);
SetTextColor(hdcDraw, bkColor);
// simple border
diff --git a/plugins/FloatingContacts/src/version.h b/plugins/FloatingContacts/src/version.h index ba57a6dbae..509fdd46d9 100644 --- a/plugins/FloatingContacts/src/version.h +++ b/plugins/FloatingContacts/src/version.h @@ -1,14 +1,14 @@ #define __MAJOR_VERSION 0
-#define __MINOR_VERSION 6
+#define __MINOR_VERSION 7
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 0
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __PLUGIN_NAME "Floating contacts"
#define __FILENAME "FltContacts.dll"
-#define __DESCRIPTION "Floating Contacts plugin for Miranda."
-#define __AUTHOR "Iavor Vajarov, Kosh&chka, Victor Pavlychko"
+#define __DESCRIPTION "Floating Contacts plugin for Miranda."
+#define __AUTHOR "Iavor Vajarov, Kosh&chka, Victor Pavlychko"
#define __AUTHOREMAIL "ell-6@ya.ru"
#define __AUTHORWEB "http://miranda-ng.org/"
#define __COPYRIGHT "© 2002-2004 I. Vajarov (ivajarov@code.bg)6 2008 Kosh&chka, V. Pavlychko"
|