diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-06-27 14:59:05 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-06-27 14:59:05 +0000 |
commit | ed6dc419f633cdb5713fb6cf2dd180478114e7d2 (patch) | |
tree | 8ce729fe4b28bac4ab30d81ae36358909b823f21 /plugins/SmileyAdd | |
parent | bc595f022d9288a033a2acbbe51e5369e11ea03d (diff) |
SmileyAdd:
fix load unneeded smiley pack
fix double error message on apply options when smiley pack filed
git-svn-id: http://svn.miranda-ng.org/main/trunk@14415 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SmileyAdd')
-rw-r--r-- | plugins/SmileyAdd/src/options.cpp | 6 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/smileys.cpp | 16 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/smileys.h | 4 |
3 files changed, 14 insertions, 12 deletions
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 779e988246..0d219b0dbe 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -295,7 +295,7 @@ void OptionsDialogType::UpdateControls(bool force) SetDlgItemText(m_hwndDialog, IDC_FILENAME, smf.c_str());
if (smPack.GetFilename() != smf || force)
- smPack.LoadSmileyFile(smf, false, true);
+ smPack.LoadSmileyFile(smf, smPack.GetName() , false, true);
HWND hLstView = GetDlgItem(m_hwndDialog, IDC_CATEGORYLIST);
TreeView_SetCheckState(hLstView, TreeView_GetSelection(hLstView), smPack.SmileyCount() != 0);
@@ -381,7 +381,7 @@ void OptionsDialogType::PopulateSmPackList(void) tvi.item.iSelectedImage = i;
}
tvi.item.lParam = i;
- tvi.item.state = INDEXTOSTATEIMAGEMASK(smPack.LoadSmileyFile(smc[i].GetFilename(), true, true) ? 2 : 1);
+ tvi.item.state = INDEXTOSTATEIMAGEMASK(smPack.LoadSmileyFile(smc[i].GetFilename(), smc[i].GetDisplayName(), true, true) ? 2 : 1);
TreeView_InsertItem(hLstView, &tvi);
smPack.Clear();
@@ -505,7 +505,7 @@ void OptionsDialogType::ApplyChanges(void) g_SmileyCategories.SaveSettings();
g_SmileyCategories.ClearAndLoadAll();
- smPack.LoadSmileyFile(tmpsmcat.GetSmileyCategory(GetSelProto())->GetFilename(), false);
+ smPack.LoadSmileyFile(tmpsmcat.GetSmileyCategory(GetSelProto())->GetFilename(), tmpsmcat.GetSmileyCategory(GetSelProto())->GetDisplayName(),false, true);
NotifyEventHooks(hEvent1, 0, 0);
ProcessAllInputAreas(false);
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index c2dc9626e6..899e2580b1 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -292,7 +292,7 @@ void SmileyPackType::Clear(void) errorFound = false;
}
-bool SmileyPackType::LoadSmileyFile(const CMString& filename, bool onlyInfo, bool noerr)
+bool SmileyPackType::LoadSmileyFile(const CMString& filename, const CMString& packname, bool onlyInfo, bool noerr)
{
Clear();
@@ -308,9 +308,9 @@ bool SmileyPackType::LoadSmileyFile(const CMString& filename, bool onlyInfo, boo int fh = _topen(modpath.c_str(), _O_BINARY | _O_RDONLY);
if (fh == -1) {
if (!noerr) {
- static const TCHAR errmsg[] = LPGENT("Smiley pack %s not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys.");
+ static const TCHAR errmsg[] = LPGENT("Smiley pack %s for category \"%s\" not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys.");
TCHAR msgtxt[1024];
- mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), modpath.c_str());
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), modpath.c_str(), packname);
ReportError(msgtxt);
}
@@ -675,14 +675,14 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString& //
-bool SmileyPackListType::AddSmileyPack(CMString& filename)
+bool SmileyPackListType::AddSmileyPack(CMString& filename, CMString& packname)
{
bool res = true;
if (GetSmileyPack(filename) == NULL)
{ //not exist yet, so add
SmileyPackType *smileyPack = new SmileyPackType;
- res = smileyPack->LoadSmileyFile(filename, FALSE);
+ res = smileyPack->LoadSmileyFile(filename, packname, FALSE);
if (res)
m_SmileyPacks.insert(smileyPack);
else
@@ -732,8 +732,10 @@ SmileyCategoryType::SmileyCategoryType(SmileyPackListType* pSPS, const CMString& void SmileyCategoryType::Load(void)
{
- if (!opt.UseOneForAll || !IsProto())
- m_pSmileyPackStore->AddSmileyPack(m_Filename);
+ bool visiblecat = opt.UsePhysProto ? !IsAcc() : !IsPhysProto();
+ bool visible = opt.UseOneForAll ? !IsProto() : visiblecat;
+ if (visible)
+ m_pSmileyPackStore->AddSmileyPack(m_Filename, m_DisplayName);
}
diff --git a/plugins/SmileyAdd/src/smileys.h b/plugins/SmileyAdd/src/smileys.h index f3836a3e67..921860fd5a 100644 --- a/plugins/SmileyAdd/src/smileys.h +++ b/plugins/SmileyAdd/src/smileys.h @@ -197,7 +197,7 @@ public: const TCHAR* GetButtonSmiley(void) const { return m_ButtonSmiley.c_str(); }
- bool LoadSmileyFile(const CMString& filename, bool onlyInfo, bool noerr = false);
+ bool LoadSmileyFile(const CMString& filename, const CMString& packname, bool onlyInfo, bool noerr = false);
void Clear(void);
};
@@ -214,7 +214,7 @@ private: public:
int NumberOfSmileyPacks(void) { return m_SmileyPacks.getCount(); }
- bool AddSmileyPack(CMString& filename);
+ bool AddSmileyPack(CMString& filename, CMString& packname );
void ClearAndFreeAll(void);
SmileyPackType* GetSmileyPack(CMString& filename);
};
|