summaryrefslogtreecommitdiff
path: root/plugins/Popup
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-03 14:50:10 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-03 14:50:19 +0300
commit58a9d3dbd775650dd1a8ac51ec78748184b4a657 (patch)
tree8ad2d33e013e1b5970c6442d32dfbab51ba3f35b /plugins/Popup
parent41fb0d2d6a4417d3ad2d26df15b6d6ab68af0c68 (diff)
MTextControl's support removed from Popup+
Diffstat (limited to 'plugins/Popup')
-rw-r--r--plugins/Popup/src/config.cpp1
-rw-r--r--plugins/Popup/src/config.h7
-rw-r--r--plugins/Popup/src/history.cpp1
-rw-r--r--plugins/Popup/src/main.cpp11
-rw-r--r--plugins/Popup/src/opt_skins.cpp14
-rw-r--r--plugins/Popup/src/popup_wnd2.cpp35
-rw-r--r--plugins/Popup/src/popup_wnd2.h12
-rw-r--r--plugins/Popup/src/skin.cpp96
-rw-r--r--plugins/Popup/src/stdafx.h4
-rw-r--r--plugins/Popup/src/version.h2
10 files changed, 44 insertions, 139 deletions
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp
index e137b9d722..51223de387 100644
--- a/plugins/Popup/src/config.cpp
+++ b/plugins/Popup/src/config.cpp
@@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ===== General Plugin =====
HANDLE hSemaphore;
BOOL closing = FALSE;
-MTEXT_INTERFACE MText = { 0 };
HANDLE folderId;
BOOL gbPopupLoaded = FALSE;
BOOL gbHppInstalled = FALSE;
diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h
index ec7f7bafca..31c196daf0 100644
--- a/plugins/Popup/src/config.h
+++ b/plugins/Popup/src/config.h
@@ -51,6 +51,7 @@ typedef struct tagPOPUPOPTIONS {
BYTE DisableWhenFullscreen;
//others
BYTE debug;
+
//==Page Skins====
LPTSTR SkinPack;
BYTE DisplayTime;
@@ -58,7 +59,7 @@ typedef struct tagPOPUPOPTIONS {
BYTE EnableFreeformShadows;
BYTE EnableAeroGlass;
BYTE UseWinColors;
- BYTE UseMText;
+
//==Page Actions====
DWORD actions;
//Mouse Override
@@ -129,10 +130,6 @@ extern HANDLE hSemaphore;
extern BOOL closing;
extern HANDLE folderId;
-extern MTEXT_INTERFACE MText;
-extern HANDLE htuText;
-extern HANDLE htuTitle;
-
extern BOOL gbPopupLoaded;
extern BOOL gbHppInstalled;
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp
index d079bc1ac4..23c3706984 100644
--- a/plugins/Popup/src/history.cpp
+++ b/plugins/Popup/src/history.cpp
@@ -234,7 +234,6 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara
POPUPDATA2 *ppd = arPopupHistory[lpdis->itemID];
wndPreview = new PopupWnd2(ppd, &customOptions, true);
- wndPreview->buildMText();
wndPreview->update();
ListBox_SetItemData(hwndLog, lpdis->itemID, wndPreview);
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 717f160596..0e21debb84 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -48,9 +48,6 @@ HMODULE hDwmapiDll = nullptr;
GLOBAL_WND_CLASSES g_wndClass = { 0 };
-HANDLE htuText;
-HANDLE htuTitle;
-
HGENMENU hMenuRoot;
HGENMENU hMenuItem;
HGENMENU hMenuItemHistory;
@@ -221,14 +218,6 @@ static int ModulesLoaded(WPARAM, LPARAM)
gbHppInstalled = ServiceExists(MS_HPP_GETVERSION) && ServiceExists(MS_HPP_EG_WINDOW) &&
(CallService(MS_HPP_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(1, 5, 0, 112));
- // check if MText plugin is installed
- mir_getMTI(&MText);
- if (MText.Register) {
- htuText = MText.Register("Popup Plus/Text", MTEXT_FANCY_DEFAULT);
- htuTitle = MText.Register("Popup Plus/Title", MTEXT_FANCY_DEFAULT);
- }
- else htuTitle = htuText = nullptr;
-
// check if OptionLoaded
if (!OptionLoaded)
LoadOptions();
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp
index 43267d16b4..953d0e5dca 100644
--- a/plugins/Popup/src/opt_skins.cpp
+++ b/plugins/Popup/src/opt_skins.cpp
@@ -72,7 +72,6 @@ static void updatePreviewImage(HWND hwndBox)
if (wndPreview) delete wndPreview;
wndPreview = new PopupWnd2(&ppd, &customOptions, true);
- wndPreview->buildMText();
wndPreview->update();
gPreviewOk = true;
@@ -192,8 +191,7 @@ static LPTSTR mainOption[] = {
LPGENW("Drop shadow effect"),
LPGENW("Drop shadow effect") L"/" LPGENW("non rectangular"),
LPGENW("Enable Aero Glass (Vista+)"),
- LPGENW("Use Windows colors"),
- LPGENW("Use advanced text render") };
+ LPGENW("Use Windows colors") };
int SkinOptionList_AddMain(OPTTREE_OPTION* &options, int *OptionsCount, int pos, DWORD *dwGlobalOptions)
{
@@ -221,11 +219,6 @@ int SkinOptionList_AddMain(OPTTREE_OPTION* &options, int *OptionsCount, int pos,
*dwGlobalOptions |= PopupOptions.UseWinColors ? (1 << i) : 0;
bCheck = PopupOptions.UseWinColors;
break;
- case 5:
- if (!(htuText&&htuTitle)) continue;
- *dwGlobalOptions |= PopupOptions.UseMText ? (1 << i) : 0;
- bCheck = PopupOptions.UseMText;
- break;
}
*OptionsCount += 1;
options = (OPTTREE_OPTION*)mir_realloc(options, sizeof(OPTTREE_OPTION)*(*OptionsCount));
@@ -287,7 +280,6 @@ void LoadOption_Skins() {
PopupOptions.EnableFreeformShadows = g_plugin.getByte("EnableShadowRegion", 1);
PopupOptions.EnableAeroGlass = g_plugin.getByte("EnableAeroGlass", 1);
PopupOptions.UseWinColors = g_plugin.getByte("UseWinColors", FALSE);
- PopupOptions.UseMText = g_plugin.getByte("UseMText", TRUE);
}
INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -324,9 +316,6 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case (1 << 4) :
PopupOptions.UseWinColors = skinOptions[index].bState;
break;
- case (1 << 5) :
- PopupOptions.UseMText = skinOptions[index].bState;
- break;
}
}
updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX));
@@ -476,7 +465,6 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
g_plugin.setByte("EnableShadowRegion", PopupOptions.EnableFreeformShadows);
g_plugin.setByte("EnableAeroGlass", PopupOptions.EnableAeroGlass);
g_plugin.setByte("UseWinColors", PopupOptions.UseWinColors);
- g_plugin.setByte("UseMText", PopupOptions.UseMText);
}// end PSN_APPLY:
return TRUE;
}// switch (((LPNMHDR)lParam)->code)
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp
index 6659813d6d..bcf82433a2 100644
--- a/plugins/Popup/src/popup_wnd2.cpp
+++ b/plugins/Popup/src/popup_wnd2.cpp
@@ -132,9 +132,6 @@ PopupWnd2::~PopupWnd2()
delete m_bmpAnimate;
delete m_avatar;
delete[]m_actions;
-
- if (m_mtText) MText.Destroy(m_mtText);
- if (m_mtTitle) MText.Destroy(m_mtTitle);
}
void PopupWnd2::startThread()
@@ -683,8 +680,6 @@ void PopupWnd2::updateData(POPUPDATAW *ppd)
fixDefaults();
fixActions(ppd->lpActions, ppd->actionCount);
-
- if (m_textType == TT_MTEXT) buildMText();
}
void PopupWnd2::updateData(POPUPDATA2 *ppd)
@@ -726,43 +721,20 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd)
fixDefaults();
fixActions(ppd->lpActions, ppd->actionCount);
-
- if (m_textType == TT_MTEXT) buildMText();
-}
-
-void PopupWnd2::buildMText()
-{
- if (!(htuText && htuTitle && PopupOptions.UseMText))
- return;
-
- if (m_mtText) MText.Destroy(m_mtText);
- if (m_mtTitle)MText.Destroy(m_mtTitle);
- m_mtText = m_mtTitle = nullptr;
-
- if (m_lptzText && m_lptzTitle) {
- m_textType = TT_MTEXT;
- m_mtText = MText.Create(htuText, m_lptzText);
- m_mtTitle = MText.Create(htuTitle, m_lptzTitle);
- }
}
void PopupWnd2::updateText(wchar_t *text)
{
- if (m_lptzText) {
+ if (m_lptzText)
replaceStrW(m_lptzText, text);
- if (m_textType == TT_MTEXT)
- buildMText();
- }
+
m_bTextEmpty = ::isTextEmpty(m_lptzText);
}
void PopupWnd2::updateTitle(wchar_t *title)
{
- if (m_lptzTitle) {
+ if (m_lptzTitle)
replaceStrW(m_lptzTitle, title);
- if (m_textType == TT_MTEXT)
- buildMText();
- }
}
void PopupWnd2::updateTimer()
@@ -1237,7 +1209,6 @@ void WindowThread(void *arg)
CoInitialize(nullptr); // we may need OLE in this thread for smiley substitution
PopupWnd2 *wnd = (PopupWnd2 *)arg;
- wnd->buildMText();
wnd->create();
PostMessage(wnd->getHwnd(), UM_INITPOPUP, 0, 0);
diff --git a/plugins/Popup/src/popup_wnd2.h b/plugins/Popup/src/popup_wnd2.h
index 45b940fbb6..407ebd622d 100644
--- a/plugins/Popup/src/popup_wnd2.h
+++ b/plugins/Popup/src/popup_wnd2.h
@@ -34,7 +34,7 @@ class PopupWnd2 : public MZeroedObject
{
public:
typedef LRESULT(PopupWnd2::*MethodPtr)(LPARAM lParam);
- enum TextType { TT_NONE, TT_UNICODE, TT_MTEXT };
+ enum TextType { TT_NONE, TT_UNICODE };
struct ActionInfo
{
@@ -55,7 +55,6 @@ private:
// content
TextType m_textType;
wchar_t *m_lptzTitle, *m_lptzText;
- HANDLE m_mtTitle, m_mtText;
bool m_bTextEmpty, m_bIcoLib;
HFONT m_hfnTitle, m_hfnText;
HICON m_hIcon;
@@ -130,7 +129,6 @@ public:
void updateData(POPUPDATAW *ppd);
void updateData(POPUPDATA2 *ppd);
- void buildMText();
void updateText(wchar_t *text);
void updateTitle(wchar_t *title);
@@ -146,15 +144,13 @@ public:
bool isTextEmpty() { return m_bTextEmpty; }
bool isIcolib() { return m_bIcoLib; }
TextType getTextType() { return m_textType; }
- wchar_t *getText() { return m_lptzText; }
- HANDLE getTextM() { return m_mtText; }
- wchar_t *getTitle() { return m_lptzTitle; }
- HANDLE getTitleM() { return m_mtTitle; }
+ wchar_t *getText() { return m_lptzText; }
+ wchar_t *getTitle() { return m_lptzTitle; }
int getActionCount() { return m_actionCount; }
ActionInfo *getActions() { return m_actions; }
- wchar_t *getTime() { return m_time; }
+ wchar_t *getTime() { return m_time; }
HICON getIcon() { return m_hIcon; }
MCONTACT getContact() { return m_hContact; }
MCONTACT getContactPassed() { return m_hContactPassed; }
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp
index 001fdc96d1..3510733dfb 100644
--- a/plugins/Popup/src/skin.cpp
+++ b/plugins/Popup/src/skin.cpp
@@ -235,19 +235,13 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
szNew.cx = szNew.cy = 0;
else {
HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.text);
- switch (wnd->getTextType()) {
- case PopupWnd2::TT_UNICODE:
- {
- RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc,
- DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
- szNew.cx = rc.right;
- szNew.cy = rc.bottom;
- }
- break;
- case PopupWnd2::TT_MTEXT:
- MText.Measure(hdc, &szNew, wnd->getTextM());
- break;
+ if (wnd->getTextType() == PopupWnd2::TT_UNICODE) {
+ RECT rc;
+ SetRect(&rc, 0, 0, szNew.cx, 0);
+ DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc,
+ DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
+ szNew.cx = rc.right;
+ szNew.cy = rc.bottom;
}
SelectObject(hdc, hFntSave);
}
@@ -278,19 +272,12 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options
wnd->getRenderInfo()->titlew = tmp ? tmp : (maxw - head->fx.eval(wnd->getArgs()) - STYLE_SZ_CLOCK);
szNew.cx = wnd->getRenderInfo()->titlew;
HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
- switch (wnd->getTextType()) {
- case PopupWnd2::TT_UNICODE:
- {
- RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc,
- DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
- szNew.cx = rc.right;
- szNew.cy = rc.bottom;
- }
- break;
- case PopupWnd2::TT_MTEXT:
- MText.Measure(hdc, &szNew, wnd->getTitleM());
- break;
+ if (wnd->getTextType() == PopupWnd2::TT_UNICODE) {
+ RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
+ DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc,
+ DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
+ szNew.cx = rc.right;
+ szNew.cy = rc.bottom;
}
SelectObject(hdc, hFntSave);
@@ -500,26 +487,19 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW
pt.x + wnd->getRenderInfo()->realtextw,
pt.y + wnd->getRenderInfo()->texth);
- if ((drawFlags&DF_STATIC) && !wnd->isTextEmpty()) {
+ if ((drawFlags & DF_STATIC) && !wnd->isTextEmpty()) {
HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.text);
bmp->saveAlpha();
- switch (wnd->getTextType()) {
- case PopupWnd2::TT_UNICODE:
- {
- RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy);
- DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc,
- DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
- }
- break;
- case PopupWnd2::TT_MTEXT:
- MText.Display(hdc, pt, sz, wnd->getTextM());
- break;
+ if (wnd->getTextType() == PopupWnd2::TT_UNICODE) {
+ RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy);
+ DrawTextEx(hdc, wnd->getText(), (int)mir_wstrlen(wnd->getText()), &rc,
+ DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
}
SelectObject(hdc, hFntSave);
bmp->restoreAlpha();
}
- if (!actionsRendered && (drawFlags&DF_ANIMATE)) {
+ if (!actionsRendered && (drawFlags & DF_ANIMATE)) {
int textAreaWidth = head->fw.eval(wnd->getArgs());
if (textAreaWidth <= 0) textAreaWidth = wnd->getRenderInfo()->realtextw;
@@ -542,33 +522,23 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW
SetTextColor(hdc, head->textColor);
else
SetTextColor(hdc, wnd->getTitleColor());
- {
- bmp->saveAlpha();
- POINT pt;
- pt.x = head->fx.eval(wnd->getArgs());
- pt.y = head->fy.eval(wnd->getArgs());
- sz.cx = wnd->getRenderInfo()->titlew;
- sz.cy = 1000;
- switch (wnd->getTextType()) {
- case PopupWnd2::TT_UNICODE:
- {
- HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
- RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy);
- DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc,
- DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
- SelectObject(hdc, hFntSave);
- }
- break;
- case PopupWnd2::TT_MTEXT:
- HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
- MText.Display(hdc, pt, sz, wnd->getTitleM());
- SelectObject(hdc, hFntSave);
- break;
- }
+ bmp->saveAlpha();
+ POINT pt;
+ pt.x = head->fx.eval(wnd->getArgs());
+ pt.y = head->fy.eval(wnd->getArgs());
+ sz.cx = wnd->getRenderInfo()->titlew;
+ sz.cy = 1000;
- bmp->restoreAlpha();
+ if (wnd->getTextType() == PopupWnd2::TT_UNICODE) {
+ HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
+ RECT rc; SetRect(&rc, pt.x, pt.y, pt.x + sz.cx, pt.y + sz.cy);
+ DrawTextEx(hdc, wnd->getTitle(), (int)mir_wstrlen(wnd->getTitle()), &rc,
+ DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, nullptr);
+ SelectObject(hdc, hFntSave);
}
+
+ bmp->restoreAlpha();
break;
case ST_ICON:
diff --git a/plugins/Popup/src/stdafx.h b/plugins/Popup/src/stdafx.h
index f463dd9f86..ca1f23ef9c 100644
--- a/plugins/Popup/src/stdafx.h
+++ b/plugins/Popup/src/stdafx.h
@@ -88,10 +88,6 @@ https://miranda-ng.org/distr/
#include <m_folders.h>
#include <m_ieview.h>
#include <m_smileyadd.h>
-#ifndef MTEXT_NOHELPERS
-#define MTEXT_NOHELPERS
-#endif // MTEXT_NOHELPERS
-#include <m_text.h>
#include <m_toptoolbar.h>
#include <m_hpp.h>
diff --git a/plugins/Popup/src/version.h b/plugins/Popup/src/version.h
index 7cf951d606..1ccf97b413 100644
--- a/plugins/Popup/src/version.h
+++ b/plugins/Popup/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 1
-#define __BUILD_NUM 15
+#define __BUILD_NUM 16
#include <stdver.h>