diff options
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 89 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 67 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgoptions.cpp | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 21 | ||||
-rw-r--r-- | plugins/TabSRMM/src/templates.cpp | 49 | ||||
-rw-r--r-- | plugins/TabSRMM/src/templates.h | 31 |
9 files changed, 115 insertions, 148 deletions
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 3fc97f38f9..17e249fc89 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -51,6 +51,14 @@ HWND TSAPI GetTabWindow(HWND hwndTab, int i) return (TabCtrl_GetItem(hwndTab, i, &tci)) ? (HWND)tci.lParam: nullptr;
}
+TContainerData::~TContainerData()
+{
+ delete m_pMenuBar;
+ delete m_pSideBar;
+ if (m_pSettings != &PluginConfig.globalContainerSettings)
+ mir_free(m_pSettings);
+}
+
void TContainerData::CloseTabByMouse(POINT *pt)
{
HWND hwndTab = GetDlgItem(m_hwnd, IDC_MSGTABS);
@@ -71,6 +79,73 @@ void TContainerData::InitRedraw() ::SetTimer(m_hwnd, (UINT_PTR)this, 100, nullptr);
}
+void TContainerData::LoadOverrideTheme()
+{
+ memset(&m_theme, 0, sizeof(TLogTheme));
+ if (mir_wstrlen(m_szAbsThemeFile) > 1) {
+ if (PathFileExists(m_szAbsThemeFile)) {
+ if (CheckThemeVersion(m_szAbsThemeFile) == 0) {
+ LoadThemeDefaults();
+ return;
+ }
+ if (m_ltr_templates == nullptr) {
+ m_ltr_templates = (TTemplateSet *)mir_alloc(sizeof(TTemplateSet));
+ memcpy(m_ltr_templates, <R_Active, sizeof(TTemplateSet));
+ }
+ if (m_rtl_templates == nullptr) {
+ m_rtl_templates = (TTemplateSet *)mir_alloc(sizeof(TTemplateSet));
+ memcpy(m_rtl_templates, &RTL_Active, sizeof(TTemplateSet));
+ }
+
+ m_theme.logFonts = (LOGFONTA *)mir_alloc(sizeof(LOGFONTA) * (MSGDLGFONTCOUNT + 2));
+ m_theme.fontColors = (COLORREF *)mir_alloc(sizeof(COLORREF) * (MSGDLGFONTCOUNT + 2));
+ m_theme.rtfFonts = (char *)mir_alloc((MSGDLGFONTCOUNT + 2) * RTFCACHELINESIZE);
+
+ ReadThemeFromINI(m_szAbsThemeFile, this, 0, THEME_READ_ALL);
+ m_theme.left_indent *= 15;
+ m_theme.right_indent *= 15;
+ m_theme.isPrivate = true;
+ if (CSkin::m_skinEnabled)
+ m_theme.bg = SkinItems[ID_EXTBKCONTAINER].COLOR;
+ else
+ m_theme.bg = PluginConfig.m_fillColor ? PluginConfig.m_fillColor : GetSysColor(COLOR_WINDOW);
+ return;
+ }
+ }
+ LoadThemeDefaults();
+}
+
+void TContainerData::LoadThemeDefaults()
+{
+ memset(&m_theme, 0, sizeof(TLogTheme));
+ m_theme.bg = db_get_dw(0, FONTMODULE, SRMSGSET_BKGCOLOUR, GetSysColor(COLOR_WINDOW));
+ m_theme.statbg = PluginConfig.crStatus;
+ m_theme.oldinbg = PluginConfig.crOldIncoming;
+ m_theme.oldoutbg = PluginConfig.crOldOutgoing;
+ m_theme.inbg = PluginConfig.crIncoming;
+ m_theme.outbg = PluginConfig.crOutgoing;
+ m_theme.hgrid = db_get_dw(0, FONTMODULE, "hgrid", RGB(224, 224, 224));
+ m_theme.left_indent = M.GetDword("IndentAmount", 20) * 15;
+ m_theme.right_indent = M.GetDword("RightIndent", 20) * 15;
+ m_theme.inputbg = db_get_dw(0, FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR);
+
+ for (int i = 1; i <= 5; i++) {
+ char szTemp[40];
+ mir_snprintf(szTemp, "cc%d", i);
+ COLORREF colour = M.GetDword(szTemp, RGB(224, 224, 224));
+ if (colour == 0)
+ colour = RGB(1, 1, 1);
+ m_theme.custom_colors[i - 1] = colour;
+ }
+ m_theme.logFonts = logfonts;
+ m_theme.fontColors = fontcolors;
+ m_theme.rtfFonts = nullptr;
+ m_ltr_templates = <R_Active;
+ m_rtl_templates = &RTL_Active;
+ m_theme.dwFlags = (M.GetDword("mwflags", MWF_LOG_DEFAULT) & MWF_LOG_ALL);
+ m_theme.isPrivate = false;
+}
+
// search tab with either next or most recent unread message and select it
void TContainerData::QueryPending(int iCommand)
{
@@ -703,7 +778,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0); // set options...
pContainer->m_dwFlags |= dwCreateFlags;
- LoadOverrideTheme(pContainer);
+ pContainer->LoadOverrideTheme();
DWORD ws = GetWindowLongPtr(hwndTab, GWL_STYLE);
if (pContainer->m_dwFlagsEx & TCF_FLAT)
ws |= TCS_BUTTONS;
@@ -1756,13 +1831,7 @@ panel_found: return 0;
case WM_NCDESTROY:
- if (pContainer) {
- delete pContainer->m_pMenuBar;
- delete pContainer->m_pSideBar;
- if (pContainer->m_pSettings != &PluginConfig.globalContainerSettings)
- mir_free(pContainer->m_pSettings);
- mir_free(pContainer);
- }
+ delete pContainer;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
break;
@@ -1879,9 +1948,7 @@ TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT h if (CMimAPI::m_shutDown)
return nullptr;
- TContainerData *pContainer = (TContainerData*)mir_calloc(sizeof(TContainerData));
- if (pContainer == nullptr)
- return nullptr;
+ TContainerData *pContainer = new TContainerData();
wcsncpy(pContainer->m_wszName, name, CONTAINER_NAMELEN + 1);
AppendToContainerList(pContainer);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 22b795a3ef..2d2ff4ef23 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -943,7 +943,7 @@ void CMsgDialog::DM_OptionsApplied(WPARAM, LPARAM lParam) { m_szMicroLf[0] = 0; if (!(m_pContainer->m_theme.isPrivate)) { - LoadThemeDefaults(m_pContainer); + m_pContainer->LoadThemeDefaults(); m_dwFlags = m_pContainer->m_theme.dwFlags; } diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 2ee4e63c13..91c0b3840f 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -365,73 +365,6 @@ bool IsStringValidLink(wchar_t *pszText) /////////////////////////////////////////////////////////////////////////////////////////
-void TSAPI LoadThemeDefaults(TContainerData *pContainer)
-{
- memset(&pContainer->m_theme, 0, sizeof(TLogTheme));
- pContainer->m_theme.bg = db_get_dw(0, FONTMODULE, SRMSGSET_BKGCOLOUR, GetSysColor(COLOR_WINDOW));
- pContainer->m_theme.statbg = PluginConfig.crStatus;
- pContainer->m_theme.oldinbg = PluginConfig.crOldIncoming;
- pContainer->m_theme.oldoutbg = PluginConfig.crOldOutgoing;
- pContainer->m_theme.inbg = PluginConfig.crIncoming;
- pContainer->m_theme.outbg = PluginConfig.crOutgoing;
- pContainer->m_theme.hgrid = db_get_dw(0, FONTMODULE, "hgrid", RGB(224, 224, 224));
- pContainer->m_theme.left_indent = M.GetDword("IndentAmount", 20) * 15;
- pContainer->m_theme.right_indent = M.GetDword("RightIndent", 20) * 15;
- pContainer->m_theme.inputbg = db_get_dw(0, FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR);
-
- for (int i = 1; i <= 5; i++) {
- char szTemp[40];
- mir_snprintf(szTemp, "cc%d", i);
- COLORREF colour = M.GetDword(szTemp, RGB(224, 224, 224));
- if (colour == 0)
- colour = RGB(1, 1, 1);
- pContainer->m_theme.custom_colors[i - 1] = colour;
- }
- pContainer->m_theme.logFonts = logfonts;
- pContainer->m_theme.fontColors = fontcolors;
- pContainer->m_theme.rtfFonts = nullptr;
- pContainer->m_ltr_templates = <R_Active;
- pContainer->m_rtl_templates = &RTL_Active;
- pContainer->m_theme.dwFlags = (M.GetDword("mwflags", MWF_LOG_DEFAULT) & MWF_LOG_ALL);
- pContainer->m_theme.isPrivate = false;
-}
-
-void TSAPI LoadOverrideTheme(TContainerData *pContainer)
-{
- memset(&pContainer->m_theme, 0, sizeof(TLogTheme));
- if (mir_wstrlen(pContainer->m_szAbsThemeFile) > 1) {
- if (PathFileExists(pContainer->m_szAbsThemeFile)) {
- if (CheckThemeVersion(pContainer->m_szAbsThemeFile) == 0) {
- LoadThemeDefaults(pContainer);
- return;
- }
- if (pContainer->m_ltr_templates == nullptr) {
- pContainer->m_ltr_templates = (TTemplateSet *)mir_alloc(sizeof(TTemplateSet));
- memcpy(pContainer->m_ltr_templates, <R_Active, sizeof(TTemplateSet));
- }
- if (pContainer->m_rtl_templates == nullptr) {
- pContainer->m_rtl_templates = (TTemplateSet *)mir_alloc(sizeof(TTemplateSet));
- memcpy(pContainer->m_rtl_templates, &RTL_Active, sizeof(TTemplateSet));
- }
-
- pContainer->m_theme.logFonts = (LOGFONTA *)mir_alloc(sizeof(LOGFONTA) * (MSGDLGFONTCOUNT + 2));
- pContainer->m_theme.fontColors = (COLORREF *)mir_alloc(sizeof(COLORREF) * (MSGDLGFONTCOUNT + 2));
- pContainer->m_theme.rtfFonts = (char *)mir_alloc((MSGDLGFONTCOUNT + 2) * RTFCACHELINESIZE);
-
- ReadThemeFromINI(pContainer->m_szAbsThemeFile, pContainer, 0, THEME_READ_ALL);
- pContainer->m_theme.left_indent *= 15;
- pContainer->m_theme.right_indent *= 15;
- pContainer->m_theme.isPrivate = true;
- if (CSkin::m_skinEnabled)
- pContainer->m_theme.bg = SkinItems[ID_EXTBKCONTAINER].COLOR;
- else
- pContainer->m_theme.bg = PluginConfig.m_fillColor ? PluginConfig.m_fillColor : GetSysColor(COLOR_WINDOW);
- return;
- }
- }
- LoadThemeDefaults(pContainer);
-}
-
LRESULT TSAPI GetSendButtonState(HWND hwnd)
{
HWND hwndIDok = GetDlgItem(hwnd, IDOK);
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h index 1766826cfe..4190dd178d 100644 --- a/plugins/TabSRMM/src/msgdlgutils.h +++ b/plugins/TabSRMM/src/msgdlgutils.h @@ -35,8 +35,6 @@ BOOL TSAPI CheckCustomLink(HWND hwndRich, POINT *ptClient, UINT uMsg, WPARAM int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact);
wchar_t* TSAPI QuoteText(const wchar_t *text);
UINT TSAPI GetIEViewMode(MCONTACT hContact);
-void TSAPI LoadOverrideTheme(TContainerData *pContainer);
-void TSAPI LoadThemeDefaults(TContainerData *pContainer);
int TSAPI CutContactName(const wchar_t *szold, wchar_t *sznew, size_t size);
LRESULT TSAPI GetSendButtonState(HWND hwnd);
void TSAPI RearrangeTab(HWND hwndDlg, const CMsgDialog *dat, int iMode, BOOL bSavePos);
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 101850dd1a..5ee5585133 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -27,7 +27,6 @@ // Implementation of the option pages
#include "stdafx.h"
-#include "templates.h"
#define DM_GETSTATUSMASK (WM_USER + 10)
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index e849d097af..539b641a3a 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -37,6 +37,7 @@ HMODULE g_hMsftedit; static void UnloadIcons();
+void LoadDefaultTemplates();
int OptInitialise(WPARAM wParam, LPARAM lParam);
void Chat_AddIcons(HINSTANCE);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 64961ed70b..5faea35d2b 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -169,8 +169,11 @@ struct TContainerSettings struct ButtonItem;
-struct TContainerData
+struct TContainerData : public MZeroedObject
{
+ TContainerData() {}
+ ~TContainerData();
+
TContainerData *pNext;
wchar_t m_wszName[CONTAINER_NAMELEN + 4]; // container name
@@ -198,7 +201,6 @@ struct TContainerData HWND m_hWndOptions;
BOOL m_bSizingLoop;
wchar_t m_szRelThemeFile[MAX_PATH], m_szAbsThemeFile[MAX_PATH];
- TTemplateSet *m_ltr_templates, *m_rtl_templates;
HDC m_cachedDC;
HBITMAP m_cachedHBM, m_oldHBM;
SIZE m_oldDCSize;
@@ -207,13 +209,12 @@ struct TContainerData TitleBtn m_oldbuttons[3];
int m_ncActive;
HWND m_hwndSaved;
- ButtonItem *m_buttonItems;
RECT m_rcSaved, m_rcLogSaved;
POINT m_ptLogSaved;
DWORD m_exFlags;
BOOL m_fPrivateThemeChanged;
MARGINS m_mOld;
- HDC m_cachedToolbarDC;
+ HDC m_cachedToolbarDC;
HBITMAP m_hbmToolbarBG, m_oldhbmToolbarBG;
SIZE m_szOldToolbarSize;
SIZE m_oldSize, m_preSIZE;
@@ -222,16 +223,20 @@ struct TContainerData TLogTheme m_theme;
CMenuBar *m_pMenuBar;
CSideBar *m_pSideBar;
+ ButtonItem *m_buttonItems;
+ TTemplateSet *m_ltr_templates, *m_rtl_templates;
CTaskbarInteract *m_pTaskBar;
TContainerSettings *m_pSettings;
- void InitRedraw();
+ void InitRedraw(void);
void CloseTabByMouse(POINT *);
+ void LoadOverrideTheme(void);
+ void LoadThemeDefaults(void);
void QueryPending(int iCommand);
- void RestoreWindowPos();
+ void RestoreWindowPos(void);
void SelectTab(int iCommand, int idx = 0);
void SetIcon(CMsgDialog *pDlg, HICON hIcon);
- void UpdateTabs();
+ void UpdateTabs(void);
void UpdateTitle(MCONTACT, class CMsgDialog* = nullptr);
void ClearMargins()
@@ -974,8 +979,6 @@ struct SIDEBARITEM #define IDC_TBFIRSTUID 10000 // first uId for custom buttons
-#include "templates.h"
-
// callback for the user menu entry
#define MS_TABMSG_SETUSERPREFS "SRMsg_MOD/SetUserPrefs"
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 52c5ca98b9..f03ba9ceab 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -74,8 +74,6 @@ TTemplateSet RTL_Default = }; TTemplateSet LTR_Active, RTL_Active; -static int helpActive = 0; - /* * loads template set overrides from hContact into the given set of already existing @@ -127,8 +125,8 @@ CTemplateEditDlg::CTemplateEditDlg(BOOL _rtl, HWND hwndParent) : { SetParent(hwndParent); - m_pContainer = (TContainerData*)mir_calloc(sizeof(TContainerData)); - LoadOverrideTheme(m_pContainer); + m_pContainer = new TContainerData(); + m_pContainer->LoadOverrideTheme(); tSet = rtl ? m_pContainer->m_rtl_templates : m_pContainer->m_ltr_templates; listTemplates.OnDblClick = Callback(this, &CTemplateEditDlg::onDblClick_List); @@ -145,13 +143,12 @@ CTemplateEditDlg::CTemplateEditDlg(BOOL _rtl, HWND hwndParent) : bool CTemplateEditDlg::OnInitDialog() { - // set hContact to the first found contact so that we can use the Preview window properly - // also, set other parameters needed by the streaming function to display events - m_log.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK); m_log.SendMsg(EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); m_log.SendMsg(EM_EXLIMITTEXT, 0, 0x80000000); + // set hContact to the first found contact so that we can use the Preview window properly + // also, set other parameters needed by the streaming function to display events m_hContact = db_find_first(); m_szProto = GetContactProto(m_hContact); while (m_szProto == nullptr && m_hContact != 0) { @@ -166,7 +163,7 @@ bool CTemplateEditDlg::OnInitDialog() m_cache->updateStats(TSessionStats::INIT_TIMER); GetMYUIN(); - SendDlgItemMessage(m_hwnd, IDC_EDITTEMPLATE, EM_LIMITTEXT, (WPARAM)TEMPLATE_LENGTH - 1, 0); + edtText.SendMsg(EM_LIMITTEXT, TEMPLATE_LENGTH - 1, 0); SetWindowText(m_hwnd, TranslateT("Template set editor")); Utils::enableDlgControl(m_hwnd, IDC_SAVETEMPLATE, FALSE); Utils::enableDlgControl(m_hwnd, IDC_REVERT, FALSE); @@ -183,7 +180,7 @@ bool CTemplateEditDlg::OnInitDialog() SendDlgItemMessage(m_hwnd, IDC_COLOR3, CPM_SETCOLOUR, 0, M.GetDword("cc3", SRMSGDEFSET_BKGCOLOUR)); SendDlgItemMessage(m_hwnd, IDC_COLOR4, CPM_SETCOLOUR, 0, M.GetDword("cc4", SRMSGDEFSET_BKGCOLOUR)); SendDlgItemMessage(m_hwnd, IDC_COLOR5, CPM_SETCOLOUR, 0, M.GetDword("cc5", SRMSGDEFSET_BKGCOLOUR)); - SendDlgItemMessage(m_hwnd, IDC_EDITTEMPLATE, EM_SETREADONLY, TRUE, 0); + edtText.SendMsg(EM_SETREADONLY, TRUE, 0); return true; } @@ -192,7 +189,7 @@ void CTemplateEditDlg::OnDestroy() Utils::enableDlgControl(m_hwndParent, IDC_MODIFY, TRUE); Utils::enableDlgControl(m_hwndParent, IDC_RTLMODIFY, TRUE); - mir_free(m_pContainer); + delete m_pContainer; db_set_dw(0, SRMSGMOD_T, "cc1", SendDlgItemMessage(m_hwnd, IDC_COLOR1, CPM_GETCOLOUR, 0, 0)); db_set_dw(0, SRMSGMOD_T, "cc2", SendDlgItemMessage(m_hwnd, IDC_COLOR2, CPM_GETCOLOUR, 0, 0)); @@ -219,15 +216,15 @@ void CTemplateEditDlg::onClick_Forget(CCtrlButton*) changed = FALSE; updateInfo[inEdit] = FALSE; selchanging = TRUE; - SetDlgItemText(m_hwnd, IDC_EDITTEMPLATE, tSet->szTemplates[inEdit]); - SetFocus(GetDlgItem(m_hwnd, IDC_EDITTEMPLATE)); + edtText.SetText(tSet->szTemplates[inEdit]); + SetFocus(edtText.GetHwnd()); InvalidateRect(GetDlgItem(m_hwnd, IDC_TEMPLATELIST), nullptr, FALSE); Utils::enableDlgControl(m_hwnd, IDC_SAVETEMPLATE, FALSE); Utils::enableDlgControl(m_hwnd, IDC_FORGET, FALSE); Utils::enableDlgControl(m_hwnd, IDC_TEMPLATELIST, TRUE); Utils::enableDlgControl(m_hwnd, IDC_REVERT, FALSE); selchanging = FALSE; - SendDlgItemMessage(m_hwnd, IDC_EDITTEMPLATE, EM_SETREADONLY, TRUE, 0); + edtText.SendMsg(EM_SETREADONLY, TRUE, 0); } void CTemplateEditDlg::onClick_Preview(CCtrlButton*) @@ -237,7 +234,7 @@ void CTemplateEditDlg::onClick_Preview(CCtrlButton*) if (changed) { memcpy(szTemp, tSet->szTemplates[inEdit], (TEMPLATE_LENGTH * sizeof(wchar_t))); - GetDlgItemText(m_hwnd, IDC_EDITTEMPLATE, tSet->szTemplates[inEdit], TEMPLATE_LENGTH); + edtText.GetText(tSet->szTemplates[inEdit], TEMPLATE_LENGTH); } DBEVENTINFO dbei = {}; @@ -283,22 +280,22 @@ void CTemplateEditDlg::onClick_Revert(CCtrlButton*) updateInfo[inEdit] = FALSE; selchanging = TRUE; memcpy(tSet->szTemplates[inEdit], LTR_Default.szTemplates[inEdit], sizeof(wchar_t) * TEMPLATE_LENGTH); - SetDlgItemText(m_hwnd, IDC_EDITTEMPLATE, tSet->szTemplates[inEdit]); + edtText.SetText(tSet->szTemplates[inEdit]); db_unset(0, rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[inEdit]); - SetFocus(GetDlgItem(m_hwnd, IDC_EDITTEMPLATE)); + SetFocus(edtText.GetHwnd()); InvalidateRect(GetDlgItem(m_hwnd, IDC_TEMPLATELIST), nullptr, FALSE); selchanging = FALSE; Utils::enableDlgControl(m_hwnd, IDC_SAVETEMPLATE, FALSE); Utils::enableDlgControl(m_hwnd, IDC_REVERT, FALSE); Utils::enableDlgControl(m_hwnd, IDC_FORGET, FALSE); Utils::enableDlgControl(m_hwnd, IDC_TEMPLATELIST, TRUE); - SendDlgItemMessage(m_hwnd, IDC_EDITTEMPLATE, EM_SETREADONLY, TRUE, 0); + edtText.SendMsg(EM_SETREADONLY, TRUE, 0); } + void CTemplateEditDlg::onClick_Save(CCtrlButton*) { wchar_t newTemplate[TEMPLATE_LENGTH + 2]; - - GetDlgItemText(m_hwnd, IDC_EDITTEMPLATE, newTemplate, _countof(newTemplate)); + edtText.GetText(newTemplate, _countof(newTemplate)); memcpy(tSet->szTemplates[inEdit], newTemplate, sizeof(wchar_t) * TEMPLATE_LENGTH); changed = FALSE; updateInfo[inEdit] = FALSE; @@ -308,19 +305,19 @@ void CTemplateEditDlg::onClick_Save(CCtrlButton*) Utils::enableDlgControl(m_hwnd, IDC_REVERT, FALSE); InvalidateRect(GetDlgItem(m_hwnd, IDC_TEMPLATELIST), nullptr, FALSE); db_set_ws(0, rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[inEdit], newTemplate); - SendDlgItemMessage(m_hwnd, IDC_EDITTEMPLATE, EM_SETREADONLY, TRUE, 0); + edtText.SendMsg(EM_SETREADONLY, TRUE, 0); } void CTemplateEditDlg::onDblClick_List(CCtrlListBox*) { LRESULT iIndex = SendDlgItemMessage(m_hwnd, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0); if (iIndex != LB_ERR) { - SetDlgItemText(m_hwnd, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]); + edtText.SetText(tSet->szTemplates[iIndex]); inEdit = iIndex; changed = FALSE; selchanging = FALSE; - SetFocus(GetDlgItem(m_hwnd, IDC_EDITTEMPLATE)); - SendDlgItemMessage(m_hwnd, IDC_EDITTEMPLATE, EM_SETREADONLY, FALSE, 0); + SetFocus(edtText.GetHwnd()); + edtText.SendMsg(EM_SETREADONLY, FALSE, 0); } } @@ -329,11 +326,11 @@ void CTemplateEditDlg::onSelChange_List(CCtrlListBox*) LRESULT iIndex = SendDlgItemMessage(m_hwnd, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0); selchanging = TRUE; if (iIndex != LB_ERR) { - SetDlgItemText(m_hwnd, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]); + edtText.SetText(tSet->szTemplates[iIndex]); inEdit = iIndex; changed = FALSE; } - SendDlgItemMessage(m_hwnd, IDC_EDITTEMPLATE, EM_SETREADONLY, TRUE, 0); + edtText.SendMsg(EM_SETREADONLY, TRUE, 0); } INT_PTR CTemplateEditDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -365,5 +362,5 @@ INT_PTR CTemplateEditDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, pszName, (int)mir_strlen(pszName)); } - return CSuper::DlgProc(uMsg, wParam, lParam); + return CSrmmBaseDialog::DlgProc(uMsg, wParam, lParam); } diff --git a/plugins/TabSRMM/src/templates.h b/plugins/TabSRMM/src/templates.h deleted file mode 100644 index 1f5fc44603..0000000000 --- a/plugins/TabSRMM/src/templates.h +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////
-// Miranda NG: the free IM client for Microsoft* Windows*
-//
-// Copyright (C) 2012-19 Miranda NG team,
-// Copyright (c) 2000-09 Miranda ICQ/IM project,
-// all portions of this codebase are copyrighted to the people
-// listed in contributors.txt.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// you should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-// part of tabSRMM messaging plugin for Miranda.
-//
-// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
-//
-// templates for the message log...
-
-#pragma once
-
-void LoadDefaultTemplates();
|