diff options
author | George Hazan <ghazan@miranda.im> | 2016-12-06 14:22:46 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2016-12-06 14:23:55 +0300 |
commit | c8e8e884a6a632c5766eddab2d84c6a6b2216d6c (patch) | |
tree | db983f5c371bd7f3c5190dcd6f6f3171947ad105 /plugins/SmileyAdd | |
parent | 8271ae317370f9c27de576075a2d779ccaf9a560 (diff) |
StdMsg & Scriver:
- switched to the toolbar buttons instead of the fixed button set;
- switched to the shared windows list
Diffstat (limited to 'plugins/SmileyAdd')
-rw-r--r-- | plugins/SmileyAdd/src/dlgboxsubclass.cpp | 193 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/download.cpp | 2 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/main.cpp | 7 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/options.cpp | 93 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/stdafx.h | 11 |
5 files changed, 116 insertions, 190 deletions
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index 70f5082737..5fddca1ebe 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -23,72 +23,13 @@ static mir_cs csWndList; // type definitions
-class MsgWndData : public MZeroedObject
+struct MsgWndData : public MZeroedObject
{
-public:
- HWND hwnd;
- char ProtocolName[52];
- HWND REdit;
- HWND MEdit;
- HWND LButton;
- mutable HWND hSmlButton;
- mutable HBITMAP hSmlBmp;
- mutable HICON hSmlIco;
- int idxLastChar;
+ HWND hwnd, hwndLog, hwndInput;
+ int idxLastChar;
+ bool doSmileyReplace, doSmileyButton;
MCONTACT hContact;
- bool doSmileyReplace;
- bool doSmileyButton;
- bool isSplit;
- bool isSend;
-
- MsgWndData()
- {
- }
-
- ~MsgWndData()
- {
- clear();
- }
-
- void clear(void)
- {
- if (hSmlBmp != NULL) {
- DeleteObject(hSmlBmp);
- hSmlBmp = NULL;
- }
- if (hSmlIco != NULL) {
- DestroyIcon(hSmlIco);
- hSmlIco = NULL;
- }
- if (hSmlButton != NULL) {
- DestroyWindow(hSmlButton);
- hSmlButton = NULL;
- }
- }
-
- RECT CalcSmileyButtonPos(void)
- {
- RECT rect;
- GetWindowRect(LButton, &rect);
-
- POINT pt;
- pt.y = rect.top;
-
- MUUID muidScriver = { 0x84636f78, 0x2057, 0x4302, { 0x8a, 0x65, 0x23, 0xa1, 0x6d, 0x46, 0x84, 0x4c } };
- int iShift = (IsPluginLoaded(muidScriver)) ? 28 : -28;
-
- if ((GetWindowLongPtr(LButton, GWL_STYLE) & WS_VISIBLE) != 0)
- pt.x = rect.left + iShift;
- else
- pt.x = rect.left;
-
- ScreenToClient(GetParent(LButton), &pt);
- rect.bottom += pt.y - rect.top;
- rect.right += pt.x - rect.left;
- rect.top = pt.y;
- rect.left = pt.x;
- return rect;
- }
+ char ProtocolName[52];
void CreateSmileyButton(void)
{
@@ -98,7 +39,6 @@ public: doSmileyButton &= SmileyPack != NULL && SmileyPack->VisibleSmileyCount() != 0;
doSmileyReplace = true;
- doSmileyButton &= db_get_b(NULL, "SRMM", "ShowButtonLine", TRUE) != 0;
if (ProtocolName[0] != 0) {
INT_PTR cap = CallProtoService(ProtocolName, PS_GETCAPS, PFLAGNUM_1, 0);
@@ -106,37 +46,13 @@ public: doSmileyReplace &= ((cap & (PF1_IMRECV | PF1_CHAT)) != 0);
}
- if (doSmileyButton && opt.PluginSupportEnabled) {
- // create smiley button
- RECT rect = CalcSmileyButtonPos();
-
- hSmlButton = CreateWindowEx(
- WS_EX_LEFT | WS_EX_NOPARENTNOTIFY | WS_EX_TOPMOST,
- MIRANDABUTTONCLASS,
- L"S",
- WS_CHILD | WS_VISIBLE | WS_TABSTOP,
- rect.left,
- rect.top,
- rect.bottom - rect.top + 1,
- rect.bottom - rect.top + 1,
- GetParent(LButton),
- (HMENU)IDC_SMLBUTTON,
- NULL, NULL);
-
- // Conversion to bitmap done to prevent Miranda from scaling the image
- SmileyType *sml = FindButtonSmiley(SmileyPack);
- if (sml != NULL) {
- hSmlBmp = sml->GetBitmap(GetSysColor(COLOR_BTNFACE), 0, 0);
- SendMessage(hSmlButton, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hSmlBmp);
- }
- else {
- hSmlIco = GetDefaultIcon();
- SendMessage(hSmlButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hSmlIco);
- }
-
- SendMessage(hSmlButton, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show smiley selection window"), 0);
- SendMessage(hSmlButton, BUTTONSETASFLATBTN, TRUE, 0);
- }
+ BBButton bbd = {};
+ bbd.pszModuleName = MODULENAME;
+ if (!doSmileyButton)
+ bbd.bbbFlags = BBBF_DISABLED;
+ else if (!opt.PluginSupportEnabled)
+ bbd.bbbFlags = BBBF_HIDDEN;
+ Srmm_SetButtonState(hContact, &bbd);
}
};
@@ -172,7 +88,6 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, switch (uMsg) {
case DM_OPTIONSAPPLIED:
- dat->clear();
dat->CreateSmileyButton();
break;
@@ -182,7 +97,7 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, GETTEXTLENGTHEX gtl;
gtl.codepage = 1200;
gtl.flags = GTL_PRECISE | GTL_NUMCHARS;
- dat->idxLastChar = (int)SendMessage(dat->REdit, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
+ dat->idxLastChar = (int)SendMessage(dat->hwndLog, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
}
break;
}
@@ -203,20 +118,13 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, }
break;
- case WM_SIZE:
- if (dat->doSmileyButton) {
- RECT rect = dat->CalcSmileyButtonPos();
- SetWindowPos(dat->hSmlButton, NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
- }
- break;
-
case DM_APPENDTOLOG:
if (dat->doSmileyReplace) {
SmileyPackCType *smcp;
SmileyPackType *SmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact, &smcp);
if (SmileyPack != NULL) {
const CHARRANGE sel = { dat->idxLastChar, LONG_MAX };
- ReplaceSmileys(dat->REdit, SmileyPack, smcp, sel, false, false, false);
+ ReplaceSmileys(dat->hwndLog, SmileyPack, smcp, sel, false, false, false);
}
}
break;
@@ -227,38 +135,56 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, SmileyPackType *SmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact, &smcp);
if (SmileyPack != NULL) {
static const CHARRANGE sel = { 0, LONG_MAX };
- ReplaceSmileys(dat->REdit, SmileyPack, smcp, sel, false, false, false);
+ ReplaceSmileys(dat->hwndLog, SmileyPack, smcp, sel, false, false, false);
}
}
break;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_SMLBUTTON && HIWORD(wParam) == BN_CLICKED) {
- RECT rect;
- GetWindowRect(dat->hSmlButton, &rect);
-
- SmileyToolWindowParam *stwp = new SmileyToolWindowParam;
- stwp->pSmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact);
- stwp->hWndParent = hwnd;
- stwp->hWndTarget = dat->MEdit;
- stwp->targetMessage = EM_REPLACESEL;
- stwp->targetWParam = TRUE;
- stwp->direction = 0;
- stwp->xPosition = rect.left;
- stwp->yPosition = rect.top + 24;
- mir_forkthread(SmileyToolThread, stwp);
- }
-
- if (LOWORD(wParam) == MI_IDC_ADD && HIWORD(wParam) == BN_CLICKED && dat->doSmileyButton) {
- RECT rect = dat->CalcSmileyButtonPos();
- SetWindowPos(dat->hSmlButton, NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
- }
- break;
}
return result;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// toolbar button processing
+
+int SmileyButtonCreate(WPARAM, LPARAM)
+{
+ BBButton bbd = {};
+ bbd.pszModuleName = MODULENAME;
+ bbd.pwszTooltip = LPGENW("Show smiley selection window");
+ bbd.dwDefPos = 31;
+ bbd.hIcon = IcoLib_GetIconHandle("SmileyAdd_ButtonSmiley");
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
+ Srmm_AddButton(&bbd);
+ return 0;
+}
+
+int SmileyButtonPressed(WPARAM, LPARAM lParam)
+{
+ CustomButtonClickData *pcbc = (CustomButtonClickData*)lParam;
+ if (mir_strcmp(pcbc->pszModule, MODULENAME))
+ return 0;
+
+ MsgWndData *dat = IsMsgWnd(pcbc->hwndFrom);
+ if (dat == NULL)
+ return 0;
+
+ SmileyToolWindowParam *stwp = new SmileyToolWindowParam;
+ stwp->pSmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact);
+ stwp->hWndParent = pcbc->hwndFrom;
+ stwp->hWndTarget = dat->hwndInput;
+ stwp->targetMessage = EM_REPLACESEL;
+ stwp->targetWParam = TRUE;
+ stwp->direction = 0;
+ stwp->xPosition = pcbc->pt.x;
+ stwp->yPosition = pcbc->pt.y;
+ mir_forkthread(SmileyToolThread, stwp);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// window hook
+
static int MsgDlgHook(WPARAM, LPARAM lParam)
{
const MessageWindowEventData *wndEvtData = (MessageWindowEventData*)lParam;
@@ -268,11 +194,8 @@ static int MsgDlgHook(WPARAM, LPARAM lParam) MsgWndData *msgwnd = new MsgWndData();
msgwnd->hwnd = wndEvtData->hwndWindow;
msgwnd->hContact = wndEvtData->hContact;
- msgwnd->REdit = wndEvtData->hwndLog;
- msgwnd->MEdit = wndEvtData->hwndInput;
- msgwnd->LButton = GetDlgItem(wndEvtData->hwndWindow, MI_IDC_ADD);
- if (msgwnd->LButton == NULL)
- msgwnd->LButton = GetDlgItem(wndEvtData->hwndWindow, 5019);
+ msgwnd->hwndLog = wndEvtData->hwndLog;
+ msgwnd->hwndInput = wndEvtData->hwndInput;
// Get the protocol for this contact to display correct smileys.
char *protonam = GetContactProto(DecodeMetaContact(msgwnd->hContact));
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index fe117a0b9e..1a68a8c86b 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -220,7 +220,7 @@ void DownloadInit(void) {
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
- nlu.szSettingsModule = "SmileyAdd";
+ nlu.szSettingsModule = MODULENAME;
nlu.ptszDescriptiveName = TranslateT("SmileyAdd HTTP connections");
hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 112f3face5..a2d6c704df 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -61,14 +61,14 @@ static int ModulesLoaded(WPARAM, LPARAM) DownloadInit();
- //install hooks if enabled
+ // install hooks if enabled
InstallDialogBoxHook();
g_SmileyCategories.AddAllProtocolsAsCategory();
g_SmileyCategories.ClearAndLoadAll();
ColourID cid = { sizeof(cid) };
- strcpy_s(cid.dbSettingsGroup, "SmileyAdd");
+ strcpy_s(cid.dbSettingsGroup, MODULENAME);
strcpy_s(cid.group, LPGEN("SmileyAdd"));
strcpy_s(cid.name, LPGEN("Background color"));
strcpy_s(cid.setting, "SelWndBkgClr");
@@ -114,6 +114,9 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged);
HookEvent(ME_COLOUR_RELOAD, ReloadColour);
+ HookEvent(ME_MSG_BUTTONPRESSED, SmileyButtonPressed);
+ HookEvent(ME_MSG_TOOLBARLOADED, SmileyButtonCreate);
+
//create the smiley services
CreateServiceFunction(MS_SMILEYADD_REPLACESMILEYS, ReplaceSmileysCommand);
CreateServiceFunction(MS_SMILEYADD_SHOWSELECTION, ShowSmileySelectionCommand);
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index b5570be9ed..f7341b561d 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -543,68 +543,67 @@ void OptionsDialogType::ShowSmileyPreview(void) void OptionsType::Save(void)
{
- db_set_b(NULL, "SmileyAdd", "PluginSupportEnabled", PluginSupportEnabled);
- db_set_b(NULL, "SmileyAdd", "EnforceSpaces", EnforceSpaces);
- db_set_b(NULL, "SmileyAdd", "ScaleToTextheight", ScaleToTextheight);
- db_set_b(NULL, "SmileyAdd", "UseOneForAll", UseOneForAll);
- db_set_b(NULL, "SmileyAdd", "UsePhysProto", UsePhysProto);
- db_set_b(NULL, "SmileyAdd", "SurroundSmileyWithSpaces", SurroundSmileyWithSpaces);
- db_set_b(NULL, "SmileyAdd", "ScaleAllSmileys", ScaleAllSmileys);
- db_set_b(NULL, "SmileyAdd", "IEViewStyle", IEViewStyle);
- db_set_b(NULL, "SmileyAdd", "AnimateSel", AnimateSel);
- db_set_b(NULL, "SmileyAdd", "AnimateDlg", AnimateDlg);
- db_set_b(NULL, "SmileyAdd", "InputSmileys", InputSmileys);
- db_set_b(NULL, "SmileyAdd", "DCursorSmiley", DCursorSmiley);
- db_set_b(NULL, "SmileyAdd", "DisableCustom", DisableCustom);
- db_set_b(NULL, "SmileyAdd", "HQScaling", HQScaling);
- db_set_b(NULL, "SmileyAdd", "ButtonStatus", (BYTE)ButtonStatus);
- db_set_dw(NULL, "SmileyAdd", "MaxCustomSmileySize", MaxCustomSmileySize);
- db_set_dw(NULL, "SmileyAdd", "MinSmileySize", MinSmileySize);
- db_set_b(NULL, "SmileyAdd", "HorizontalSorting", HorizontalSorting);
+ db_set_b(NULL, MODULENAME, "PluginSupportEnabled", PluginSupportEnabled);
+ db_set_b(NULL, MODULENAME, "EnforceSpaces", EnforceSpaces);
+ db_set_b(NULL, MODULENAME, "ScaleToTextheight", ScaleToTextheight);
+ db_set_b(NULL, MODULENAME, "UseOneForAll", UseOneForAll);
+ db_set_b(NULL, MODULENAME, "UsePhysProto", UsePhysProto);
+ db_set_b(NULL, MODULENAME, "SurroundSmileyWithSpaces", SurroundSmileyWithSpaces);
+ db_set_b(NULL, MODULENAME, "ScaleAllSmileys", ScaleAllSmileys);
+ db_set_b(NULL, MODULENAME, "IEViewStyle", IEViewStyle);
+ db_set_b(NULL, MODULENAME, "AnimateSel", AnimateSel);
+ db_set_b(NULL, MODULENAME, "AnimateDlg", AnimateDlg);
+ db_set_b(NULL, MODULENAME, "InputSmileys", InputSmileys);
+ db_set_b(NULL, MODULENAME, "DCursorSmiley", DCursorSmiley);
+ db_set_b(NULL, MODULENAME, "DisableCustom", DisableCustom);
+ db_set_b(NULL, MODULENAME, "HQScaling", HQScaling);
+ db_set_b(NULL, MODULENAME, "ButtonStatus", (BYTE)ButtonStatus);
+ db_set_dw(NULL, MODULENAME, "MaxCustomSmileySize", MaxCustomSmileySize);
+ db_set_dw(NULL, MODULENAME, "MinSmileySize", MinSmileySize);
+ db_set_b(NULL, MODULENAME, "HorizontalSorting", HorizontalSorting);
}
void OptionsType::Load(void)
{
- PluginSupportEnabled = db_get_b(NULL, "SmileyAdd", "PluginSupportEnabled", TRUE) != 0;
- EnforceSpaces = db_get_b(NULL, "SmileyAdd", "EnforceSpaces", FALSE) != 0;
- ScaleToTextheight = db_get_b(NULL, "SmileyAdd", "ScaleToTextheight", FALSE) != 0;
- UseOneForAll = db_get_b(NULL, "SmileyAdd", "UseOneForAll", TRUE) != 0;
- UsePhysProto = db_get_b(NULL, "SmileyAdd", "UsePhysProto", FALSE) != 0;
- SurroundSmileyWithSpaces =
- db_get_b(NULL, "SmileyAdd", "SurroundSmileyWithSpaces", FALSE) != 0;
- ScaleAllSmileys = db_get_b(NULL, "SmileyAdd", "ScaleAllSmileys", FALSE) != 0;
- IEViewStyle = db_get_b(NULL, "SmileyAdd", "IEViewStyle", FALSE) != 0;
- AnimateSel = db_get_b(NULL, "SmileyAdd", "AnimateSel", TRUE) != 0;
- AnimateDlg = db_get_b(NULL, "SmileyAdd", "AnimateDlg", TRUE) != 0;
- InputSmileys = db_get_b(NULL, "SmileyAdd", "InputSmileys", TRUE) != 0;
- DCursorSmiley = db_get_b(NULL, "SmileyAdd", "DCursorSmiley", FALSE) != 0;
- DisableCustom = db_get_b(NULL, "SmileyAdd", "DisableCustom", FALSE) != 0;
- HQScaling = db_get_b(NULL, "SmileyAdd", "HQScaling", FALSE) != 0;
-
- ButtonStatus = db_get_b(NULL, "SmileyAdd", "ButtonStatus", 1);
- SelWndBkgClr = db_get_dw(NULL, "SmileyAdd", "SelWndBkgClr", GetSysColor(COLOR_WINDOW));
- MaxCustomSmileySize = db_get_dw(NULL, "SmileyAdd", "MaxCustomSmileySize", 0);
- MinSmileySize = db_get_dw(NULL, "SmileyAdd", "MinSmileySize", 0);
- HorizontalSorting = db_get_b(NULL, "SmileyAdd", "HorizontalSorting", 1) != 0;
+ PluginSupportEnabled = db_get_b(NULL, MODULENAME, "PluginSupportEnabled", TRUE) != 0;
+ EnforceSpaces = db_get_b(NULL, MODULENAME, "EnforceSpaces", FALSE) != 0;
+ ScaleToTextheight = db_get_b(NULL, MODULENAME, "ScaleToTextheight", FALSE) != 0;
+ UseOneForAll = db_get_b(NULL, MODULENAME, "UseOneForAll", TRUE) != 0;
+ UsePhysProto = db_get_b(NULL, MODULENAME, "UsePhysProto", FALSE) != 0;
+ SurroundSmileyWithSpaces = db_get_b(NULL, MODULENAME, "SurroundSmileyWithSpaces", FALSE) != 0;
+ ScaleAllSmileys = db_get_b(NULL, MODULENAME, "ScaleAllSmileys", FALSE) != 0;
+ IEViewStyle = db_get_b(NULL, MODULENAME, "IEViewStyle", FALSE) != 0;
+ AnimateSel = db_get_b(NULL, MODULENAME, "AnimateSel", TRUE) != 0;
+ AnimateDlg = db_get_b(NULL, MODULENAME, "AnimateDlg", TRUE) != 0;
+ InputSmileys = db_get_b(NULL, MODULENAME, "InputSmileys", TRUE) != 0;
+ DCursorSmiley = db_get_b(NULL, MODULENAME, "DCursorSmiley", FALSE) != 0;
+ DisableCustom = db_get_b(NULL, MODULENAME, "DisableCustom", FALSE) != 0;
+ HQScaling = db_get_b(NULL, MODULENAME, "HQScaling", FALSE) != 0;
+
+ ButtonStatus = db_get_b(NULL, MODULENAME, "ButtonStatus", 1);
+ SelWndBkgClr = db_get_dw(NULL, MODULENAME, "SelWndBkgClr", GetSysColor(COLOR_WINDOW));
+ MaxCustomSmileySize = db_get_dw(NULL, MODULENAME, "MaxCustomSmileySize", 0);
+ MinSmileySize = db_get_dw(NULL, MODULENAME, "MinSmileySize", 0);
+ HorizontalSorting = db_get_b(NULL, MODULENAME, "HorizontalSorting", 1) != 0;
}
void OptionsType::ReadPackFileName(CMStringW &filename, const CMStringW &name, const CMStringW &defaultFilename)
{
CMStringW settingKey = name + L"-filename";
- ptrW tszValue(db_get_wsa(NULL, "SmileyAdd", _T2A(settingKey.c_str())));
+ ptrW tszValue(db_get_wsa(NULL, MODULENAME, _T2A(settingKey.c_str())));
filename = (tszValue != NULL) ? (wchar_t*)tszValue : defaultFilename;
}
void OptionsType::WritePackFileName(const CMStringW &filename, const CMStringW &name)
{
CMStringW settingKey = name + L"-filename";
- db_set_ws(NULL, "SmileyAdd", _T2A(settingKey.c_str()), filename.c_str());
+ db_set_ws(NULL, MODULENAME, _T2A(settingKey.c_str()), filename.c_str());
}
void OptionsType::ReadCustomCategories(CMStringW &cats)
{
- ptrW tszValue(db_get_wsa(NULL, "SmileyAdd", "CustomCategories"));
+ ptrW tszValue(db_get_wsa(NULL, MODULENAME, "CustomCategories"));
if (tszValue != NULL)
cats = tszValue;
}
@@ -612,14 +611,14 @@ void OptionsType::ReadCustomCategories(CMStringW &cats) void OptionsType::WriteCustomCategories(const CMStringW &cats)
{
if (cats.IsEmpty())
- db_unset(NULL, "SmileyAdd", "CustomCategories");
+ db_unset(NULL, MODULENAME, "CustomCategories");
else
- db_set_ws(NULL, "SmileyAdd", "CustomCategories", cats.c_str());
+ db_set_ws(NULL, MODULENAME, "CustomCategories", cats.c_str());
}
void OptionsType::ReadContactCategory(MCONTACT hContact, CMStringW &cats)
{
- ptrW tszValue(db_get_wsa(hContact, "SmileyAdd", "CustomCategory"));
+ ptrW tszValue(db_get_wsa(hContact, MODULENAME, "CustomCategory"));
if (tszValue != NULL)
cats = tszValue;
}
@@ -627,9 +626,9 @@ void OptionsType::ReadContactCategory(MCONTACT hContact, CMStringW &cats) void OptionsType::WriteContactCategory(MCONTACT hContact, const CMStringW &cats)
{
if (cats.IsEmpty())
- db_unset(hContact, "SmileyAdd", "CustomCategory");
+ db_unset(hContact, MODULENAME, "CustomCategory");
else
- db_set_ws(hContact, "SmileyAdd", "CustomCategory", cats.c_str());
+ db_set_ws(hContact, MODULENAME, "CustomCategory", cats.c_str());
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/SmileyAdd/src/stdafx.h b/plugins/SmileyAdd/src/stdafx.h index bd91bfe5a5..f467be8697 100644 --- a/plugins/SmileyAdd/src/stdafx.h +++ b/plugins/SmileyAdd/src/stdafx.h @@ -99,9 +99,7 @@ extern SmileyCategoryListType g_SmileyCategories; extern SmileyPackListType g_SmileyPacks;
extern LIST<void> menuHandleArray;
-#define IDC_SMLBUTTON (WM_USER + 33)
-
-#define MI_IDC_ADD 1070 // Add button
+#define MODULENAME "SmileyAdd"
#define DM_REMAKELOG (WM_USER + 11)
#define DM_OPTIONSAPPLIED (WM_USER + 14)
@@ -116,9 +114,12 @@ extern LIST<void> menuHandleArray; // init functions
void InstallDialogBoxHook(void);
void RemoveDialogBoxHook(void);
-int UpdateSrmmDlg(WPARAM wParam, LPARAM lParam);
-//functions for general use (defined in general.cpp)
+int UpdateSrmmDlg(WPARAM, LPARAM);
+int SmileyButtonCreate(WPARAM, LPARAM);
+int SmileyButtonPressed(WPARAM, LPARAM);
+
+// functions for general use (defined in general.cpp)
int CalculateTextHeight(HDC hdc, CHARFORMAT2 *chf);
const wchar_t* GetImageExt(CMStringW &fname);
|