From d5675b1834031fd7c99baa6d948fb550594fcd3a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 1 Mar 2016 16:45:43 +0000 Subject: - smileys rewritten to support true frame delays; - code cleaning; - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@16383 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SmileyAdd/src/customsmiley.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'plugins/SmileyAdd/src/customsmiley.cpp') diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index 32a6f7ff25..3e1413509e 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -20,7 +20,6 @@ along with this program. If not, see . SmileyPackCListType g_SmileyPackCStore; - bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, TCHAR* dir) { bool res = true; @@ -37,11 +36,10 @@ bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, TCHAR* dir) return res; } - bool SmileyPackCListType::AddSmiley(MCONTACT hContact, TCHAR* path) { SmileyPackCType *smpack = GetSmileyPack(hContact); - if (smpack == NULL) { + if (smpack == NULL) { smpack = new SmileyPackCType; smpack->SetId(hContact); @@ -63,7 +61,7 @@ SmileyPackCType* SmileyPackCListType::GetSmileyPack(MCONTACT id) SmileyCType::SmileyCType(const CMString& fullpath, const TCHAR* filepath) { - LoadFromResource(fullpath, 0); + LoadFromResource(fullpath, 0); CreateTriggerText(T2A_SM(filepath)); } @@ -91,7 +89,6 @@ bool SmileyCType::CreateTriggerText(char* text) return true; } - // // SmileyPackCType // @@ -118,45 +115,42 @@ bool SmileyPackCType::LoadSmileyDir(TCHAR* dir) m_SmileyList.insert(smlc); } } - } - while( _tfindnext( hFile, &c_file ) == 0 ); - _findclose( hFile ); + } while (_tfindnext(hFile, &c_file) == 0); + _findclose(hFile); AddTriggersToSmileyLookup(); return true; } return false; } - bool SmileyPackCType::LoadSmiley(TCHAR* path) { CMString dirs = path; int slash = dirs.ReverseFind('\\'); int dot = dirs.ReverseFind('.'); - CMString name = dirs.Mid(slash+1, dot - slash - 1); + CMString name = dirs.Mid(slash + 1, dot - slash - 1); - for (int i=0; i < m_SmileyList.getCount(); i++) + for (int i = 0; i < m_SmileyList.getCount(); i++) if (m_SmileyList[i].GetTriggerText() == name) { m_SmileyList[i].LoadFromResource(dirs, 0); - return true; + return true; } m_SmileyList.insert(new SmileyCType(dirs, (TCHAR*)name.c_str())); CMString empty; m_SmileyLookup.insert(new SmileyLookup( - m_SmileyList[m_SmileyList.getCount()-1].GetTriggerText(), false, m_SmileyList.getCount()-1, empty)); + m_SmileyList[m_SmileyList.getCount() - 1].GetTriggerText(), false, m_SmileyList.getCount() - 1, empty)); return true; } - void SmileyPackCType::AddTriggersToSmileyLookup(void) { CMString empty; - for (int dist=0; dist