diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
commit | 53fe3e46177d17b4941610de19f5cc6210700cb4 (patch) | |
tree | b67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/FloatingContacts/src | |
parent | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff) |
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/FloatingContacts/src')
-rw-r--r-- | plugins/FloatingContacts/src/main.cpp | 58 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/options.cpp | 78 |
2 files changed, 68 insertions, 68 deletions
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index f2dbe2f004..bb91bc2d10 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -278,26 +278,26 @@ static int OnPrebuildContactMenu(WPARAM wParam, LPARAM) static void LoadDBSettings()
{
- 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);
+ fcOpt.thumbAlpha = (BYTE)((double)g_plugin.getByte("Opacity", 100) * 2.55);
+ fcOpt.bHideOffline = (BOOL)g_plugin.getByte("HideOffline", 0);
+ fcOpt.bHideAll = (BOOL)g_plugin.getByte("HideAll", 0);
+ fcOpt.bHideWhenFullscreen = (BOOL)g_plugin.getByte("HideWhenFullscreen", 0);
+ fcOpt.bMoveTogether = (BOOL)g_plugin.getByte("MoveTogether", 0);
+ fcOpt.bFixedWidth = (BOOL)g_plugin.getByte("FixedWidth", 0);
+ fcOpt.nThumbWidth = (DWORD)g_plugin.getDword("Width", 0);
+ dwOfflineModes = db_get_dw(0, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES);
+ fcOpt.bShowTip = (BOOL)g_plugin.getByte("ShowTip", 1);
+ fcOpt.TimeIn = g_plugin.getWord("TimeIn", 0);
+ fcOpt.bToTop = (BOOL)g_plugin.getByte("ToTop", 0);
+ fcOpt.ToTopTime = g_plugin.getWord("ToTopTime", TOTOPTIME_DEF);
+ fcOpt.bHideWhenCListShow = (BOOL)g_plugin.getByte("HideWhenCListShow", 0);
+ fcOpt.bUseSingleClick = (BOOL)g_plugin.getByte("UseSingleClick", 0);
+ fcOpt.bShowIdle = (BOOL)g_plugin.getByte("ShowIdle", 0);
+
+ if (db_get_b(0, "ModernData", "HideBehind", 0))
+ bIsCListShow = (db_get_b(0, "ModernData", "BehindEdge", 0) == 0);
else
- bIsCListShow = (db_get_b(NULL, "CList", "State", 0) == 2);
+ bIsCListShow = (db_get_b(0, "CList", "State", 0) == 2);
}
void SendMsgDialog(HWND hwnd, wchar_t *pText)
@@ -529,7 +529,7 @@ static void CreateThumbsFont() static void CreateBackgroundBrush()
{
- bkColor = db_get_dw(NULL, MODULE, "BkColor", FLT_DEFAULT_BKGNDCOLOR);
+ bkColor = g_plugin.getDword("BkColor", FLT_DEFAULT_BKGNDCOLOR);
if (nullptr != hLTEdgesPen) {
DeleteObject(hLTEdgesPen);
@@ -552,19 +552,19 @@ static void CreateBackgroundBrush() hBkBrush = nullptr;
}
- if (db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER)) {
- COLORREF cr = (COLORREF)db_get_dw(NULL, MODULE, "LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR);
+ if (g_plugin.getByte("DrawBorder", FLT_DEFAULT_DRAWBORDER)) {
+ COLORREF cr = (COLORREF)g_plugin.getDword("LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR);
hLTEdgesPen = CreatePen(PS_SOLID, 1, cr);
- cr = (COLORREF)db_get_dw(NULL, MODULE, "RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR);
+ cr = (COLORREF)g_plugin.getDword("RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR);
hRBEdgesPen = CreatePen(PS_SOLID, 1, cr);
}
- if (db_get_b(NULL, MODULE, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP)) {
+ if (g_plugin.getByte("BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP)) {
ptrW tszBitmapName(db_get_wsa(NULL, MODULE, "BkBitmap"));
if (tszBitmapName != NULL)
hBmpBackground = Bitmap_Load(tszBitmapName);
}
- nBackgroundBmpUse = (WORD)db_get_w(NULL, MODULE, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
+ nBackgroundBmpUse = (WORD)g_plugin.getWord("BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
// Create brush
hBkBrush = CreateSolidBrush(bkColor);
@@ -676,7 +676,7 @@ static IconItemT g_iconList[] = static INT_PTR OnMainMenu_HideAll(WPARAM, LPARAM)
{
fcOpt.bHideAll = !fcOpt.bHideAll;
- db_set_b(NULL, MODULE, "HideAll", (BYTE)fcOpt.bHideAll);
+ g_plugin.setByte("HideAll", (BYTE)fcOpt.bHideAll);
OnStatusChanged();
@@ -700,7 +700,7 @@ static INT_PTR OnContactMenu_Remove(WPARAM hContact, LPARAM) static INT_PTR OnHotKey_HideWhenCListShow(WPARAM, LPARAM)
{
fcOpt.bHideWhenCListShow = !fcOpt.bHideWhenCListShow;
- db_set_b(NULL, MODULE, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
+ g_plugin.setByte("HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
OnStatusChanged();
return 0;
}
@@ -831,9 +831,9 @@ static LRESULT __stdcall newMirandaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, HideThumbsOnShowCList();
}
else if (!(wp->flags & SWP_NOMOVE)) {
- BYTE method = db_get_b(NULL, "ModernData", "HideBehind", 0);
+ BYTE method = db_get_b(0, "ModernData", "HideBehind", 0);
if (method) {
- WORD wBehindEdgeBorderSize = db_get_w(NULL, "ModernData", "HideBehindBorderSize", 0);
+ WORD wBehindEdgeBorderSize = db_get_w(0, "ModernData", "HideBehindBorderSize", 0);
RECT rc = { wp->x, wp->y, wp->x + wp->cx, wp->y + wp->cy };
RECT rcScr = { wBehindEdgeBorderSize*(2 - method), 0, GetSystemMetrics(SM_CXSCREEN) - wBehindEdgeBorderSize * (method - 1), GetSystemMetrics(SM_CYSCREEN) };
RECT rcOverlap;
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index 6f80b462eb..d90b9ca700 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -105,43 +105,43 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA 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.bHideOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_OFFLINE);
+ g_plugin.setByte("HideOffline", (BYTE)fcOpt.bHideOffline);
- fcOpt.bHideAll = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_ALL);
- db_set_b(NULL, MODULE, "HideAll", (BYTE)fcOpt.bHideAll);
+ fcOpt.bHideAll = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_ALL);
+ g_plugin.setByte("HideAll", (BYTE)fcOpt.bHideAll);
- fcOpt.bHideWhenFullscreen = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_FULSCREEN);
- db_set_b(NULL, MODULE, "HideWhenFullscreen", (BYTE)fcOpt.bHideWhenFullscreen);
+ fcOpt.bHideWhenFullscreen = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_FULSCREEN);
+ g_plugin.setByte("HideWhenFullscreen", (BYTE)fcOpt.bHideWhenFullscreen);
- fcOpt.bMoveTogether = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_STICK);
- db_set_b(NULL, MODULE, "MoveTogether", (BYTE)fcOpt.bMoveTogether);
+ fcOpt.bMoveTogether = IsDlgButtonChecked(hwndDlg, IDC_CHK_STICK);
+ g_plugin.setByte("MoveTogether", (BYTE)fcOpt.bMoveTogether);
- fcOpt.bFixedWidth = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
- db_set_b(NULL, MODULE, "FixedWidth", (BYTE)fcOpt.bFixedWidth);
+ fcOpt.bFixedWidth = IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
+ g_plugin.setByte("FixedWidth", (BYTE)fcOpt.bFixedWidth);
fcOpt.nThumbWidth = GetDlgItemInt(hwndDlg, IDC_TXT_WIDTH, &bSuccess, FALSE);
- db_set_dw(NULL, MODULE, "Width", fcOpt.nThumbWidth);
+ g_plugin.setDword("Width", fcOpt.nThumbWidth);
if (bEnableTip) {
- fcOpt.bShowTip = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
- db_set_b(NULL, MODULE, "ShowTip", (BYTE)fcOpt.bShowTip);
+ fcOpt.bShowTip = IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
+ g_plugin.setByte("ShowTip", (BYTE)fcOpt.bShowTip);
fcOpt.TimeIn = GetDlgItemInt(hwndDlg, IDC_TXT_TIMEIN, &bSuccess, FALSE);
- db_set_w(NULL, MODULE, "TimeIn", fcOpt.TimeIn);
+ g_plugin.setWord("TimeIn", fcOpt.TimeIn);
}
- fcOpt.bToTop = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
- db_set_b(NULL, MODULE, "ToTop", (BYTE)fcOpt.bToTop);
+ fcOpt.bToTop = IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
+ g_plugin.setByte("ToTop", (BYTE)fcOpt.bToTop);
fcOpt.ToTopTime = GetDlgItemInt(hwndDlg, IDC_TXT_TOTOPTIME, &bSuccess, FALSE);
- db_set_w(NULL, MODULE, "ToTopTime", fcOpt.ToTopTime);
+ g_plugin.setWord("ToTopTime", fcOpt.ToTopTime);
- fcOpt.bHideWhenCListShow = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW);
- db_set_b(NULL, MODULE, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
+ fcOpt.bHideWhenCListShow = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW);
+ g_plugin.setByte("HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
- fcOpt.bUseSingleClick = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_SINGLECLK);
- db_set_b(NULL, MODULE, "UseSingleClick", (BYTE)fcOpt.bUseSingleClick);
+ fcOpt.bUseSingleClick = IsDlgButtonChecked(hwndDlg, IDC_CHK_SINGLECLK);
+ g_plugin.setByte("UseSingleClick", (BYTE)fcOpt.bUseSingleClick);
- fcOpt.bShowIdle = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWIDLE);
- db_set_b(NULL, MODULE, "ShowIdle", (BYTE)fcOpt.bShowIdle);
+ fcOpt.bShowIdle = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWIDLE);
+ g_plugin.setByte("ShowIdle", (BYTE)fcOpt.bShowIdle);
ApplyOptionsChanges();
OnStatusChanged();
@@ -164,19 +164,19 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
// Border
- CheckDlgButton(hwndDlg, IDC_DRAWBORDER, db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DRAWBORDER, g_plugin.getByte("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, db_get_dw(NULL, MODULE, "LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR));
+ SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_SETCOLOUR, 0, g_plugin.getDword("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));
+ SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_SETCOLOUR, 0, g_plugin.getDword("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) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, g_plugin.getDword("BkColor", FLT_DEFAULT_BKGNDCOLOR));
+ CheckDlgButton(hwndDlg, IDC_BITMAP, g_plugin.getByte("BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP) ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, M_REFRESHBKGBOXES, 0, 0);
{
DBVARIANT dbv;
@@ -185,7 +185,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP db_free(&dbv);
}
- WORD bmpUse = (WORD)db_get_w(NULL, MODULE, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
+ WORD bmpUse = (WORD)g_plugin.getWord("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));
@@ -195,7 +195,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
// Windows 2K/XP
- BYTE btOpacity = (BYTE)db_get_b(NULL, MODULE, "Opacity", 100);
+ BYTE btOpacity = (BYTE)g_plugin.getByte("Opacity", 100);
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETRANGE, TRUE, MAKELONG(0, 100));
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETPOS, TRUE, btOpacity);
@@ -280,30 +280,30 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP 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);
+ fcOpt.thumbAlpha = (BYTE)((double)g_plugin.getByte("Opacity", 100) * 2.55);
SetThumbsOpacity(fcOpt.thumbAlpha);
break;
case PSN_APPLY:
// Border
- db_set_b(NULL, MODULE, "DrawBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAWBORDER));
+ g_plugin.setByte("DrawBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAWBORDER));
COLORREF col = SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, MODULE, "LTEdgesColor", col);
+ g_plugin.setDword("LTEdgesColor", col);
col = SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, MODULE, "RBEdgesColor", col);
+ g_plugin.setDword("RBEdgesColor", col);
- db_set_b(NULL, MODULE, "Opacity", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_GETPOS, 0, 0));
+ g_plugin.setByte("Opacity", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_GETPOS, 0, 0));
// Backgroud
col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, MODULE, "BkColor", col);
+ g_plugin.setDword("BkColor", col);
- db_set_b(NULL, MODULE, "BkUseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
+ g_plugin.setByte("BkUseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
wchar_t str[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
- db_set_ws(NULL, MODULE, "BkBitmap", str);
+ g_plugin.setWString("BkBitmap", str);
WORD flags = 0;
if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH))
@@ -316,7 +316,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP flags |= CLBF_TILEV;
if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL))
flags |= CLBF_PROPORTIONAL;
- db_set_w(NULL, MODULE, "BkBitmapOpt", flags);
+ g_plugin.setWord("BkBitmapOpt", flags);
ApplyOptionsChanges();
OnStatusChanged();
|