diff options
author | George Hazan <george.hazan@gmail.com> | 2016-03-03 14:07:30 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-03-03 14:07:30 +0000 |
commit | 44223012ce0fa631cc5af6fc588166bccc3a66f6 (patch) | |
tree | ce2964a947203e59056e7987dc675c21d291b222 /plugins | |
parent | 5357bfc0d1ca654ae51f71ca67a8faad0d5b5264 (diff) |
- more obsolete shit removed;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
25 files changed, 351 insertions, 507 deletions
diff --git a/plugins/SmileyAdd/src/SmileyBase.cpp b/plugins/SmileyAdd/src/SmileyBase.cpp index f5d545bfb6..8d9a58b94f 100644 --- a/plugins/SmileyAdd/src/SmileyBase.cpp +++ b/plugins/SmileyAdd/src/SmileyBase.cpp @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-static void HiMetricToPixel(const SIZEL * lpSizeInHiMetric, LPSIZEL lpSizeInPix)
+static void HiMetricToPixel(const SIZEL *lpSizeInHiMetric, LPSIZEL lpSizeInPix)
{
HDC hDCScreen = GetDC(NULL);
const int nPixelsPerInchX = GetDeviceCaps(hDCScreen, LOGPIXELSX);
@@ -91,18 +91,17 @@ void ISmileyBase::SendOnViewChange(void) }
}
-bool ISmileyBase::QueryHitPointSpecial(int x, int y, HWND hwnd, TCHAR** smltxt)
+bool ISmileyBase::QueryHitPointSpecial(int x, int y, HWND hwnd, TCHAR **smltxt)
{
bool result = m_visible && m_hwnd == hwnd;
- if (result) {
- result = x >= m_orect.left && x <= m_orect.right &&
- y >= m_orect.top && y <= m_orect.bottom;
- }
- if (result) *smltxt = m_smltxt;
+ if (result)
+ result = (x >= m_orect.left && x <= m_orect.right && y >= m_orect.top && y <= m_orect.bottom);
+ if (result)
+ *smltxt = m_smltxt;
return result;
}
-void ISmileyBase::SetHint(TCHAR* smltxt)
+void ISmileyBase::SetHint(TCHAR *smltxt)
{
m_smltxt = _tcsdup(smltxt);
}
@@ -152,7 +151,7 @@ ULONG ISmileyBase::Release(void) }
-HRESULT ISmileyBase::QueryInterface(REFIID iid, void ** ppvObject)
+HRESULT ISmileyBase::QueryInterface(REFIID iid, void **ppvObject)
{
// check to see what interface has been requested
if (ppvObject == NULL) return E_POINTER;
@@ -195,12 +194,12 @@ HRESULT ISmileyBase::GetClientSite(IOleClientSite **ppClientSite) return S_OK;
}
-HRESULT ISmileyBase::SetHostNames(LPCOLESTR /* szContainerApp */, LPCOLESTR /* szContainerObj */)
+HRESULT ISmileyBase::SetHostNames(LPCOLESTR, LPCOLESTR)
{
return S_OK;
}
-HRESULT ISmileyBase::Close(DWORD /* dwSaveOption */)
+HRESULT ISmileyBase::Close(DWORD)
{
regSmileys.remove(this);
@@ -212,33 +211,32 @@ HRESULT ISmileyBase::Close(DWORD /* dwSaveOption */) return S_OK;
}
-HRESULT ISmileyBase::SetMoniker(DWORD /* dwWhichMoniker */, IMoniker* /* pmk */)
+HRESULT ISmileyBase::SetMoniker(DWORD, IMoniker*)
{
return E_NOTIMPL;
}
-HRESULT ISmileyBase::GetMoniker(DWORD /* dwAssign */, DWORD /* dwWhichMoniker */, IMoniker** /* ppmk */)
+HRESULT ISmileyBase::GetMoniker(DWORD, DWORD, IMoniker**)
{
return E_NOTIMPL;
}
-HRESULT ISmileyBase::InitFromData(IDataObject* /* pDataObject */, BOOL /* fCreation */, DWORD /* dwReserved */)
+HRESULT ISmileyBase::InitFromData(IDataObject*, BOOL, DWORD)
{
return E_NOTIMPL;
}
-HRESULT ISmileyBase::GetClipboardData(DWORD /* dwReserved */, IDataObject** /* ppDataObject */)
+HRESULT ISmileyBase::GetClipboardData(DWORD, IDataObject**)
{
return E_NOTIMPL;
}
-HRESULT ISmileyBase::DoVerb(LONG /* iVerb */, LPMSG /* pMsg */, IOleClientSite* /* pActiveSite */, LONG /* lindex */,
- HWND /* hwndParent */, LPCRECT /* lprcPosRect */)
+HRESULT ISmileyBase::DoVerb(LONG, LPMSG, IOleClientSite*, LONG, HWND, LPCRECT)
{
return E_NOTIMPL;
}
-HRESULT ISmileyBase::EnumVerbs(IEnumOLEVERB** /*ppEnumOleVerb*/) { return E_NOTIMPL; }
+HRESULT ISmileyBase::EnumVerbs(IEnumOLEVERB**) { return E_NOTIMPL; }
HRESULT ISmileyBase::Update(void) { return S_OK; }
HRESULT ISmileyBase::IsUpToDate(void) { return S_OK; }
@@ -249,12 +247,12 @@ HRESULT ISmileyBase::GetUserClassID(CLSID *pClsid) return S_OK;
}
-HRESULT ISmileyBase::GetUserType(DWORD /*dwFormOfType*/, LPOLESTR* /*pszUserType*/)
+HRESULT ISmileyBase::GetUserType(DWORD, LPOLESTR*)
{
return E_NOTIMPL;
}
-HRESULT ISmileyBase::SetExtent(DWORD dwDrawAspect, SIZEL* psizel)
+HRESULT ISmileyBase::SetExtent(DWORD dwDrawAspect, SIZEL *psizel)
{
if (dwDrawAspect != DVASPECT_CONTENT) return E_FAIL;
if (psizel == NULL) return E_POINTER;
@@ -310,7 +308,7 @@ HRESULT ISmileyBase::GetMiscStatus(DWORD dwAspect, DWORD *pdwStatus) }
}
-HRESULT ISmileyBase::SetColorScheme(LOGPALETTE* /* pLogpal */)
+HRESULT ISmileyBase::SetColorScheme(LOGPALETTE*)
{
return E_NOTIMPL;
}
@@ -318,16 +316,17 @@ HRESULT ISmileyBase::SetColorScheme(LOGPALETTE* /* pLogpal */) //
// IViewObject members
//
-HRESULT ISmileyBase::SetAdvise(DWORD aspect, DWORD advf, IAdviseSink* pAdvSink)
+HRESULT ISmileyBase::SetAdvise(DWORD aspect, DWORD advf, IAdviseSink *pAdvSink)
{
if (aspect != DVASPECT_CONTENT) return DV_E_DVASPECT;
m_advf = advf;
if (m_spAdviseSink) m_spAdviseSink->Release();
m_spAdviseSink = pAdvSink;
- if (advf & ADVF_PRIMEFIRST) SendOnViewChange();
+ if (advf & ADVF_PRIMEFIRST)
+ SendOnViewChange();
return S_OK;
}
-HRESULT ISmileyBase::GetAdvise(DWORD* /*pAspects*/, DWORD* /*pAdvf*/, IAdviseSink** ppAdvSink)
+HRESULT ISmileyBase::GetAdvise(DWORD*, DWORD*, IAdviseSink **ppAdvSink)
{
if (!ppAdvSink) return E_POINTER;
*ppAdvSink = m_spAdviseSink;
@@ -342,7 +341,7 @@ HRESULT ISmileyBase::GetColorSet(DWORD, long, void*, DVTARGETDEVICE*, HDC, LOGPA //
// IViewObject2 members
//
-HRESULT ISmileyBase::GetExtent(DWORD aspect, long, DVTARGETDEVICE*, SIZEL* pSize)
+HRESULT ISmileyBase::GetExtent(DWORD aspect, long, DVTARGETDEVICE*, SIZEL *pSize)
{
if (pSize == NULL) return E_POINTER;
if (aspect != DVASPECT_CONTENT) return DV_E_DVASPECT;
@@ -354,7 +353,7 @@ HRESULT ISmileyBase::GetExtent(DWORD aspect, long, DVTARGETDEVICE*, SIZEL* pSize //
// ITooltipData members
//
-HRESULT ISmileyBase::SetTooltip(BSTR /* bstrHint */)
+HRESULT ISmileyBase::SetTooltip(BSTR)
{
return S_OK;
}
@@ -375,7 +374,7 @@ void CloseSmileys(void) }
}
-int CheckForTip(int x, int y, HWND hwnd, TCHAR** smltxt)
+int CheckForTip(int x, int y, HWND hwnd, TCHAR **smltxt)
{
for (int i = 0; i < regSmileys.getCount(); i++)
if (regSmileys[i]->QueryHitPointSpecial(x, y, hwnd, smltxt))
diff --git a/plugins/SmileyAdd/src/SmileyBase.h b/plugins/SmileyAdd/src/SmileyBase.h index 4f695b8ac8..10378a52b3 100644 --- a/plugins/SmileyAdd/src/SmileyBase.h +++ b/plugins/SmileyAdd/src/SmileyBase.h @@ -24,7 +24,7 @@ class ITooltipData : public IUnknown {
public:
STDMETHOD(SetTooltip) (BSTR bstrHint) PURE;
- STDMETHOD(GetTooltip) (BSTR * bstrHint) PURE;
+ STDMETHOD(GetTooltip) (BSTR *bstrHint) PURE;
};
@@ -56,8 +56,8 @@ public: virtual void OnClose(void);
void SendOnViewChange(void);
- bool QueryHitPointSpecial(int x, int y, HWND hwnd, TCHAR** smltxt);
- void SetHint(TCHAR* smltxt);
+ bool QueryHitPointSpecial(int x, int y, HWND hwnd, TCHAR **smltxt);
+ void SetHint(TCHAR *smltxt);
virtual void Draw() PURE;
virtual void SetPosition(HWND hwnd, LPCRECT lpRect);
@@ -67,7 +67,7 @@ public: //
STDMETHOD_(ULONG, AddRef)(void);
STDMETHOD_(ULONG, Release)(void);
- STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
+ STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject);
//
// IOleObject members
@@ -106,7 +106,7 @@ public: //
// IViewObject2 members
//
- STDMETHOD(GetExtent)(DWORD aspect, long, DVTARGETDEVICE*, SIZEL* pSize);
+ STDMETHOD(GetExtent)(DWORD aspect, long, DVTARGETDEVICE*, SIZEL *pSize);
//
// ITooltipData members
diff --git a/plugins/SmileyAdd/src/anim.cpp b/plugins/SmileyAdd/src/anim.cpp index fdaedf9b9a..6770f81064 100644 --- a/plugins/SmileyAdd/src/anim.cpp +++ b/plugins/SmileyAdd/src/anim.cpp @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-Animate::Animate(SmileyType *sml, RECT& rect, HDC hdcMem, HBRUSH hbr, bool clip) :
+Animate::Animate(SmileyType *sml, RECT &rect, HDC hdcMem, HBRUSH hbr, bool clip) :
m_sml(sml),
m_img(NULL),
m_nFramePosition(0), m_sel(false), m_clip(clip),
@@ -114,7 +114,7 @@ void Animate::SetSel(int x, int y) m_sel = x >= m_cliprect.left && x < m_cliprect.right && y >= m_cliprect.top && y < m_cliprect.bottom;
}
-AnimatedPack::AnimatedPack(HWND hwnd, int wsize, SIZE& sel, COLORREF bkg)
+AnimatedPack::AnimatedPack(HWND hwnd, int wsize, SIZE &sel, COLORREF bkg)
: m_AniList(40), m_hwnd(hwnd), m_wsize(wsize)
{
HDC hdc = GetDC(hwnd);
@@ -152,7 +152,7 @@ void AnimatedPack::SetOffset(int off) m_AniList[i].SetOffset(off, m_wsize);
}
-void AnimatedPack::SetSel(RECT& rect)
+void AnimatedPack::SetSel(RECT &rect)
{
for (int i = 0; i < m_AniList.getCount(); i++)
m_AniList[i].SetSel(rect.left, rect.top);
diff --git a/plugins/SmileyAdd/src/anim.h b/plugins/SmileyAdd/src/anim.h index eb1b0c0fe7..86e33a968a 100644 --- a/plugins/SmileyAdd/src/anim.h +++ b/plugins/SmileyAdd/src/anim.h @@ -68,13 +68,13 @@ private: HBITMAP m_hOld;
public:
- AnimatedPack(HWND hwnd, int wsize, SIZE& sel, COLORREF bkg);
+ AnimatedPack(HWND hwnd, int wsize, SIZE &sel, COLORREF bkg);
~AnimatedPack();
void Add(SmileyType *sml, RECT rect, bool clip);
void Draw(HDC hdc);
void SetOffset(int off);
- void SetSel(RECT& rect);
+ void SetSel(RECT &rect);
void ProcessTimerTick(HWND hwnd);
};
diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index e46cb4a4cd..0a6be1ca46 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. SmileyPackCListType g_SmileyPackCStore;
-bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, TCHAR* dir)
+bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, TCHAR *dir)
{
bool res = true;
if (GetSmileyPack(hContact) == NULL) {
@@ -36,7 +36,7 @@ bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, TCHAR* dir) return res;
}
-bool SmileyPackCListType::AddSmiley(MCONTACT hContact, TCHAR* path)
+bool SmileyPackCListType::AddSmiley(MCONTACT hContact, TCHAR *path)
{
SmileyPackCType *smpack = GetSmileyPack(hContact);
if (smpack == NULL) {
@@ -59,13 +59,13 @@ SmileyPackCType* SmileyPackCListType::GetSmileyPack(MCONTACT id) }
-SmileyCType::SmileyCType(const CMString& fullpath, const TCHAR* filepath)
+SmileyCType::SmileyCType(const CMString &fullpath, const TCHAR *filepath)
{
LoadFromResource(fullpath, 0);
CreateTriggerText(_T2A(filepath));
}
-bool SmileyCType::CreateTriggerText(char* text)
+bool SmileyCType::CreateTriggerText(char *text)
{
UrlDecode(text);
@@ -93,7 +93,7 @@ bool SmileyCType::CreateTriggerText(char* text) // SmileyPackCType
//
-bool SmileyPackCType::LoadSmileyDir(TCHAR* dir)
+bool SmileyPackCType::LoadSmileyDir(TCHAR *dir)
{
CMString dirs = dir;
dirs += _T("\\*.*");
@@ -105,7 +105,7 @@ bool SmileyPackCType::LoadSmileyDir(TCHAR* dir) if (c_file.name[0] != '.') {
CMString fullpath = dir;
fullpath = fullpath + _T("\\") + c_file.name;
- TCHAR* div = _tcsrchr(c_file.name, '.');
+ TCHAR *div = _tcsrchr(c_file.name, '.');
if (div) {
*div = 0;
SmileyCType *smlc = new SmileyCType(fullpath, c_file.name);
diff --git a/plugins/SmileyAdd/src/customsmiley.h b/plugins/SmileyAdd/src/customsmiley.h index 7e5f10b015..3517d348cd 100644 --- a/plugins/SmileyAdd/src/customsmiley.h +++ b/plugins/SmileyAdd/src/customsmiley.h @@ -22,9 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class SmileyCType : public SmileyType
{
public:
- SmileyCType(const CMString& fullpath, const TCHAR* filepath);
+ SmileyCType(const CMString &fullpath, const TCHAR *filepath);
- bool CreateTriggerText(char* text);
+ bool CreateTriggerText(char *text);
};
class SmileyPackCType
@@ -39,7 +39,6 @@ private: MCONTACT m_id;
- void InsertLookup(SmileyCType& sml, CMString& lk, bool first);
void AddTriggersToSmileyLookup(void);
public:
@@ -53,8 +52,8 @@ public: MCONTACT GetId(void) { return m_id; }
void SetId(MCONTACT id) { m_id = id; }
- bool LoadSmileyDir(TCHAR* dir);
- bool LoadSmiley(TCHAR* path);
+ bool LoadSmiley(TCHAR *path);
+ bool LoadSmileyDir(TCHAR *dir);
};
@@ -69,8 +68,8 @@ private: public:
int NumberOfSmileyPacks(void) { return m_SmileyPacks.getCount(); }
- bool AddSmileyPack(MCONTACT hContact, TCHAR* dir);
- bool AddSmiley(MCONTACT hContact, TCHAR* path);
+ bool AddSmiley(MCONTACT hContact, TCHAR *path);
+ bool AddSmileyPack(MCONTACT hContact, TCHAR *dir);
void ClearAndFreeAll(void) { m_SmileyPacks.destroy(); }
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index 0c5d6d184c..255c6ed05f 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -19,21 +19,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-static mir_cs csHook;
+static mir_cs csWndList;
static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
// type definitions
-class MsgWndData
+class MsgWndData : public MZeroedObject
{
public:
HWND hwnd;
char ProtocolName[52];
HWND REdit;
- HWND QuoteB;
HWND MEdit;
- HWND MOK;
HWND LButton;
mutable HWND hSmlButton;
mutable HBITMAP hSmlBmp;
@@ -42,36 +40,11 @@ public: MCONTACT hContact;
bool doSmileyReplace;
bool doSmileyButton;
- bool OldButtonPlace;
bool isSplit;
bool isSend;
MsgWndData()
{
- ProtocolName[0] = 0;
- REdit = NULL;
- QuoteB = NULL;
- MEdit = NULL;
- MOK = NULL;
- LButton = NULL;
- hSmlButton = NULL;
- hSmlBmp = NULL;
- hSmlIco = NULL;
- idxLastChar = 0;
- hContact = NULL;
- doSmileyReplace = false;
- doSmileyButton = false;
- OldButtonPlace = false;
- isSplit = false;
- isSend = false;
- }
-
- MsgWndData(const MsgWndData &dsb)
- {
- *this = dsb;
- dsb.hSmlBmp = NULL;
- dsb.hSmlIco = NULL;
- dsb.hSmlButton = NULL;
}
~MsgWndData()
@@ -81,12 +54,18 @@ public: void clear(void)
{
- if (hSmlBmp != NULL) DeleteObject(hSmlBmp);
- if (hSmlIco != NULL) DestroyIcon(hSmlIco);
- if (hSmlButton != NULL) DestroyWindow(hSmlButton);
- hSmlBmp = NULL;
- hSmlIco = NULL;
- hSmlButton = NULL;
+ if (hSmlBmp != NULL) {
+ DeleteObject(hSmlBmp);
+ hSmlBmp = NULL;
+ }
+ if (hSmlIco != NULL) {
+ DestroyIcon(hSmlIco);
+ hSmlIco = NULL;
+ }
+ if (hSmlButton != NULL) {
+ DestroyWindow(hSmlButton);
+ hSmlButton = NULL;
+ }
}
RECT CalcSmileyButtonPos(void)
@@ -94,27 +73,13 @@ public: RECT rect;
POINT pt;
- if (OldButtonPlace) {
- if (isSplit && db_get_b(NULL, "SRMsg", "ShowQuote", FALSE)) {
- GetWindowRect(QuoteB, &rect);
- pt.x = rect.right + 12;
- }
- else {
- GetWindowRect(MEdit, &rect);
- pt.x = rect.left;
- }
- GetWindowRect(MOK, &rect);
- pt.y = rect.top;
- }
- else {
- GetWindowRect(LButton, &rect);
- pt.y = rect.top;
-
- if ((GetWindowLongPtr(LButton, GWL_STYLE) & WS_VISIBLE) != 0)
- pt.x = rect.left - 28;
- else
- pt.x = rect.left;
- }
+ GetWindowRect(LButton, &rect);
+ pt.y = rect.top;
+
+ if ((GetWindowLongPtr(LButton, GWL_STYLE) & WS_VISIBLE) != 0)
+ pt.x = rect.left - 28;
+ else
+ pt.x = rect.left;
ScreenToClient(GetParent(LButton), &pt);
rect.bottom += pt.y - rect.top;
@@ -124,71 +89,15 @@ public: return rect;
}
- // helper function
- // identifies the message dialog
- bool IsMessageSendDialog(HWND hwndDlg)
- {
- TCHAR szClassName[32] = _T("");
-
- GetClassName(hwndDlg, szClassName, _countof(szClassName));
- if (mir_tstrcmp(szClassName, _T("#32770")))
- return false;
-
- if ((REdit = GetDlgItem(hwndDlg, MI_IDC_LOG)) != NULL) {
- GetClassName(REdit, szClassName, _countof(szClassName));
- if (mir_tstrcmp(szClassName, _T("RichEdit20A")) != 0 &&
- mir_tstrcmp(szClassName, _T("RichEdit20W")) != 0 &&
- mir_tstrcmp(szClassName, _T("RICHEDIT50W")) != 0)
- return false;
- }
- else return false;
-
- if ((MEdit = GetDlgItem(hwndDlg, MI_IDC_MESSAGE)) != NULL) {
- GetClassName(MEdit, szClassName, _countof(szClassName));
- if (mir_tstrcmp(szClassName, _T("Edit")) != 0 &&
- mir_tstrcmp(szClassName, _T("RichEdit20A")) != 0 &&
- mir_tstrcmp(szClassName, _T("RichEdit20W")) != 0 &&
- mir_tstrcmp(szClassName, _T("RICHEDIT50W")) != 0)
- return false;
- }
- else return false;
-
- QuoteB = GetDlgItem(hwndDlg, MI_IDC_QUOTE);
-
- if ((LButton = GetDlgItem(hwndDlg, MI_IDC_ADD)) == NULL)
- return false;
-
- if (GetDlgItem(hwndDlg, MI_IDC_NAME) == NULL)
- return false;
- if ((MOK = GetDlgItem(hwndDlg, IDOK)) == NULL)
- return false;
-
- return true;
- }
-
void CreateSmileyButton(void)
{
doSmileyButton = opt.ButtonStatus != 0;
- OldButtonPlace = opt.ButtonStatus == 2;
SmileyPackType *SmileyPack = GetSmileyPack(ProtocolName, hContact);
doSmileyButton &= SmileyPack != NULL && SmileyPack->VisibleSmileyCount() != 0;
- bool showButtonLine;
- if (IsOldSrmm()) {
- isSplit = db_get_b(NULL, "SRMsg", "Split", TRUE) != 0;
-
- doSmileyReplace = (isSplit || !isSend);
- doSmileyButton &= isSplit || isSend;
- showButtonLine = db_get_b(NULL, "SRMsg", "ShowButtonLine", TRUE) != 0;
- }
- else {
- doSmileyReplace = true;
- OldButtonPlace = false;
- showButtonLine = db_get_b(NULL, "SRMM", "ShowButtonLine", TRUE) != 0;
- }
-
- doSmileyButton &= OldButtonPlace || showButtonLine;
+ 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);
@@ -197,22 +106,21 @@ public: }
if (doSmileyButton && opt.PluginSupportEnabled) {
- //create smiley button
+ // create smiley button
RECT rect = CalcSmileyButtonPos();
hSmlButton = CreateWindowEx(
WS_EX_LEFT | WS_EX_NOPARENTNOTIFY | WS_EX_TOPMOST,
MIRANDABUTTONCLASS,
_T("S"),
- WS_CHILD | WS_VISIBLE | WS_TABSTOP, // window style
- rect.left, // horizontal position of window
- rect.top, // vertical position of window
- rect.bottom - rect.top + 1, // window width
- rect.bottom - rect.top + 1, // window height
- GetParent(LButton), // handle to parent or owner window
- (HMENU)IDC_SMLBUTTON, // menu handle or child identifier
- NULL, // handle to application instance
- NULL); // window-creation data
+ 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);
@@ -231,21 +139,11 @@ public: }
};
-static int CompareMsgWndData(const MsgWndData* p1, const MsgWndData* p2)
-{
- return (int)((INT_PTR)p1->hwnd - (INT_PTR)p2->hwnd);
-}
-
-static LIST<MsgWndData> g_MsgWndList(10, CompareMsgWndData);
+static LIST<MsgWndData> g_MsgWndList(10, HandleKeySortT);
-bool IsOldSrmm(void)
+int UpdateSrmmDlg(WPARAM wParam, LPARAM)
{
- return ServiceExists(MS_MSG_GETWINDOWCLASS) == 0;
-}
-
-int UpdateSrmmDlg(WPARAM wParam, LPARAM /* lParam */)
-{
- mir_cslock lck(csHook);
+ mir_cslock lck(csWndList);
for (int i = 0; i < g_MsgWndList.getCount(); ++i) {
if (wParam == 0 || g_MsgWndList[i]->hContact == wParam) {
@@ -260,41 +158,10 @@ int UpdateSrmmDlg(WPARAM wParam, LPARAM /* lParam */) // find the dialog info in the stored list
static MsgWndData* IsMsgWnd(HWND hwnd)
{
- mir_cslock lck(csHook);
+ mir_cslock lck(csWndList);
return g_MsgWndList.find((MsgWndData*)&hwnd);
}
-static void MsgWndDetect(HWND hwndDlg, MCONTACT hContact)
-{
- MsgWndData dat;
- if (!dat.IsMessageSendDialog(hwndDlg))
- return;
-
- dat.hwnd = hwndDlg;
- dat.hContact = hContact;
-
- // Get the protocol for this contact to display correct smileys.
- char *protonam = GetContactProto(DecodeMetaContact(dat.hContact));
- if (protonam) {
- strncpy(dat.ProtocolName, protonam, sizeof(dat.ProtocolName));
- dat.ProtocolName[sizeof(dat.ProtocolName) - 1] = 0;
- }
-
- mir_cslock lck(csHook);
-
- MsgWndData *msgwnd = g_MsgWndList.find((MsgWndData*)&hwndDlg);
- if (msgwnd == NULL) {
- msgwnd = new MsgWndData(dat);
- g_MsgWndList.insert(msgwnd);
-
- mir_subclassWindow(hwndDlg, MessageDlgSubclass);
- msgwnd->CreateSmileyButton();
- if (hContact == NULL)
- SetRichCallback(msgwnd->REdit, msgwnd->hContact, true, true);
- }
-}
-
-
// global subclass function for all dialogs
static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -326,7 +193,7 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, switch (uMsg) {
case WM_DESTROY:
{
- mir_cslock lck(csHook);
+ mir_cslock lck(csWndList);
int ind = g_MsgWndList.getIndex((MsgWndData*)&hwnd);
if (ind != -1) {
delete g_MsgWndList[ind];
@@ -366,28 +233,18 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, 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;
-
- RECT rect;
- GetWindowRect(dat->hSmlButton, &rect);
-
- if (dat->OldButtonPlace) {
- stwp->direction = 3;
- stwp->xPosition = rect.left;
- stwp->yPosition = rect.top + 4;
- }
- else {
- stwp->direction = 0;
- stwp->xPosition = rect.left;
- stwp->yPosition = rect.top + 24;
- }
-
+ stwp->direction = 0;
+ stwp->xPosition = rect.left;
+ stwp->yPosition = rect.top + 24;
mir_forkthread(SmileyToolThread, stwp);
}
@@ -406,8 +263,26 @@ static int MsgDlgHook(WPARAM, LPARAM lParam) const MessageWindowEventData *wndEvtData = (MessageWindowEventData*)lParam;
switch (wndEvtData->uType) {
case MSG_WINDOW_EVT_OPENING:
- MsgWndDetect(wndEvtData->hwndWindow, wndEvtData->hContact);
if (wndEvtData->cbSize >= sizeof(MessageWindowEventData)) {
+ MsgWndData *msgwnd = new MsgWndData();
+ msgwnd->hwnd = wndEvtData->hwndWindow;
+ msgwnd->hContact = wndEvtData->hContact;
+ msgwnd->REdit = wndEvtData->hwndInput;
+ msgwnd->MEdit = wndEvtData->hwndLog;
+ msgwnd->LButton = GetDlgItem(wndEvtData->hwndWindow, MI_IDC_ADD);
+
+ // Get the protocol for this contact to display correct smileys.
+ char *protonam = GetContactProto(DecodeMetaContact(msgwnd->hContact));
+ if (protonam)
+ strncpy_s(msgwnd->ProtocolName, protonam, _TRUNCATE);
+
+ mir_subclassWindow(msgwnd->hwnd, MessageDlgSubclass);
+ msgwnd->CreateSmileyButton();
+ {
+ mir_cslock lck(csWndList);
+ g_MsgWndList.insert(msgwnd);
+ }
+
SetRichOwnerCallback(wndEvtData->hwndWindow, wndEvtData->hwndInput, wndEvtData->hwndLog);
if (wndEvtData->hwndLog)
@@ -446,7 +321,7 @@ void InstallDialogBoxHook(void) void RemoveDialogBoxHook(void)
{
- mir_cslock lck(csHook);
+ mir_cslock lck(csWndList);
for (int i = 0; i < g_MsgWndList.getCount(); i++)
delete g_MsgWndList[i];
g_MsgWndList.destroy();
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 7e511a952d..f0f052b416 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -27,7 +27,7 @@ struct QueueElem CMString fname;
bool needext;
- QueueElem(CMString& purl, CMString& pfname, bool ne)
+ QueueElem(CMString &purl, CMString &pfname, bool ne)
: url(purl), fname(pfname), needext(ne)
{
}
@@ -39,7 +39,7 @@ static OBJLIST<QueueElem> dlQueue(10); static TCHAR cachepath[MAX_PATH];
static bool threadRunning;
-bool InternetDownloadFile(const char *szUrl, char* szDest, HANDLE &hHttpDwnl)
+bool InternetDownloadFile(const char *szUrl, char *szDest, HANDLE &hHttpDwnl)
{
int result = 0xBADBAD;
char *szRedirUrl = NULL;
@@ -91,10 +91,9 @@ bool InternetDownloadFile(const char *szUrl, char* szDest, HANDLE &hHttpDwnl) if (!mir_strcmp(nlhrReply->headers[i].szName, "Location")) {
size_t rlen = 0;
if (nlhrReply->headers[i].szValue[0] == '/') {
- const char* szPath;
- const char* szPref = strstr(szUrl, "://");
+ const char *szPref = strstr(szUrl, "://");
szPref = szPref ? szPref + 3 : szUrl;
- szPath = strchr(szPref, '/');
+ const char *szPath = strchr(szPref, '/');
rlen = szPath != NULL ? szPath - szUrl : mir_strlen(szUrl);
}
@@ -155,7 +154,7 @@ void __cdecl SmileyDownloadThread(void*) }
}
-bool GetSmileyFile(CMString& url, const CMString& packstr)
+bool GetSmileyFile(CMString &url, const CMString &packstr)
{
_TPattern *urlsplit = _TPattern::compile(_T(".*/(.*)"));
_TMatcher *m0 = urlsplit->createTMatcher(url);
diff --git a/plugins/SmileyAdd/src/download.h b/plugins/SmileyAdd/src/download.h index 8bc7daec85..0e1b50bf3f 100644 --- a/plugins/SmileyAdd/src/download.h +++ b/plugins/SmileyAdd/src/download.h @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef SMILEYADD_DOWNLOAD_H_
#define SMILEYADD_DOWNLOAD_H_
-bool GetSmileyFile(CMString& url, const CMString& packstr);
+bool GetSmileyFile(CMString &url, const CMString &packstr);
void DownloadInit(void);
void DownloadClose(void);
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp index 2900f276b6..f09ccbb30e 100644 --- a/plugins/SmileyAdd/src/general.cpp +++ b/plugins/SmileyAdd/src/general.cpp @@ -25,7 +25,7 @@ static bool gdiPlusFail = false; //
// General functions
//
-int CalculateTextHeight(HDC hdc, CHARFORMAT2* chf)
+int CalculateTextHeight(HDC hdc, CHARFORMAT2 *chf)
{
HDC hcdc = CreateCompatibleDC(hdc);
@@ -61,7 +61,7 @@ HICON GetDefaultIcon(bool copy) const TCHAR* GetImageExt(CMString &fname)
{
- const TCHAR* ext = _T("");
+ const TCHAR *ext = _T("");
int fileId = _topen(fname.c_str(), O_RDONLY | _O_BINARY);
if (fileId != -1) {
@@ -99,22 +99,20 @@ HICON ImageList_GetIconFixed(HIMAGELIST himl, INT i, UINT fStyle) ii.xHotspot = 0;
ii.yHotspot = 0;
- /* draw mask*/
+ // draw mask
ii.hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
hOldDstBitmap = (HBITMAP)SelectObject(hdcDst, ii.hbmMask);
PatBlt(hdcDst, 0, 0, cx, cy, WHITENESS);
ImageList_Draw(himl, i, hdcDst, 0, 0, fStyle | ILD_MASK);
- /* draw image*/
+ // draw image
ii.hbmColor = CreateBitmap(cx, cy, 1, 32, NULL);
SelectObject(hdcDst, ii.hbmColor);
PatBlt(hdcDst, 0, 0, cx, cy, BLACKNESS);
ImageList_Draw(himl, i, hdcDst, 0, 0, fStyle | ILD_TRANSPARENT);
- /*
- * CreateIconIndirect requires us to deselect the bitmaps from
- * the DCs before calling
- */
+ // CreateIconIndirect requires us to deselect the bitmaps from
+ // the DCs before calling
SelectObject(hdcDst, hOldDstBitmap);
hIcon = CreateIconIndirect(&ii);
@@ -126,14 +124,14 @@ HICON ImageList_GetIconFixed(HIMAGELIST himl, INT i, UINT fStyle) return hIcon;
}
-void pathToRelative(const CMString& pSrc, CMString& pOut)
+void pathToRelative(const CMString &pSrc, CMString &pOut)
{
TCHAR szOutPath[MAX_PATH];
PathToRelativeT(pSrc.c_str(), szOutPath);
pOut = szOutPath;
}
-void pathToAbsolute(const CMString& pSrc, CMString& pOut)
+void pathToAbsolute(const CMString &pSrc, CMString &pOut)
{
TCHAR szOutPath[MAX_PATH];
@@ -161,9 +159,9 @@ static int __fastcall SingleHexToDecimal(char c) return -1;
}
-void UrlDecode(char* str)
+void UrlDecode(char *str)
{
- char* s = str, *d = str;
+ char *s = str, *d = str;
while (*s) {
if (*s == '%') {
diff --git a/plugins/SmileyAdd/src/imagecache.cpp b/plugins/SmileyAdd/src/imagecache.cpp index 36fd89e09d..755c2b8165 100644 --- a/plugins/SmileyAdd/src/imagecache.cpp +++ b/plugins/SmileyAdd/src/imagecache.cpp @@ -58,7 +58,7 @@ static void CALLBACK sttMainThreadCallback(PVOID) }
-static HMODULE LoadDll(const CMString& file)
+static HMODULE LoadDll(const CMString &file)
{
WaitForSingleObject(g_hMutexIm, 3000);
@@ -114,7 +114,7 @@ void ImageBase::ProcessTimerTick(time_t ts) ReleaseMutex(g_hMutexIm);
}
-int ImageBase::CompareImg(const ImageBase* p1, const ImageBase* p2)
+int ImageBase::CompareImg(const ImageBase *p1, const ImageBase *p2)
{
unsigned id1 = p1->m_id;
unsigned id2 = p2->m_id;
@@ -123,7 +123,7 @@ int ImageBase::CompareImg(const ImageBase* p1, const ImageBase* p2) else return id1 < id2 ? -1 : 1;
}
-void ImageBase::Draw(HDC hdc, RECT& rc, bool clip)
+void ImageBase::Draw(HDC hdc, RECT &rc, bool clip)
{
HRGN hrgn = NULL;
if (clip) {
@@ -190,7 +190,7 @@ int ImageBase::SelectNextFrame(const int frame) /////////////////////////////////////////////////////////////////////////////////////////
-IconType::IconType(const unsigned id, const CMString& file, const int index, const IcoTypeEnum type)
+IconType::IconType(const unsigned id, const CMString &file, const int index, const IcoTypeEnum type)
: ImageBase(id)
{
m_SmileyIcon = NULL;
@@ -230,7 +230,7 @@ HICON IconType::GetIcon(void) return (HICON)CopyImage(m_SmileyIcon, IMAGE_ICON, 0, 0, 0);
}
-void IconType::GetSize(SIZE& size)
+void IconType::GetSize(SIZE &size)
{
if (m_SmileyIcon == NULL)
return;
@@ -274,12 +274,12 @@ HICON ImageListItemType::GetIcon(void) return ImageList_GetIconFixed(m_hImList, m_index, ILD_TRANSPARENT);
}
-void ImageListItemType::GetSize(SIZE& size)
+void ImageListItemType::GetSize(SIZE &size)
{
ImageList_GetIconSize(m_hImList, (int*)&size.cx, (int*)&size.cy);
}
-ImageType::ImageType(const unsigned id, const CMString& file, IStream* pStream)
+ImageType::ImageType(const unsigned id, const CMString &file, IStream *pStream)
: ImageBase(id)
{
m_bmp = NULL;
@@ -310,7 +310,7 @@ ImageType::ImageType(const unsigned id, const CMString& file, IStream* pStream) }
}
-ImageType::ImageType(const unsigned id, const CMString& file, const int index, const IcoTypeEnum type)
+ImageType::ImageType(const unsigned id, const CMString &file, const int index, const IcoTypeEnum type)
: ImageBase(id)
{
m_bmp = NULL;
@@ -399,7 +399,7 @@ HICON ImageType::GetIcon(void) }
-void ImageType::GetSize(SIZE& size)
+void ImageType::GetSize(SIZE &size)
{
if (m_bmp) {
size.cx = m_bmp->GetWidth();
@@ -415,7 +415,7 @@ ImageFType::ImageFType(const unsigned id) m_bmp = NULL;
}
-ImageFType::ImageFType(const unsigned id, const CMString& file)
+ImageFType::ImageFType(const unsigned id, const CMString &file)
: ImageBase(id)
{
m_bmp = NULL;
@@ -496,7 +496,7 @@ HICON ImageFType::GetIcon(void) return hIcon;
}
-void ImageFType::GetSize(SIZE& size)
+void ImageFType::GetSize(SIZE &size)
{
if (m_bmp) {
BITMAP bm;
@@ -525,7 +525,7 @@ void DestroyImageCache(void) CloseHandle(g_hMutexIm);
}
-ImageBase* AddCacheImage(const CMString& file, int index)
+ImageBase* AddCacheImage(const CMString &file, int index)
{
CMString tmpfile(file); tmpfile.AppendFormat(_T("#%d"), index);
unsigned id = mir_hash(tmpfile.c_str(), tmpfile.GetLength() * sizeof(TCHAR));
diff --git a/plugins/SmileyAdd/src/imagecache.h b/plugins/SmileyAdd/src/imagecache.h index 615dbecc44..da019301a9 100644 --- a/plugins/SmileyAdd/src/imagecache.h +++ b/plugins/SmileyAdd/src/imagecache.h @@ -35,19 +35,19 @@ public: void ProcessTimerTick(time_t ts);
- virtual void GetSize(SIZE& /* size */) {};
+ virtual void GetSize(SIZE&) {};
virtual int GetFrameCount(void) const { return 0; }
virtual int GetFrameDelay(void) const { return 0; }
virtual HICON GetIcon(void) { return NULL; };
- virtual void DrawInternal(HDC /* dc */, int /* x */, int /* y */, int /* sizeX */, int /* sizeY */) {};
- virtual void SelectFrame(int /* frame */) {}
+ virtual void DrawInternal(HDC, int, int, int, int) {};
+ virtual void SelectFrame(int) {}
bool IsAnimated(void) const { return GetFrameCount() > 1; }
HBITMAP GetBitmap(COLORREF bkgClr, int sizeX, int sizeY);
void Draw(HDC dc, RECT &rc, bool clip);
int SelectNextFrame(const int frame);
- static int CompareImg(const ImageBase* p1, const ImageBase* p2);
+ static int CompareImg(const ImageBase *p1, const ImageBase *p2);
};
@@ -66,12 +66,12 @@ private: HICON m_SmileyIcon;
public:
- IconType(const unsigned id, const CMString& file, const int index, const IcoTypeEnum type);
+ IconType(const unsigned id, const CMString &file, const int index, const IcoTypeEnum type);
~IconType();
void DrawInternal(HDC dc, int x, int y, int sizeX, int sizeY);
HICON GetIcon(void);
- void GetSize(SIZE& size);
+ void GetSize(SIZE &size);
};
@@ -86,7 +86,7 @@ public: void DrawInternal(HDC dc, int x, int y, int sizeX, int sizeY);
HICON GetIcon(void);
- void GetSize(SIZE& size);
+ void GetSize(SIZE &size);
};
@@ -101,18 +101,18 @@ private: public:
- ImageType(const unsigned id, const CMString& file, IStream* pStream);
- ImageType(const unsigned id, const CMString& file, const int index, const IcoTypeEnum type);
+ ImageType(const unsigned id, const CMString &file, IStream *pStream);
+ ImageType(const unsigned id, const CMString &file, const int index, const IcoTypeEnum type);
~ImageType();
- void SelectFrame(int frame);
+ void SelectFrame(int frame);
- void DrawInternal(HDC dc, int x, int y, int sizeX, int sizeY);
+ void DrawInternal(HDC dc, int x, int y, int sizeX, int sizeY);
HICON GetIcon(void);
- void GetSize(SIZE& size);
+ void GetSize(SIZE &size);
- int GetFrameDelay(void) const;
- int GetFrameCount(void) const { return m_nFrameCount; }
+ int GetFrameDelay(void) const;
+ int GetFrameCount(void) const { return m_nFrameCount; }
};
class ImageFType : public ImageBase
@@ -123,15 +123,15 @@ protected: public:
ImageFType(const unsigned id);
- ImageFType(const unsigned id, const CMString& file);
+ ImageFType(const unsigned id, const CMString &file);
~ImageFType();
- void DrawInternal(HDC dc, int x, int y, int sizeX, int sizeY);
+ void DrawInternal(HDC dc, int x, int y, int sizeX, int sizeY);
HICON GetIcon(void);
- void GetSize(SIZE& size);
+ void GetSize(SIZE &size);
};
-ImageBase* AddCacheImage(const CMString& file, int index);
+ImageBase* AddCacheImage(const CMString &file, int index);
void InitImageCache(void);
void DestroyImageCache(void);
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 06e67ffe31..8dd60afed1 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -277,7 +277,7 @@ void OptionsDialogType::UpdateVisibleSmPackList(void) bool useOne = IsDlgButtonChecked(m_hwndDialog, IDC_USESTDPACK) == BST_UNCHECKED;
bool usePhysProto = IsDlgButtonChecked(m_hwndDialog, IDC_USEPHYSPROTO) == BST_CHECKED;
- SmileyCategoryListType::SmileyCategoryVectorType& smc = *tmpsmcat.GetSmileyCategoryList();
+ SmileyCategoryListType::SmileyCategoryVectorType &smc = *tmpsmcat.GetSmileyCategoryList();
for (int i = 0; i < smc.getCount(); i++) {
bool visiblecat = usePhysProto ? !smc[i].IsAcc() : !smc[i].IsPhysProto();
bool visible = useOne ? !smc[i].IsProto() : visiblecat;
@@ -296,7 +296,7 @@ void OptionsDialogType::UpdateVisibleSmPackList(void) CMString FileName;
if (!ProtoName.IsEmpty()) {
PhysProtoName += ProtoName;
- SmileyCategoryType* scm = tmpsmcat.GetSmileyCategory(PhysProtoName);
+ SmileyCategoryType *scm = tmpsmcat.GetSmileyCategory(PhysProtoName);
if (scm == NULL)
visible = false;
else if (scm->GetFilename().IsEmpty())
@@ -321,7 +321,7 @@ void OptionsDialogType::PopulateSmPackList(void) tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
tvi.item.stateMask = TVIS_STATEIMAGEMASK | TVIS_SELECTED;
UpdateVisibleSmPackList();
- SmileyCategoryListType::SmileyCategoryVectorType& smc = *tmpsmcat.GetSmileyCategoryList();
+ SmileyCategoryListType::SmileyCategoryVectorType &smc = *tmpsmcat.GetSmileyCategoryList();
for (int i = 0; i < smc.getCount(); i++) {
if (smc[i].IsVisible()) {
tvi.item.pszText = (TCHAR*)smc[i].GetDisplayName().c_str();
@@ -364,10 +364,7 @@ void OptionsDialogType::InitDialog(void) CheckDlgButton(m_hwndDialog, IDC_SORTING_HORIZONTAL, opt.HorizontalSorting ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(m_hwndDialog, IDC_SMLBUT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Off"));
- SendDlgItemMessage(m_hwndDialog, IDC_SMLBUT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top"));
-
- if (IsOldSrmm())
- SendDlgItemMessage(m_hwndDialog, IDC_SMLBUT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
+ SendDlgItemMessage(m_hwndDialog, IDC_SMLBUT, CB_ADDSTRING, 0, (LPARAM)TranslateT("On"));
SendDlgItemMessage(m_hwndDialog, IDC_SMLBUT, CB_SETCURSEL, opt.ButtonStatus, 0);
EnableWindow(GetDlgItem(m_hwndDialog, IDC_SMLBUT), opt.PluginSupportEnabled);
@@ -387,7 +384,7 @@ void OptionsDialogType::InitDialog(void) tmpsmcat = g_SmileyCategories;
- SmileyCategoryListType::SmileyCategoryVectorType& smc = *g_SmileyCategories.GetSmileyCategoryList();
+ SmileyCategoryListType::SmileyCategoryVectorType &smc = *g_SmileyCategories.GetSmileyCategoryList();
for (int i = 0; i < smc.getCount(); i++) {
HICON hIcon = NULL;
if (smc[i].IsProto()) {
@@ -468,7 +465,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item) ofn.nMaxFile = _countof(filename);
CMString inidir;
- SmileyCategoryType* smc = tmpsmcat.GetSmileyCategory(item);
+ SmileyCategoryType *smc = tmpsmcat.GetSmileyCategory(item);
if (smc->GetFilename().IsEmpty())
pathToAbsolute(_T("Smileys"), inidir);
else {
@@ -514,7 +511,7 @@ void OptionsDialogType::FilenameChanged(void) TCHAR str[MAX_PATH];
GetDlgItemText(m_hwndDialog, IDC_FILENAME, str, _countof(str));
- SmileyCategoryType* smc = tmpsmcat.GetSmileyCategory(GetSelProto());
+ SmileyCategoryType *smc = tmpsmcat.GetSmileyCategory(GetSelProto());
if (smc->GetFilename() != str) {
CMString temp(str);
smc->SetFilename(temp);
diff --git a/plugins/SmileyAdd/src/options.h b/plugins/SmileyAdd/src/options.h index f8fd44890b..c4139f1131 100644 --- a/plugins/SmileyAdd/src/options.h +++ b/plugins/SmileyAdd/src/options.h @@ -48,13 +48,12 @@ public: void Load(void);
void Save(void);
- static void ReadPackFileName(CMString& filename, const CMString& name,
- const CMString& defaultFilename);
- static void ReadCustomCategories(CMString& cats);
- static void ReadContactCategory(MCONTACT hContact, CMString& cats);
- static void WritePackFileName(const CMString& filename, const CMString& name);
- static void WriteCustomCategories(const CMString& cats);
- static void WriteContactCategory(MCONTACT hContact, const CMString& cats);
+ static void ReadPackFileName(CMString &filename, const CMString &name, const CMString &defaultFilename);
+ static void ReadCustomCategories(CMString &cats);
+ static void ReadContactCategory(MCONTACT hContact, CMString &cats);
+ static void WritePackFileName(const CMString &filename, const CMString &name);
+ static void WriteCustomCategories(const CMString &cats);
+ static void WriteContactCategory(MCONTACT hContact, const CMString &cats);
};
extern OptionsType opt;
diff --git a/plugins/SmileyAdd/src/regexp/WCMatcher.cpp b/plugins/SmileyAdd/src/regexp/WCMatcher.cpp index 8fd137449d..5a1f73c183 100644 --- a/plugins/SmileyAdd/src/regexp/WCMatcher.cpp +++ b/plugins/SmileyAdd/src/regexp/WCMatcher.cpp @@ -10,7 +10,7 @@ const int WCMatcher::MATCH_ENTIRE_STRING = 0x01; @version 1.07.00
*/
-WCMatcher::WCMatcher(WCPattern * pattern, const CMString & text)
+WCMatcher::WCMatcher(WCPattern *pattern, const CMString &text)
{
pat = pattern;
str = &text;
diff --git a/plugins/SmileyAdd/src/regexp/WCPattern.cpp b/plugins/SmileyAdd/src/regexp/WCPattern.cpp index cbb9c7369f..c64022e460 100644 --- a/plugins/SmileyAdd/src/regexp/WCPattern.cpp +++ b/plugins/SmileyAdd/src/regexp/WCPattern.cpp @@ -62,7 +62,7 @@ static inline int str_icmp(const wchar_t *a, const wchar_t *b) #define str_icmp wcscasecmp
#endif
-WCPattern::WCPattern(const CMString & rhs)
+WCPattern::WCPattern(const CMString &rhs)
{
matcher = NULL;
pattern = rhs;
@@ -72,27 +72,13 @@ WCPattern::WCPattern(const CMString & rhs) error = 0;
head = NULL;
}
-// convenience function in case we want to add any extra debugging output
+
+// convenient function in case we want to add any extra debugging output
void WCPattern::raiseError()
{
- /* switch (pattern[curInd - 1])
- {
- case '*':
- case ')':
- case '+':
- case '?':
- case ']':
- case '}':
- fwprintf(stderr, L"%s\n%*c^\n", pattern.c_str(), curInd - 1, ' ');
- fwprintf(stderr, L"Syntax Error near here. Possible unescaped meta character.\n");
- break;
- default:
- fwprintf(stderr, L"%s\n%*c^\n", pattern.c_str(), curInd - 1, ' ');
- fwprintf(stderr, L"Syntax Error near here. \n");
- break;
- }*/
error = 1;
}
+
NFAUNode *WCPattern::registerNode(NFAUNode *node)
{
nodes[node] = 1;
@@ -104,7 +90,7 @@ CMString WCPattern::classUnion(CMString s1, CMString s2) const wchar_t *out = new wchar_t[66000];
std::sort((LPTSTR)s1.GetString(), (LPTSTR)s1.GetTail());
std::sort((LPTSTR)s2.GetString(), (LPTSTR)s2.GetTail());
- wchar_t* p = std::set_union(s1.GetString(), s1.GetTail(), s2.GetString(), s2.GetTail(), out); *p = 0;
+ wchar_t *p = std::set_union(s1.GetString(), s1.GetTail(), s2.GetString(), s2.GetTail(), out); *p = 0;
CMString ret = out;
delete[] out;
return ret;
@@ -158,8 +144,8 @@ bool WCPattern::quantifyCurly(int &sNum, int &eNum) int commaInd = ci, endInd = ci, len = pattern.GetLength();
sNum = eNum = 0;
- while (endInd < len && pattern[endInd] != '}') ++endInd;
- while (commaInd < endInd && pattern[commaInd] != ',') ++commaInd;
+ while (endInd < len && pattern[endInd] != '}') ++endInd;
+ while (commaInd < endInd && pattern[commaInd] != ',') ++commaInd;
if (endInd >= len) { raiseError(); return 0; }
for (i = ci; good && i < endInd; ++i) if (i != commaInd && !isdigit(pattern[i])) good = 0;
if (!good && commaInd < endInd) { raiseError(); return 0; }
@@ -628,7 +614,8 @@ NFAUNode* WCPattern::parseQuote() }
else s.AppendChar(pattern[curInd++]);
}
- if ((flags & WCPattern::CASE_INSENSITIVE) != 0) return registerNode(new NFACIQuoteUNode(s));
+ if ((flags & WCPattern::CASE_INSENSITIVE) != 0)
+ return registerNode(new NFACIQuoteUNode(s));
return registerNode(new NFAQuoteUNode(s));
}
NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end)
@@ -759,13 +746,13 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) break;
case '[':
if ((flags & WCPattern::CASE_INSENSITIVE) == 0) {
- NFAClassUNode * clazz = new NFAClassUNode();
+ NFAClassUNode *clazz = new NFAClassUNode();
CMString s = parseClass();
for (int i = 0; i < (int)s.GetLength(); ++i) clazz->vals[s[i]] = 1;
next = registerNode(clazz);
}
else {
- NFACIClassUNode * clazz = new NFACIClassUNode();
+ NFACIClassUNode *clazz = new NFACIClassUNode();
CMString s = parseClass();
for (int i = 0; i < s.GetLength(); ++i) clazz->vals[to_lower(s[i])] = 1;
next = registerNode(clazz);
@@ -774,7 +761,7 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end) case '.':
{
bool useN = 1, useR = 1;
- NFAClassUNode * clazz = new NFAClassUNode(1);
+ NFAClassUNode *clazz = new NFAClassUNode(1);
if ((flags & WCPattern::UNIX_LINE_MODE) != 0) useR = 0;
if ((flags & WCPattern::DOT_MATCHES_ALL) != 0) useN = useR = 0;
if (useN) clazz->vals['\n'] = 1;
@@ -892,7 +879,7 @@ WCPattern* WCPattern::compile(const CMString &pattern, const unsigned long mode) return p;
}
-WCPattern * WCPattern::compileAndKeep(const CMString &pattern, const unsigned long mode)
+WCPattern* WCPattern::compileAndKeep(const CMString &pattern, const unsigned long mode)
{
WCPattern *ret = NULL;
std::map<CMString, WCPattern*>::iterator it = compiledWCPatterns.find(pattern);
@@ -980,7 +967,7 @@ std::pair<CMString, int> WCPattern::findNthMatch(const CMString &pattern, const const int matchNum, const unsigned long mode)
{
std::pair<CMString, int> ret;
- WCPattern * p = WCPattern::compile(pattern, mode);
+ WCPattern *p = WCPattern::compile(pattern, mode);
ret.second = -1;
if (p) {
@@ -1204,7 +1191,7 @@ int NFAGreedyQuantifierUNode::matchInternal(const CMString &str, WCMatcher *matc // NFALazyQuantifierUNode
-NFALazyQuantifierUNode::NFALazyQuantifierUNode(WCPattern * pat, NFAUNode *internal, const int minMatch, const int maxMatch) :
+NFALazyQuantifierUNode::NFALazyQuantifierUNode(WCPattern *pat, NFAUNode *internal, const int minMatch, const int maxMatch) :
NFAQuantifierUNode(pat, internal, minMatch, maxMatch)
{
}
@@ -1294,7 +1281,7 @@ NFACIClassUNode::NFACIClassUNode(const bool invert) inv = invert;
}
-NFACIClassUNode::NFACIClassUNode(const CMString & clazz, const bool invert)
+NFACIClassUNode::NFACIClassUNode(const CMString &clazz, const bool invert)
{
inv = invert;
for (int i = 0; i < (int)clazz.GetLength(); ++i)
@@ -1327,7 +1314,7 @@ NFAOrUNode::NFAOrUNode(NFAUNode *first, NFAUNode *second) : {
}
-void NFAOrUNode::findAllNodes(std::map<NFAUNode*, bool> & soFar)
+void NFAOrUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar)
{
if (one) one->findAllNodes(soFar);
if (two) two->findAllNodes(soFar);
@@ -1346,7 +1333,7 @@ int NFAOrUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) // NFAQuoteUNode
-NFAQuoteUNode::NFAQuoteUNode(const CMString & quoted) :
+NFAQuoteUNode::NFAQuoteUNode(const CMString "ed) :
qStr(quoted)
{
}
@@ -1360,7 +1347,7 @@ int NFAQuoteUNode::match(const CMString &str, WCMatcher *matcher, const int curI // NFACIQuoteUNode
-NFACIQuoteUNode::NFACIQuoteUNode(const CMString & quoted) :
+NFACIQuoteUNode::NFACIQuoteUNode(const CMString "ed) :
qStr(quoted)
{
}
@@ -1379,7 +1366,7 @@ NFALookAheadUNode::NFALookAheadUNode(NFAUNode *internal, const bool positive) : {
}
-void NFALookAheadUNode::findAllNodes(std::map<NFAUNode*, bool> & soFar)
+void NFALookAheadUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar)
{
if (inner) inner->findAllNodes(soFar);
NFAUNode::findAllNodes(soFar);
@@ -1600,7 +1587,7 @@ NFAGroupLoopUNode::NFAGroupLoopUNode(NFAUNode *internal, const int minMatch, con type = matchType;
}
-void NFAGroupLoopUNode::findAllNodes(std::map<NFAUNode*, bool> & soFar)
+void NFAGroupLoopUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar)
{
if (inner) inner->findAllNodes(soFar);
NFAUNode::findAllNodes(soFar);
diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp index bcb93a8720..7354488309 100644 --- a/plugins/SmileyAdd/src/richcall.cpp +++ b/plugins/SmileyAdd/src/richcall.cpp @@ -95,7 +95,7 @@ static void SetPosition(HWND hwnd) }
}
-static void SetTooltip(long x, long y, HWND hwnd, RichEditData* rdt)
+static void SetTooltip(long x, long y, HWND hwnd, RichEditData *rdt)
{
TCHAR *smltxt;
int needtip = CheckForTip(x, y, hwnd, &smltxt);
@@ -134,7 +134,7 @@ static void ReplaceContactSmileys(RichEditData *rdt, const CHARRANGE &sel, bool {
if ((rdt->inputarea && !opt.InputSmileys) || rdt->dontReplace) return;
SmileyPackCType *smcp = NULL;
- SmileyPackType* SmileyPack = GetSmileyPack(NULL, rdt->hContact, rdt->inputarea ? NULL : &smcp);
+ SmileyPackType *SmileyPack = GetSmileyPack(NULL, rdt->hContact, rdt->inputarea ? NULL : &smcp);
ReplaceSmileys(rdt->hwnd, SmileyPack, smcp, sel, false, ignoreLast, unFreeze);
}
@@ -144,7 +144,7 @@ static void ReplaceContactSmileysWithText(RichEditData *rdt, CHARRANGE &sel, boo ReplaceSmileysWithText(rdt->hwnd, sel, freeze);
}
-static void SmileyToTextCutPrep(RichEditData* rdt)
+static void SmileyToTextCutPrep(RichEditData *rdt)
{
if ((rdt->inputarea && !opt.InputSmileys) || rdt->dontReplace)
return;
@@ -155,7 +155,7 @@ static void SmileyToTextCutPrep(RichEditData* rdt) ReplaceContactSmileysWithText(rdt, sel, true);
}
-static void SmileyToTextCutRest(RichEditData* rdt)
+static void SmileyToTextCutRest(RichEditData *rdt)
{
if ((rdt->inputarea && !opt.InputSmileys) || rdt->dontReplace)
return;
@@ -169,7 +169,7 @@ static void SmileyToTextCutRest(RichEditData* rdt) static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- RichEditData* rdt = g_RichEditList.find((RichEditData*)&hwnd);
+ RichEditData *rdt = g_RichEditList.find((RichEditData*)&hwnd);
if (rdt == NULL)
return 0;
@@ -330,7 +330,7 @@ void CloseRichCallback(HWND hwnd) if (ind == -1)
return;
- RichEditData* rdt = g_RichEditList[ind];
+ RichEditData *rdt = g_RichEditList[ind];
if (rdt->hToolTip)
DestroyWindow(rdt->hToolTip);
delete rdt;
@@ -342,14 +342,14 @@ void CloseRichCallback(HWND hwnd) static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- RichEditOwnerData* rdto = g_RichEditOwnerList.find((RichEditOwnerData*)&hwnd);
+ RichEditOwnerData *rdto = g_RichEditOwnerList.find((RichEditOwnerData*)&hwnd);
if (rdto == NULL)
return 0;
switch (uMsg) {
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
- RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
+ RichEditData *rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
rdt->dontReplace = true;
CHARRANGE sel = allsel;
@@ -359,7 +359,7 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara break;
case WM_DESTROY:
- RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
+ RichEditData *rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
CHARRANGE sel = allsel;
rdt->dontReplace = true;
@@ -373,7 +373,7 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara switch (uMsg) {
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
- RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
+ RichEditData *rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
if (rdt) {
CHARRANGE sel = allsel;
if (!result) ReplaceContactSmileys(rdt, sel, false, false);
@@ -414,7 +414,7 @@ void CloseRichOwnerCallback(HWND hwnd) if (ind == -1)
return;
- RichEditOwnerData* rdto = g_RichEditOwnerList[ind];
+ RichEditOwnerData *rdto = g_RichEditOwnerList[ind];
CloseRichCallback(rdto->hwndInput);
CloseRichCallback(rdto->hwndLog);
delete rdto;
@@ -427,7 +427,7 @@ void CloseRichOwnerCallback(HWND hwnd) void ProcessAllInputAreas(bool restoreText)
{
for (int i = g_RichEditList.getCount() - 1; i >= 0; i--) {
- RichEditData* rdt = g_RichEditList[i];
+ RichEditData *rdt = g_RichEditList[i];
if (rdt->inputarea) {
if (restoreText) {
CHARRANGE sel = allsel;
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index a4f3471b7f..a8a8a20ee5 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -24,7 +24,7 @@ LIST<void> menuHandleArray(5); //implementation of service functions
-SmileyPackType* GetSmileyPack(const char* proto, MCONTACT hContact, SmileyPackCType** smlc)
+SmileyPackType* GetSmileyPack(const char *proto, MCONTACT hContact, SmileyPackCType **smlc)
{
hContact = DecodeMetaContact(hContact);
if (smlc)
@@ -83,7 +83,7 @@ SmileyPackType* GetSmileyPack(const char* proto, MCONTACT hContact, SmileyPackCT INT_PTR ReplaceSmileysCommand(WPARAM, LPARAM lParam)
{
- SMADD_RICHEDIT3* smre = (SMADD_RICHEDIT3*)lParam;
+ SMADD_RICHEDIT3 *smre = (SMADD_RICHEDIT3*)lParam;
if (smre == NULL)
return FALSE;
@@ -94,8 +94,8 @@ INT_PTR ReplaceSmileysCommand(WPARAM, LPARAM lParam) if (smre->rangeToReplace == NULL) smrec.rangeToReplace = (CHARRANGE*)&selection;
else if (smrec.rangeToReplace->cpMax < 0) smrec.rangeToReplace->cpMax = LONG_MAX;
- SmileyPackCType* smcp = NULL;
- SmileyPackType* SmileyPack = GetSmileyPack(smrec.Protocolname, smrec.hContact,
+ SmileyPackCType *smcp = NULL;
+ SmileyPackType *SmileyPack = GetSmileyPack(smrec.Protocolname, smrec.hContact,
(smrec.flags & (SAFLRE_OUTGOING | SAFLRE_NOCUSTOM)) ? NULL : &smcp);
ReplaceSmileys(smre->hwndRichEditControl, SmileyPack, smcp, *smrec.rangeToReplace,
@@ -107,7 +107,7 @@ INT_PTR ReplaceSmileysCommand(WPARAM, LPARAM lParam) INT_PTR ShowSmileySelectionCommand(WPARAM, LPARAM lParam)
{
- SMADD_SHOWSEL3* smaddInfo = (SMADD_SHOWSEL3*)lParam;
+ SMADD_SHOWSEL3 *smaddInfo = (SMADD_SHOWSEL3*)lParam;
if (smaddInfo == NULL) return FALSE;
HWND parent = smaddInfo->hwndParent;
@@ -131,12 +131,12 @@ INT_PTR ShowSmileySelectionCommand(WPARAM, LPARAM lParam) }
-static int GetInfoCommandE(SMADD_INFO2* smre, bool retDup)
+static int GetInfoCommandE(SMADD_INFO2 *smre, bool retDup)
{
if (smre == NULL) return FALSE;
MCONTACT hContact = smre->hContact;
- SmileyPackType* SmileyPack = GetSmileyPack(smre->Protocolname, hContact);
+ SmileyPackType *SmileyPack = GetSmileyPack(smre->Protocolname, hContact);
if (SmileyPack == NULL || SmileyPack->SmileyCount() == 0) {
smre->ButtonIcon = NULL;
@@ -145,7 +145,7 @@ static int GetInfoCommandE(SMADD_INFO2* smre, bool retDup) return FALSE;
}
- SmileyType* sml = FindButtonSmiley(SmileyPack);
+ SmileyType *sml = FindButtonSmiley(SmileyPack);
if (sml != NULL)
smre->ButtonIcon = retDup ? sml->GetIconDup() : sml->GetIcon();
@@ -174,13 +174,13 @@ INT_PTR GetInfoCommand2(WPARAM, LPARAM lParam) INT_PTR ParseTextBatch(WPARAM, LPARAM lParam)
{
- SMADD_BATCHPARSE2* smre = (SMADD_BATCHPARSE2*)lParam;
+ SMADD_BATCHPARSE2 *smre = (SMADD_BATCHPARSE2*)lParam;
if (smre == NULL) return FALSE;
MCONTACT hContact = smre->hContact;
- SmileyPackCType* smcp = NULL;
- SmileyPackType* SmileyPack = GetSmileyPack(smre->Protocolname, hContact,
+ SmileyPackCType *smcp = NULL;
+ SmileyPackType *SmileyPack = GetSmileyPack(smre->Protocolname, hContact,
(smre->flag & (SAFL_OUTGOING | SAFL_NOCUSTOM)) ? NULL : &smcp);
SmileysQueueType smllist;
@@ -194,7 +194,7 @@ INT_PTR ParseTextBatch(WPARAM, LPARAM lParam) return 0;
SMADD_BATCHPARSERES *res = new SMADD_BATCHPARSERES[smllist.getCount()];
- SMADD_BATCHPARSERES* cres = res;
+ SMADD_BATCHPARSERES *cres = res;
for (int j = 0; j < smllist.getCount(); j++) {
cres->startChar = smllist[j].loc.cpMin;
cres->size = smllist[j].loc.cpMax - smllist[j].loc.cpMin;
@@ -229,7 +229,7 @@ INT_PTR FreeTextBatch(WPARAM, LPARAM lParam) INT_PTR RegisterPack(WPARAM, LPARAM lParam)
{
- SMADD_REGCAT* smre = (SMADD_REGCAT*)lParam;
+ SMADD_REGCAT *smre = (SMADD_REGCAT*)lParam;
if (smre == NULL || smre->cbSize < sizeof(SMADD_REGCAT)) return FALSE;
if (IsBadStringPtrA(smre->name, 50) || IsBadStringPtrA(smre->dispname, 50)) return FALSE;
@@ -245,7 +245,7 @@ INT_PTR RegisterPack(WPARAM, LPARAM lParam) INT_PTR CustomCatMenu(WPARAM hContact, LPARAM lParam)
{
if (lParam != 0) {
- SmileyCategoryType* smct = g_SmileyCategories.GetSmileyCategory((unsigned)lParam - 3);
+ SmileyCategoryType *smct = g_SmileyCategories.GetSmileyCategory((unsigned)lParam - 3);
if (smct != NULL)
opt.WriteContactCategory(hContact, smct->GetName());
else {
@@ -266,9 +266,9 @@ INT_PTR CustomCatMenu(WPARAM hContact, LPARAM lParam) int RebuildContactMenu(WPARAM wParam, LPARAM)
{
- SmileyCategoryListType::SmileyCategoryVectorType& smc = *g_SmileyCategories.GetSmileyCategoryList();
+ SmileyCategoryListType::SmileyCategoryVectorType &smc = *g_SmileyCategories.GetSmileyCategoryList();
- char* protnam = GetContactProto(wParam);
+ char *protnam = GetContactProto(wParam);
bool haveMenu = IsSmileyProto(protnam);
if (haveMenu && opt.UseOneForAll) {
unsigned cnt = 0;
@@ -359,7 +359,7 @@ INT_PTR LoadContactSmileys(WPARAM, LPARAM lParam) {
if (opt.DisableCustom) return 0;
- SMADD_CONT* cont = (SMADD_CONT*)lParam;
+ SMADD_CONT *cont = (SMADD_CONT*)lParam;
switch (cont->type) {
case 0:
@@ -377,13 +377,13 @@ INT_PTR LoadContactSmileys(WPARAM, LPARAM lParam) int AccountListChanged(WPARAM wParam, LPARAM lParam)
{
- PROTOACCOUNT* acc = (PROTOACCOUNT*)lParam;
+ PROTOACCOUNT *acc = (PROTOACCOUNT*)lParam;
switch (wParam) {
case PRAC_ADDED:
if (acc != NULL) {
CMString catname(_T("Standard"));
- const CMString& defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename();
+ const CMString &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename();
g_SmileyCategories.AddAccountAsCategory(acc, defaultFile);
}
break;
@@ -391,7 +391,7 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) case PRAC_CHANGED:
if (acc != NULL && acc->szModuleName != NULL) {
CMString name(_A2T(acc->szModuleName));
- SmileyCategoryType* smc = g_SmileyCategories.GetSmileyCategory(name);
+ SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(name);
if (smc != NULL) {
if (acc->tszAccountName) name = acc->tszAccountName;
smc->SetDisplayName(name);
@@ -407,7 +407,7 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) if (acc != NULL) {
if (acc->bIsEnabled) {
CMString catname(_T("Standard"));
- const CMString& defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename();
+ const CMString &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename();
g_SmileyCategories.AddAccountAsCategory(acc, defaultFile);
}
else g_SmileyCategories.DeleteAccountAsCategory(acc);
@@ -422,7 +422,7 @@ int DbSettingChanged(WPARAM hContact, LPARAM lParam) if (hContact == NULL)
return 0;
- DBCONTACTWRITESETTING* cws = (DBCONTACTWRITESETTING*)lParam;
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
if (cws->value.type == DBVT_DELETED)
return 0;
diff --git a/plugins/SmileyAdd/src/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp index 1fee508cd0..554ca0e492 100644 --- a/plugins/SmileyAdd/src/smileyroutines.cpp +++ b/plugins/SmileyAdd/src/smileyroutines.cpp @@ -19,8 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-ISmileyBase* CreateSmileyObject(SmileyType* sml);
-ISmileyBase* CreateAniSmileyObject(SmileyType* sml, COLORREF clr, bool ishpp);
+ISmileyBase* CreateSmileyObject(SmileyType *sml);
+ISmileyBase* CreateAniSmileyObject(SmileyType *sml, COLORREF clr, bool ishpp);
bool g_HiddenTextSupported = true;
@@ -29,13 +29,12 @@ bool g_HiddenTextSupported = true; const GUID IID_ITextDocument =
{ 0x8CC497C0, 0xA1DF, 0x11CE, { 0x80,0x98,0x00,0xAA,0x00,0x47,0xBE,0x5D } };
-void LookupAllSmileys(SmileyPackType* smileyPack, SmileyPackCType* smileyCPack, const TCHAR* lpstrText,
- SmileysQueueType& smllist, const bool firstOnly)
+void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, const TCHAR *lpstrText, SmileysQueueType &smllist, const bool firstOnly)
{
if (lpstrText == NULL || *lpstrText == 0) return;
- SmileyPackType::SmileyLookupType* sml = smileyPack ? smileyPack->GetSmileyLookup() : NULL;
- SmileyPackCType::SmileyLookupType* smlc = smileyCPack ? &smileyCPack->GetSmileyLookup() : NULL;
+ SmileyPackType::SmileyLookupType *sml = smileyPack ? smileyPack->GetSmileyLookup() : NULL;
+ SmileyPackCType::SmileyLookupType *smlc = smileyCPack ? &smileyCPack->GetSmileyLookup() : NULL;
// Precompute number of smileys
int smlszo = sml ? sml->getCount() : 0;
@@ -45,7 +44,7 @@ void LookupAllSmileys(SmileyPackType* smileyPack, SmileyPackCType* smileyCPack, if (smlsz == 0) return;
// All possible smileys
- SmileyLookup::SmileyLocVecType* smileys = new SmileyLookup::SmileyLocVecType [smlsz];
+ SmileyLookup::SmileyLocVecType *smileys = new SmileyLookup::SmileyLocVecType [smlsz];
// Find all possible smileys
CMString tmpstr(lpstrText);
@@ -72,10 +71,10 @@ void LookupAllSmileys(SmileyPackType* smileyPack, SmileyPackCType* smileyCPack, while (true) {
int firstSml = -1;
int firstSmlRef = -1;
- SmileyLookup::SmileyLocVecType* smlf = NULL;
+ SmileyLookup::SmileyLocVecType *smlf = NULL;
for (int csml=0; csml < smlsz; csml++) {
- SmileyLookup::SmileyLocVecType& smlv = smileys[csml];
+ SmileyLookup::SmileyLocVecType &smlv = smileys[csml];
int tsml;
for (tsml = csmlit[csml]; tsml < smlv.getCount(); tsml++) {
@@ -99,12 +98,12 @@ void LookupAllSmileys(SmileyPackType* smileyPack, SmileyPackCType* smileyCPack, ReplaceSmileyType *dat = new ReplaceSmileyType;
- const TCHAR* textToSearch = lpstrText + smloff;
- const TCHAR* textSmlStart = lpstrText + (*smlf)[firstSmlRef].pos;
- const TCHAR* textSmlEnd = textSmlStart + (*smlf)[firstSmlRef].len;
+ const TCHAR *textToSearch = lpstrText + smloff;
+ const TCHAR *textSmlStart = lpstrText + (*smlf)[firstSmlRef].pos;
+ const TCHAR *textSmlEnd = textSmlStart + (*smlf)[firstSmlRef].len;
// check if leading space exist
- const TCHAR* prech = _tcsdec(textToSearch, textSmlStart);
+ const TCHAR *prech = _tcsdec(textToSearch, textSmlStart);
dat->ldspace = prech != NULL ? _istspace(*prech) != 0 : smloff == 0;
// check if trailing space exist
@@ -144,8 +143,7 @@ void LookupAllSmileys(SmileyPackType* smileyPack, SmileyPackCType* smileyCPack, }
-void FindSmileyInText(SmileyPackType* smp, const TCHAR* str,
- unsigned& first, unsigned& size, SmileyType** sml)
+void FindSmileyInText(SmileyPackType *smp, const TCHAR *str, unsigned &first, unsigned &size, SmileyType **sml)
{
SmileysQueueType smllist;
LookupAllSmileys(smp, NULL, str, smllist, true);
@@ -161,15 +159,15 @@ void FindSmileyInText(SmileyPackType* smp, const TCHAR* str, }
-SmileyType* FindButtonSmiley(SmileyPackType* smp)
+SmileyType* FindButtonSmiley(SmileyPackType *smp)
{
unsigned start, size;
- SmileyType* sml;
+ SmileyType *sml;
FindSmileyInText(smp, smp->GetButtonSmiley(), start, size, &sml);
return sml;
}
-void UpdateSelection(CHARRANGE& sel, int pos, int dif)
+void UpdateSelection(CHARRANGE &sel, int pos, int dif)
{
if (sel.cpMax == sel.cpMin) {
if (sel.cpMax < LONG_MAX && sel.cpMax > pos) {
@@ -178,12 +176,14 @@ void UpdateSelection(CHARRANGE& sel, int pos, int dif) }
}
else {
- if (sel.cpMax >= pos && sel.cpMax < LONG_MAX) sel.cpMax += dif;
- if (sel.cpMin > pos) sel.cpMin += dif;
+ if (sel.cpMax >= pos && sel.cpMax < LONG_MAX)
+ sel.cpMax += dif;
+ if (sel.cpMin > pos)
+ sel.cpMin += dif;
}
}
-void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const CHARRANGE& sel, bool useHidden, bool ignoreLast, bool unFreeze, bool fireView)
+void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const CHARRANGE &sel, bool useHidden, bool ignoreLast, bool unFreeze, bool fireView)
{
CComPtr<IRichEditOle> RichEditOle;
if (SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
@@ -265,7 +265,7 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const // Replace smileys specified in the list in RichEdit
for (int j = smllist.getCount()-1; j >= 0; j--) {
- CHARRANGE& smlpos = smllist[j].loc;
+ CHARRANGE &smlpos = smllist[j].loc;
if (ignoreLast && oldSel.cpMax == smlpos.cpMax)
continue;
diff --git a/plugins/SmileyAdd/src/smileyroutines.h b/plugins/SmileyAdd/src/smileyroutines.h index 3b0a08d60e..93b00cb08e 100644 --- a/plugins/SmileyAdd/src/smileyroutines.h +++ b/plugins/SmileyAdd/src/smileyroutines.h @@ -23,8 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. typedef struct ReplaceSmileyType_tag
{
CHARRANGE loc;
- SmileyType* sml;
- SmileyCType* smlc;
+ SmileyType *sml;
+ SmileyCType *smlc;
bool ldspace;
bool trspace;
} ReplaceSmileyType;
@@ -34,10 +34,10 @@ typedef SMOBJLIST<ReplaceSmileyType> SmileysQueueType; -void LookupAllSmileys(SmileyPackType* smileyPack, SmileyPackCType* smileyCPack, const TCHAR* lpstrText, SmileysQueueType& smllist, const bool firstOnly);
-void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const CHARRANGE& sel, bool useHidden, bool ignoreLast, bool unFreeze, bool fireView = 0);
-void ReplaceSmileysWithText(HWND hwnd, CHARRANGE& sel, bool keepFrozen);
-void FindSmileyInText(SmileyPackType* smp, const TCHAR* str, unsigned& first, unsigned& size, SmileyType** index);
-SmileyType* FindButtonSmiley(SmileyPackType* smp);
+void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, const TCHAR *lpstrText, SmileysQueueType &smllist, const bool firstOnly);
+void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const CHARRANGE &sel, bool useHidden, bool ignoreLast, bool unFreeze, bool fireView = 0);
+void ReplaceSmileysWithText(HWND hwnd, CHARRANGE &sel, bool keepFrozen);
+void FindSmileyInText(SmileyPackType *smp, const TCHAR *str, unsigned &first, unsigned &size, SmileyType **index);
+SmileyType* FindButtonSmiley(SmileyPackType *smp);
#endif
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 1c178a914f..716b74572c 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -158,7 +158,7 @@ bool SmileyType::LoadFromResource(const CMString &file, const int index) void SmileyType::GetSize(SIZE &size)
{
if (m_size.cy == 0) {
- ImageBase* img = CreateCachedImage();
+ ImageBase *img = CreateCachedImage();
if (img) {
img->GetSize(m_size);
img->Release();
@@ -184,7 +184,7 @@ void SmileyType::SetImList(HIMAGELIST hImLst, long i) HBITMAP SmileyType::GetBitmap(COLORREF bkgClr, int sizeX, int sizeY)
{
- ImageBase* img = CreateCachedImage();
+ ImageBase *img = CreateCachedImage();
if (!img) return NULL;
img->SelectFrame(m_index);
HBITMAP hBmp = img->GetBitmap(bkgClr, sizeX, sizeY);
@@ -270,7 +270,7 @@ void SmileyPackType::AddTriggersToSmileyLookup(void) for (int dist = 0; dist < m_SmileyList.getCount(); dist++) {
if (m_SmileyList[dist].IsRegEx()) {
- SmileyLookup* dats = new SmileyLookup(m_SmileyList[dist].GetTriggerText(), true, dist, GetFilename());
+ SmileyLookup *dats = new SmileyLookup(m_SmileyList[dist].GetTriggerText(), true, dist, GetFilename());
if (dats->IsValid())
m_SmileyLookup.insert(dats);
else
@@ -320,7 +320,7 @@ void SmileyPackType::AddTriggersToSmileyLookup(void) delete p;
}
-void SmileyPackType::ReplaceAllSpecials(const CMString& Input, CMString& Output)
+void SmileyPackType::ReplaceAllSpecials(const CMString &Input, CMString &Output)
{
Output = _TPattern::replace(_T("%%_{1,2}%%"), Input, _T(" "));
Output = _TPattern::replace(_T("%%''%%"), Output, _T("\""));
@@ -341,7 +341,7 @@ void SmileyPackType::Clear(void) errorFound = false;
}
-bool SmileyPackType::LoadSmileyFile(const CMString& filename, const CMString& packname, bool onlyInfo, bool noerr)
+bool SmileyPackType::LoadSmileyFile(const CMString &filename, const CMString &packname, bool onlyInfo, bool noerr)
{
Clear();
@@ -373,7 +373,7 @@ bool SmileyPackType::LoadSmileyFile(const CMString& filename, const CMString& pa const long flen = _filelength(fh);
// Allocate file buffer
- char* buf = new char[flen + sizeof(wchar_t)];
+ char *buf = new char[flen + sizeof(wchar_t)];
// Read xep file in
int len = _read(fh, buf, flen);
@@ -540,7 +540,7 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString & }
-static void DecodeHTML(CMString& str)
+static void DecodeHTML(CMString &str)
{
if (str.Find('&') != -1) {
str = _TPattern::replace(CMString(_T("<")), str, CMString(_T("<")));
@@ -549,7 +549,7 @@ static void DecodeHTML(CMString& str) }
-static IStream* DecodeBase64Data(const char* pData)
+static IStream* DecodeBase64Data(const char *pData)
{
unsigned dataLen;
ptrA data((char*)mir_base64_decode(pData, &dataLen));
@@ -571,7 +571,7 @@ static IStream* DecodeBase64Data(const char* pData) }
-bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString&)
+bool SmileyPackType::LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString&)
{
_TMatcher *m0, *m1, *m2;
@@ -626,7 +626,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString&) m1 = imagedt_re->createTMatcher(images);
if (m1->findFirstMatch()) {
- IStream* pStream = DecodeBase64Data(_T2A(m1->getGroup(1).c_str()));
+ IStream *pStream = DecodeBase64Data(_T2A(m1->getGroup(1).c_str()));
if (pStream != NULL) {
if (m_hSmList != NULL) ImageList_Destroy(m_hSmList);
m_hSmList = ImageList_Read(pStream);
@@ -669,7 +669,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString&) m2 = imagedt_re->createTMatcher(images);
if (m2->findFirstMatch()) {
- IStream* pStream = DecodeBase64Data(_T2A(m2->getGroup(1).c_str()));
+ IStream *pStream = DecodeBase64Data(_T2A(m2->getGroup(1).c_str()));
if (pStream != NULL) {
dat->LoadFromImage(pStream);
pStream->Release();
@@ -709,7 +709,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString&) //
-bool SmileyPackListType::AddSmileyPack(CMString& filename, CMString& packname)
+bool SmileyPackListType::AddSmileyPack(CMString &filename, CMString &packname)
{
bool res = true;
if (GetSmileyPack(filename) == NULL) { //not exist yet, so add
@@ -725,7 +725,7 @@ bool SmileyPackListType::AddSmileyPack(CMString& filename, CMString& packname) }
-SmileyPackType* SmileyPackListType::GetSmileyPack(CMString& filename)
+SmileyPackType* SmileyPackListType::GetSmileyPack(CMString &filename)
{
CMString modpath;
pathToAbsolute(filename, modpath);
@@ -749,9 +749,8 @@ void SmileyPackListType::ClearAndFreeAll() //
-SmileyCategoryType::SmileyCategoryType(SmileyPackListType* pSPS, const CMString& name,
- const CMString& displayName,
- const CMString& defaultFilename, SmcType typ)
+SmileyCategoryType::SmileyCategoryType(SmileyPackListType *pSPS, const CMString &name,
+ const CMString &displayName, const CMString &defaultFilename, SmcType typ)
{
m_pSmileyPackStore = pSPS;
type = typ;
@@ -801,7 +800,7 @@ void SmileyCategoryListType::ClearAndLoadAll(void) }
-SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(const CMString& name)
+SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(const CMString &name)
{
for (int i = 0; i < m_SmileyCategories.getCount(); i++)
if (name.CompareNoCase(m_SmileyCategories[i].GetName()) == 0)
@@ -817,9 +816,9 @@ SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(unsigned index) }
-SmileyPackType* SmileyCategoryListType::GetSmileyPack(CMString& categoryname)
+SmileyPackType* SmileyCategoryListType::GetSmileyPack(CMString &categoryname)
{
- SmileyCategoryType* smc = GetSmileyCategory(categoryname);
+ SmileyCategoryType *smc = GetSmileyCategory(categoryname);
return smc != NULL ? smc->GetSmileyPack() : NULL;
}
@@ -838,7 +837,7 @@ void SmileyCategoryListType::SaveSettings(void) }
-void SmileyCategoryListType::AddAndLoad(const CMString& name, const CMString& displayName)
+void SmileyCategoryListType::AddAndLoad(const CMString &name, const CMString &displayName)
{
if (GetSmileyCategory(name) != NULL)
return;
@@ -850,12 +849,10 @@ void SmileyCategoryListType::AddAndLoad(const CMString& name, const CMString& di }
-void SmileyCategoryListType::AddCategory(const CMString& name, const CMString& displayName,
- SmcType typ, const CMString& defaultFilename)
+void SmileyCategoryListType::AddCategory(const CMString &name, const CMString &displayName, SmcType typ, const CMString &defaultFilename)
{
if (GetSmileyCategory(name) == NULL)
- m_SmileyCategories.insert(new SmileyCategoryType(m_pSmileyPackStore, name,
- displayName, defaultFilename, typ));
+ m_SmileyCategories.insert(new SmileyCategoryType(m_pSmileyPackStore, name, displayName, defaultFilename, typ));
}
@@ -870,7 +867,7 @@ bool SmileyCategoryListType::DeleteCustomCategory(int index) return false;
}
-void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMString& defaultFile)
+void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMString &defaultFile)
{
if (Proto_IsAccountEnabled(acc) && acc->szProtoName && IsSmileyProto(acc->szModuleName)) {
CMString displayName(acc->tszAccountName ? acc->tszAccountName : _A2T(acc->szModuleName));
@@ -887,7 +884,7 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr paths = g_SmileyCategories.GetSmileyCategory(PhysProtoName) ? g_SmileyCategories.GetSmileyCategory(PhysProtoName)->GetFilename() : _T("");
if (paths.IsEmpty()) {
- const char* packnam = acc->szProtoName;
+ const char *packnam = acc->szProtoName;
if (mir_strcmp(packnam, "JABBER") == 0)
packnam = "JGMail";
else if (strstr(packnam, "SIP") != NULL)
@@ -909,12 +906,12 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr }
}
-void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMString& defaultFile)
+void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMString &defaultFile)
{
if (acc == NULL)
return;
- const char* packnam = acc;
+ const char *packnam = acc;
if (mir_strcmp(packnam, "JABBER") == 0)
packnam = "JGMail";
else if (strstr(packnam, "SIP") != NULL)
@@ -940,7 +937,7 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) CMString tname(_A2T(acc->szModuleName));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- char* proto = GetContactProto(hContact);
+ char *proto = GetContactProto(hContact);
if (proto == NULL)
continue;
@@ -961,10 +958,11 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) }
}
-void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, const CMString& defaultFile)
+void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, const CMString &defaultFile)
{
- char* proto = GetContactProto(hContact);
- if (proto == NULL) return;
+ char *proto = GetContactProto(hContact);
+ if (proto == NULL)
+ return;
DBVARIANT dbv;
if (!db_get_ts(hContact, proto, "Transport", &dbv)) {
@@ -972,7 +970,7 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co db_free(&dbv);
return;
}
- char* trsp = mir_strdup(_T2A(dbv.ptszVal));
+ char *trsp = mir_strdup(_T2A(dbv.ptszVal));
_strlwr(trsp);
const char *packname = NULL;
@@ -1055,7 +1053,7 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) }
-SmileyLookup::SmileyLookup(const CMString& str, const bool regexs, const int ind, const CMString& smpt)
+SmileyLookup::SmileyLookup(const CMString &str, const bool regexs, const int ind, const CMString &smpt)
{
TCHAR msgtxt[1024];
@@ -1065,7 +1063,7 @@ SmileyLookup::SmileyLookup(const CMString& str, const bool regexs, const int ind m_pattern = _TPattern::compile(str);
m_valid = m_pattern != NULL;
if (m_valid) {
- _TMatcher* matcher = m_pattern->createTMatcher(testString);
+ _TMatcher *matcher = m_pattern->createTMatcher(testString);
m_valid &= (!matcher->findFirstMatch() ||
matcher->getStartingIndex() != matcher->getEndingIndex());
if (!m_valid) {
@@ -1096,12 +1094,12 @@ SmileyLookup::~SmileyLookup() }
-void SmileyLookup::Find(const CMString& str, SmileyLocVecType& smlcur, bool firstOnly) const
+void SmileyLookup::Find(const CMString &str, SmileyLocVecType &smlcur, bool firstOnly) const
{
if (!m_valid) return;
if (m_text.IsEmpty()) {
- _TMatcher* matcher = m_pattern->createTMatcher(str);
+ _TMatcher *matcher = m_pattern->createTMatcher(str);
while (matcher->findNextMatch()) {
int st = matcher->getStartingIndex();
int sz = matcher->getEndingIndex() - st;
@@ -1114,7 +1112,7 @@ void SmileyLookup::Find(const CMString& str, SmileyLocVecType& smlcur, bool firs delete matcher;
}
else {
- const TCHAR* pos = str.c_str();
+ const TCHAR *pos = str.c_str();
while ((pos = _tcsstr(pos, m_text.c_str())) != NULL) {
smlcur.insert(new SmileyLocType(pos - str.c_str(), m_text.GetLength()));
pos += m_text.GetLength();
diff --git a/plugins/SmileyAdd/src/smileys.h b/plugins/SmileyAdd/src/smileys.h index 298b0ae036..e61cd50920 100644 --- a/plugins/SmileyAdd/src/smileys.h +++ b/plugins/SmileyAdd/src/smileys.h @@ -23,11 +23,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MS_SMILEYADD_CUSTOMCATMENU "SmileyAdd/CustomCatMenu"
-const unsigned HiddenSmiley = 1;
-const unsigned RegExSmiley = 2;
-const unsigned ServiceSmiley = 4;
-const unsigned TextSmiley = 8;
-const unsigned SoundSmiley = 16;
+const unsigned HiddenSmiley = 1;
+const unsigned RegExSmiley = 2;
+const unsigned ServiceSmiley = 4;
+const unsigned TextSmiley = 8;
+const unsigned SoundSmiley = 16;
class SmileyType
{
@@ -40,12 +40,14 @@ protected: SIZE m_size;
HICON m_SmileyIcon;
- ImageBase* m_xepimg;
+ ImageBase *m_xepimg;
CMString m_filepath;
void SetFlagsBit(unsigned flag, bool set)
- { if (set) m_flags |= flag; else m_flags &= ~flag; }
+ {
+ if (set) m_flags |= flag; else m_flags &= ~flag;
+ }
public:
@@ -72,7 +74,7 @@ public: ImageBase* CreateCachedImage(void);
- void GetSize(SIZE& size);
+ void GetSize(SIZE &size);
HICON GetIcon(void);
HICON GetIconDup(void);
@@ -94,8 +96,8 @@ public: void SetImList(HIMAGELIST hImLst, long i);
- bool LoadFromResource(const CMString& file, const int index);
- bool LoadFromImage(IStream* pStream);
+ bool LoadFromResource(const CMString &file, const int index);
+ bool LoadFromImage(IStream *pStream);
};
template<class T> struct SMOBJLIST : public OBJLIST<T>
@@ -103,23 +105,23 @@ template<class T> struct SMOBJLIST : public OBJLIST<T> SMOBJLIST() : OBJLIST<T>(5) {};
SMOBJLIST<T>& operator = (const SMOBJLIST<T>& lst)
- {
+ {
OBJLIST<T>::destroy();
- return operator += (lst);
+ return operator += (lst);
}
SMOBJLIST<T>& operator += (const SMOBJLIST<T>& lst)
- {
- for (int i=0; i < lst.getCount(); i++) {
- T *p = new T(lst[i]);
+ {
+ for (int i = 0; i < lst.getCount(); i++) {
+ T *p = new T(lst[i]);
insert(p);
}
- return *this;
+ return *this;
}
- void splice(SMOBJLIST<T>& lst)
+ void splice(SMOBJLIST<T> &lst)
{
- for (int i=0; i < lst.getCount(); i++)
+ for (int i = 0; i < lst.getCount(); i++)
insert(&lst[i]);
lst.LIST<T>::destroy();
}
@@ -128,7 +130,7 @@ template<class T> struct SMOBJLIST : public OBJLIST<T> class SmileyLookup
{
private:
- _TPattern* m_pattern;
+ _TPattern *m_pattern;
int m_ind;
CMString m_text;
@@ -136,18 +138,18 @@ private: public:
struct SmileyLocType
- {
- size_t pos, len;
+ {
+ size_t pos, len;
SmileyLocType(size_t p, size_t l) : pos(p), len(l) {}
SmileyLocType() {}
};
typedef SMOBJLIST<SmileyLocType> SmileyLocVecType;
SmileyLookup() { m_ind = 0; m_valid = false; m_pattern = NULL; };
- SmileyLookup(const CMString& str, const bool regexs, const int ind, const CMString& smpt);
+ SmileyLookup(const CMString &str, const bool regexs, const int ind, const CMString &smpt);
~SmileyLookup();
- void Find(const CMString& str, SmileyLocVecType& smlcur, bool firstOnly) const;
+ void Find(const CMString &str, SmileyLocVecType &smlcur, bool firstOnly) const;
int GetIndex(void) const { return m_ind; }
bool IsValid(void) const { return m_valid; }
};
@@ -171,18 +173,17 @@ private: HIMAGELIST m_hSmList;
- int m_VisibleCount;
+ int m_VisibleCount;
SmileyVectorType m_SmileyList;
SmileyLookupType m_SmileyLookup;
bool errorFound;
- void InsertLookup(SmileyType& sml, CMString& lk, bool first);
void AddTriggersToSmileyLookup(void);
- void ReplaceAllSpecials(const CMString& Input, CMString& Output);
- bool LoadSmileyFileMSL(CMString& tbuf, bool onlyInfo, CMString& modpath);
- bool LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString& modpath);
+ void ReplaceAllSpecials(const CMString &Input, CMString &Output);
+ bool LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString &modpath);
+ bool LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString &modpath);
public:
SmileyPackType();
@@ -204,13 +205,13 @@ public: const TCHAR* GetButtonSmiley(void) const { return m_ButtonSmiley.c_str(); }
- bool LoadSmileyFile(const CMString& filename, const CMString& packname, bool onlyInfo, bool noerr = false);
+ bool LoadSmileyFile(const CMString &filename, const CMString &packname, bool onlyInfo, bool noerr = false);
void Clear(void);
};
-class SmileyPackListType
+class SmileyPackListType
{
public:
typedef SMOBJLIST<SmileyPackType> SmileyPackVectorType;
@@ -221,7 +222,7 @@ private: public:
int NumberOfSmileyPacks(void) { return m_SmileyPacks.getCount(); }
- bool AddSmileyPack(CMString& filename, CMString& packname );
+ bool AddSmileyPack(CMString &filename, CMString &packname);
void ClearAndFreeAll(void);
SmileyPackType* GetSmileyPack(CMString& filename);
};
@@ -254,21 +255,20 @@ private: bool visible;
public:
- SmileyCategoryType() { type = smcNone; m_pSmileyPackStore = NULL; visible = true; };
- SmileyCategoryType(SmileyPackListType* pSPS, const CMString& name,
- const CMString& displayName, const CMString& defaultFilename, SmcType typ);
+ SmileyCategoryType() { type = smcNone; m_pSmileyPackStore = NULL; visible = true; };
+ SmileyCategoryType(SmileyPackListType *pSPS, const CMString &name, const CMString &displayName, const CMString &defaultFilename, SmcType typ);
const CMString& GetDisplayName(void) const { return m_DisplayName; }
const CMString& GetName(void) const { return m_Name; }
const CMString& GetFilename(void) const { return m_Filename; }
bool IsCustom(void) { return type == smcCustom; }
- bool IsProto(void) { return type == smcProto || type == smcPhysProto || type == smcTransportProto || type == smcVirtualProto; }
- bool IsAcc(void) { return type == smcProto; }
- bool IsVirtual(void) { return type == smcVirtualProto; }
- bool IsPhysProto(void) { return type == smcPhysProto; }
- bool IsTransportProto(void) { return type == smcTransportProto; }
- bool IsExt(void) { return type == smcExt; }
+ bool IsProto(void) { return type == smcProto || type == smcPhysProto || type == smcTransportProto || type == smcVirtualProto; }
+ bool IsAcc(void) { return type == smcProto; }
+ bool IsVirtual(void) { return type == smcVirtualProto; }
+ bool IsPhysProto(void) { return type == smcPhysProto; }
+ bool IsTransportProto(void) { return type == smcTransportProto; }
+ bool IsExt(void) { return type == smcExt; }
bool IsVisible(void) { return visible; }
SmcType GetType(void) { return type; }
@@ -293,10 +293,10 @@ public: private:
SmileyCategoryVectorType m_SmileyCategories;
- SmileyPackListType* m_pSmileyPackStore;
+ SmileyPackListType *m_pSmileyPackStore;
-public:
- void SetSmileyPackStore(SmileyPackListType* pSPS) { m_pSmileyPackStore = pSPS; }
+public:
+ void SetSmileyPackStore(SmileyPackListType *pSPS) { m_pSmileyPackStore = pSPS; }
SmileyCategoryType* GetSmileyCategory(const CMString& name);
SmileyCategoryType* GetSmileyCategory(unsigned index);
@@ -308,14 +308,16 @@ public: void AddCategory(const CMString& name, const CMString& displayName, SmcType typ,
const CMString& defaultFilename = CMString(_T("Smileys\\nova\\default.msl")));
void AddAndLoad(const CMString& name, const CMString& displayName);
- void AddAllProtocolsAsCategory(void);
+ void AddAllProtocolsAsCategory(void);
void AddAccountAsCategory(PROTOACCOUNT *acc, const CMString& defaultFile);
void AddProtoAsCategory(char *acc, const CMString& defaultFile);
void AddContactTransportAsCategory(MCONTACT hContact, const CMString& defaultFile);
void ClearAndLoadAll(void);
- void ClearAll(void)
- { m_pSmileyPackStore->ClearAndFreeAll(); m_SmileyCategories.destroy(); }
+ void ClearAll(void)
+ {
+ m_pSmileyPackStore->ClearAndFreeAll(); m_SmileyCategories.destroy();
+ }
bool DeleteCustomCategory(int index);
void DeleteAccountAsCategory(PROTOACCOUNT *acc);
diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp index c7eb03ff81..d297b8eb26 100644 --- a/plugins/SmileyAdd/src/smltool.cpp +++ b/plugins/SmileyAdd/src/smltool.cpp @@ -38,7 +38,7 @@ private: HWND m_hwndDialog;
HWND m_hToolTip;
HWND m_hWndTarget;
- SmileyPackType* m_pSmileyPack;
+ SmileyPackType *m_pSmileyPack;
int m_CurrentHotTrack;
int m_XPosition;
int m_YPosition;
@@ -49,7 +49,7 @@ private: int rowSel;
bool m_Choosing;
- AnimatedPack* m_AniPack;
+ AnimatedPack *m_AniPack;
void InitDialog(LPARAM lParam);
void PaintWindow(void);
@@ -179,9 +179,9 @@ struct smlsrvstruct MCONTACT hContact;
};
-void CALLBACK smileyServiceCallback(void* arg)
+void CALLBACK smileyServiceCallback(void *arg)
{
- smlsrvstruct* p = (smlsrvstruct*)arg;
+ smlsrvstruct *p = (smlsrvstruct*)arg;
p->sml->CallSmileyService(p->hContact);
delete p;
}
@@ -192,7 +192,7 @@ void SmileyToolWindowType::InsertSmiley(void) SmileyType *sml = m_pSmileyPack->GetSmiley(m_CurrentHotTrack);
if (sml->IsService()) {
- smlsrvstruct* p = new smlsrvstruct(sml, m_hContact);
+ smlsrvstruct *p = new smlsrvstruct(sml, m_hContact);
CallFunctionAsync(smileyServiceCallback, p);
}
else {
@@ -235,7 +235,7 @@ void SmileyToolWindowType::SmileySel(int but) ti.hwnd = m_hwndDialog;
ti.uId = (UINT_PTR)m_hwndDialog;
- const CMString& toolText = m_pSmileyPack->GetSmiley(m_CurrentHotTrack)->GetToolText();
+ const CMString &toolText = m_pSmileyPack->GetSmiley(m_CurrentHotTrack)->GetToolText();
ti.lpszText = const_cast<TCHAR*>(toolText.c_str());
SendMessage(m_hToolTip, TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
SendMessage(m_hToolTip, TTM_ACTIVATE, TRUE, 0);
@@ -435,7 +435,7 @@ void SmileyToolWindowType::KeyUp(WPARAM wParam, LPARAM lParam) void SmileyToolWindowType::InitDialog(LPARAM lParam)
{
LPCREATESTRUCT createStruct = (LPCREATESTRUCT)lParam;
- SmileyToolWindowParam* stwp = (SmileyToolWindowParam*)createStruct->lpCreateParams;
+ SmileyToolWindowParam *stwp = (SmileyToolWindowParam*)createStruct->lpCreateParams;
m_pSmileyPack = stwp->pSmileyPack;
m_XPosition = stwp->xPosition;
diff --git a/plugins/SmileyAdd/src/smltool.h b/plugins/SmileyAdd/src/smltool.h index 76a9c7e06e..41072787a0 100644 --- a/plugins/SmileyAdd/src/smltool.h +++ b/plugins/SmileyAdd/src/smltool.h @@ -24,7 +24,7 @@ class SmileyPackType; struct SmileyToolWindowParam
{
- SmileyPackType* pSmileyPack;
+ SmileyPackType *pSmileyPack;
int xPosition;
int yPosition;
int direction;
diff --git a/plugins/SmileyAdd/src/stdafx.h b/plugins/SmileyAdd/src/stdafx.h index 66e7f9f93a..f45b5a5365 100644 --- a/plugins/SmileyAdd/src/stdafx.h +++ b/plugins/SmileyAdd/src/stdafx.h @@ -101,15 +101,7 @@ extern LIST<void> menuHandleArray; #define IDC_SMLBUTTON (WM_USER + 33)
-///////////////////////////////////////////////////
-//
-//defines from miranda im sources (undocumented!)
-//
-#define MI_IDC_LOG 1001 //rich edit
-#define MI_IDC_MESSAGE 1002 //edit control
-#define MI_IDC_QUOTE 1034 //button control
-#define MI_IDC_NAME 1009 //text control
-#define MI_IDC_ADD 1070 //Add button.
+#define MI_IDC_ADD 1070 // Add button
#define DM_REMAKELOG (WM_USER + 11)
#define DM_OPTIONSAPPLIED (WM_USER + 14)
@@ -125,14 +117,13 @@ extern LIST<void> menuHandleArray; void InstallDialogBoxHook(void);
void RemoveDialogBoxHook(void);
int UpdateSrmmDlg(WPARAM wParam, LPARAM lParam);
-bool IsOldSrmm(void);
//functions for general use (defined in general.cpp)
-int CalculateTextHeight(HDC hdc, CHARFORMAT2* chf);
+int CalculateTextHeight(HDC hdc, CHARFORMAT2 *chf);
const TCHAR* GetImageExt(CMString &fname);
MCONTACT DecodeMetaContact(MCONTACT hContact);
-bool IsSmileyProto(char* proto);
+bool IsSmileyProto(char *proto);
HICON ImageList_GetIconFixed (HIMAGELIST himl, INT i, UINT fStyle);
@@ -155,6 +146,6 @@ void RichEditData_Destroy(void); void CloseSmileys(void);
int CheckForTip(int x, int y, HWND hwnd, TCHAR **smltxt);
-void UrlDecode(char* str);
+void UrlDecode(char *str);
#endif
|