summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Scriver/res/resource.rc2
-rw-r--r--plugins/Scriver/src/chat_window.cpp2
-rw-r--r--plugins/Scriver/src/globals.cpp135
-rw-r--r--plugins/Scriver/src/globals.h112
-rw-r--r--plugins/Scriver/src/infobar.cpp4
-rw-r--r--plugins/Scriver/src/msgdialog.cpp38
-rw-r--r--plugins/Scriver/src/msglog.cpp46
-rw-r--r--plugins/Scriver/src/msgoptions.cpp119
-rw-r--r--plugins/Scriver/src/msgs.cpp12
-rw-r--r--plugins/Scriver/src/msgs.h27
-rw-r--r--plugins/Scriver/src/resource.h2
-rw-r--r--plugins/Scriver/src/srmm.cpp16
-rw-r--r--plugins/Scriver/src/stdafx.h4
-rw-r--r--plugins/Scriver/src/tabs.cpp333
-rw-r--r--plugins/Scriver/src/tabs.h2
-rw-r--r--plugins/Scriver/src/version.h4
16 files changed, 376 insertions, 482 deletions
diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc
index 1796a4459a..82bb4a1e78 100644
--- a/plugins/Scriver/res/resource.rc
+++ b/plugins/Scriver/res/resource.rc
@@ -58,7 +58,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Tabs",IDC_STATIC,0,0,304,118
CONTROL "Enable tabs",IDC_USETABS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,12,260,10
- CONTROL "Always show tab bar",IDC_ALWAYSSHOWTABS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,23,252,10
+ CONTROL "Only show tab bar when it's needed",IDC_HIDEONETAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,23,252,10
CONTROL "Tabs at the bottom",IDC_TABSATBOTTOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,34,252,10
CONTROL "Limit names on tabs to",IDC_LIMITNAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,45,126,10
EDITTEXT IDC_LIMITNAMESLEN,212,44,30,12,ES_RIGHT | ES_NUMBER
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp
index 9ceec71ae4..ba58e4e376 100644
--- a/plugins/Scriver/src/chat_window.cpp
+++ b/plugins/Scriver/src/chat_window.cpp
@@ -1069,7 +1069,7 @@ void ShowRoom(SESSION_INFO *si)
// Do we need to create a window?
CChatRoomDlg *pDlg;
if (si->pDlg == nullptr) {
- HWND hParent = GetParentWindow(si->hContact, TRUE);
+ HWND hParent = GetParentWindow(si->hContact, true);
pDlg = new CChatRoomDlg(si);
pDlg->SetParent(hParent);
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index a44e955100..cff6f593d4 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -342,103 +342,66 @@ void FreeGlobals()
void ReloadGlobals()
{
- g_dat.flags = 0;
- g_dat.flags2 = 0;
- if (g_plugin.getByte(SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE))
- g_dat.flags |= SMF_AVATAR;
- if (g_plugin.getByte(SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS))
- g_dat.flags |= SMF_SHOWPROGRESS;
- if (g_plugin.getByte(SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS))
- g_dat.flags |= SMF_SHOWICONS;
- if (g_plugin.getByte(SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME))
- g_dat.flags |= SMF_SHOWTIME;
- if (g_plugin.getByte(SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS))
- g_dat.flags |= SMF_SHOWSECONDS;
- if (g_plugin.getByte(SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE))
- g_dat.flags |= SMF_SHOWDATE;
- if (g_plugin.getByte(SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE))
- g_dat.flags |= SMF_LONGDATE;
- if (g_plugin.getByte(SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE))
- g_dat.flags |= SMF_RELATIVEDATE;
- if (g_plugin.getByte(SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES))
- g_dat.flags |= SMF_GROUPMESSAGES;
- if (g_plugin.getByte(SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS))
- g_dat.flags |= SMF_MARKFOLLOWUPS;
- if (g_plugin.getByte(SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE))
- g_dat.flags |= SMF_MSGONNEWLINE;
- if (g_plugin.getByte(SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES))
- g_dat.flags |= SMF_DRAWLINES;
- if (g_plugin.getByte(SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES))
- g_dat.flags |= SMF_HIDENAMES;
- if (g_plugin.bAutoPopup)
- g_dat.flags |= SMF_AUTOPOPUP;
- if (g_plugin.bStayMinimized)
- g_dat.flags |= SMF_STAYMINIMIZED;
- if (g_plugin.bSaveDrafts)
- g_dat.flags |= SMF_SAVEDRAFTS;
-
- if (g_plugin.bDelTemp)
- g_dat.flags |= SMF_DELTEMP;
- if (g_plugin.getByte(SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT))
- g_dat.flags |= SMF_INDENTTEXT;
+ g_dat.dwFlags = 0;
+ g_dat.dwFlags2 = 0;
+
+ g_dat.flags.bShowAvatar = g_plugin.getBool(SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE);
+ g_dat.flags.bShowProgress = g_plugin.getBool(SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS);
+ g_dat.flags.bShowIcons = g_plugin.getBool(SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS);
+ g_dat.flags.bShowTime = g_plugin.getBool(SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME);
+ g_dat.flags.bShowSeconds = g_plugin.getBool(SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS);
+ g_dat.flags.bShowDate = g_plugin.getBool(SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE);
+ g_dat.flags.bLongDate = g_plugin.getBool(SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE);
+ g_dat.flags.bRelativeDate = g_plugin.getBool(SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE);
+ g_dat.flags.bGroupMessages = g_plugin.getBool(SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES);
+ g_dat.flags.bMarkFollowups = g_plugin.getBool(SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS);
+ g_dat.flags.bMsgOnNewline = g_plugin.getBool(SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE);
+ g_dat.flags.bDrawLines = g_plugin.getBool(SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES);
+ g_dat.flags.bHideNames = g_plugin.getBool(SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES);
+ g_dat.flags.bIndentText = g_plugin.getByte(SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT);
+
+ g_dat.flags.bAutoPopup = g_plugin.bAutoPopup;
+ g_dat.flags.bStayMinimized = g_plugin.bStayMinimized;
+ g_dat.flags.bSaveDrafts = g_plugin.bSaveDrafts;
+ g_dat.flags.bDelTemp = g_plugin.bDelTemp;
g_dat.sendMode = (SendMode)g_plugin.getByte(SRMSGSET_SENDMODE, SRMSGDEFSET_SENDMODE);
g_dat.openFlags = g_plugin.getDword(SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
g_dat.indentSize = g_plugin.getWord(SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE);
g_dat.logLineColour = g_plugin.getDword(SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR);
- if (g_plugin.getByte(SRMSGSET_USETABS, SRMSGDEFSET_USETABS))
- g_dat.flags2 |= SMF2_USETABS;
- if (g_plugin.getByte(SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM))
- g_dat.flags2 |= SMF2_TABSATBOTTOM;
- if (g_plugin.getByte(SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE))
- g_dat.flags2 |= SMF2_SWITCHTOACTIVE;
- if (g_plugin.getByte(SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES))
- g_dat.flags2 |= SMF2_LIMITNAMES;
- if (g_plugin.getByte(SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB))
- g_dat.flags2 |= SMF2_HIDEONETAB;
- if (g_plugin.getByte(SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS))
- g_dat.flags2 |= SMF2_SEPARATECHATSCONTAINERS;
- if (g_plugin.getByte(SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON))
- g_dat.flags2 |= SMF2_TABCLOSEBUTTON;
- if (g_plugin.getByte(SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS))
- g_dat.flags2 |= SMF2_LIMITTABS;
- if (g_plugin.getByte(SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS))
- g_dat.flags2 |= SMF2_LIMITCHATSTABS;
- if (g_plugin.bHideContainer)
- g_dat.flags2 |= SMF2_HIDECONTAINERS;
-
- if (g_plugin.getByte(SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR))
- g_dat.flags2 |= SMF2_SHOWSTATUSBAR;
- if (g_plugin.getByte(SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR))
- g_dat.flags2 |= SMF2_SHOWTITLEBAR;
- if (g_plugin.getByte(SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE))
- g_dat.flags2 |= SMF2_SHOWTOOLBAR;
- if (g_plugin.getByte(SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR))
- g_dat.flags2 |= SMF2_SHOWINFOBAR;
-
- if (g_plugin.getByte(SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
- g_dat.flags2 |= SMF2_SHOWTYPING;
- if (g_plugin.getByte(SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN))
- g_dat.flags2 |= SMF2_SHOWTYPINGWIN;
- if (g_plugin.getByte(SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN))
- g_dat.flags2 |= SMF2_SHOWTYPINGTRAY;
- if (g_plugin.getByte(SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST))
- g_dat.flags2 |= SMF2_SHOWTYPINGCLIST;
- if (g_plugin.getByte(SRMSGSET_SHOWTYPINGSWITCH, SRMSGDEFSET_SHOWTYPINGSWITCH))
- g_dat.flags2 |= SMF2_SHOWTYPINGSWITCH;
- if (g_plugin.getByte(SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY))
- g_dat.flags2 |= SMF2_USETRANSPARENCY;
+ g_dat.flags2.bUseTabs = g_plugin.bUseTabs;
+ g_dat.flags2.bTabsAtBottom = g_plugin.bTabsAtBottom;
+ g_dat.flags2.bSwitchToActive = g_plugin.bSwitchToActive;
+ g_dat.flags2.bLimitNames = g_plugin.bLimitNames;
+ g_dat.flags2.bHideOneTab = g_plugin.bHideOneTab;
+ g_dat.flags2.bSeparateChats = g_plugin.bSeparateChats;
+ g_dat.flags2.bTabCloseButton = g_plugin.bTabCloseButton;
+ g_dat.flags2.bLimitTabs = g_plugin.bLimitTabs;
+ g_dat.flags2.bLimitChatTabs = g_plugin.bLimitChatTabs;
+ g_dat.flags2.bHideContainer = g_plugin.bHideContainer;
+
+ g_dat.flags2.bShowStatusBar = g_plugin.getBool(SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR);
+ g_dat.flags2.bShowTitleBar = g_plugin.getBool(SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR);
+ g_dat.flags2.bShowToolBar = g_plugin.getBool(SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE);
+ g_dat.flags2.bShowInfoBar = g_plugin.getBool(SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR);
+
+ g_dat.flags2.bShowTyping = g_plugin.getBool(SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING);
+ g_dat.flags2.bShowTypingWin = g_plugin.getBool(SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN);
+ g_dat.flags2.bShowTypingTray = g_plugin.getBool(SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN);
+ g_dat.flags2.bShowTypingClist = g_plugin.getBool(SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST);
+ g_dat.flags2.bShowTypingSwitch = g_plugin.getBool(SRMSGSET_SHOWTYPINGSWITCH, SRMSGDEFSET_SHOWTYPINGSWITCH);
+ g_dat.flags2.bUseTransparency = g_plugin.getBool(SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY);
g_dat.activeAlpha = g_plugin.getDword(SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA);
g_dat.inactiveAlpha = g_plugin.getDword(SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA);
- if (g_plugin.getByte(SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW))
- g_dat.flags |= SMF_USEIEVIEW;
+ if (g_plugin.getBool(SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW))
+ g_dat.flags.bUseIeview;
- g_dat.limitNamesLength = g_plugin.getDword(SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
- g_dat.limitTabsNum = g_plugin.getDword(SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
- g_dat.limitChatsTabsNum = g_plugin.getDword(SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
+ g_dat.limitNamesLength = g_plugin.iLimitNames;
+ g_dat.limitTabsNum = g_plugin.iLimitTabs;
+ g_dat.limitChatsTabsNum = g_plugin.iLimitChatTabs;
ptrW wszTitleFormat(g_plugin.getWStringA(SRMSGSET_WINDOWTITLE));
if (wszTitleFormat == nullptr)
diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h
index da1b381213..b6adba5887 100644
--- a/plugins/Scriver/src/globals.h
+++ b/plugins/Scriver/src/globals.h
@@ -23,51 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef SRMM_GLOBALS_H
#define SRMM_GLOBALS_H
-#define SMF_AUTOPOPUP 0x00000001
-#define SMF_STAYMINIMIZED 0x00000002
-#define SMF_CLOSEONSEND 0x00000004
-#define SMF_MINIMIZEONSEND 0x00000008
-#define SMF_SAVEDRAFTS 0x00000040
-#define SMF_DELTEMP 0x00000080
-#define SMF_SHOWPROGRESS 0x00000400
-#define SMF_AVATAR 0x00000800
-#define SMF_RTL 0x00004000
-#define SMF_USEIEVIEW 0x00010000
-#define SMF_SHOWICONS 0x00020000
-#define SMF_HIDENAMES 0x00040000
-#define SMF_SHOWTIME 0x00080000
-#define SMF_SHOWDATE 0x00100000
-#define SMF_LONGDATE 0x00200000
-#define SMF_RELATIVEDATE 0x00400000
-#define SMF_SHOWSECONDS 0x00800000
-#define SMF_GROUPMESSAGES 0x01000000
-#define SMF_MARKFOLLOWUPS 0x02000000
-#define SMF_MSGONNEWLINE 0x04000000
-#define SMF_DRAWLINES 0x08000000
-#define SMF_INDENTTEXT 0x10000000
-#define SMF_ORIGINALAVATARH 0x20000000
-
-#define SMF2_USETABS 0x00000001
-#define SMF2_HIDEONETAB 0x00000002
-#define SMF2_TABSATBOTTOM 0x00000004
-#define SMF2_LIMITNAMES 0x00000008
-#define SMF2_SWITCHTOACTIVE 0x00000010
-#define SMF2_SEPARATECHATSCONTAINERS 0x00000020
-#define SMF2_TABCLOSEBUTTON 0x00000040
-#define SMF2_LIMITTABS 0x00000080
-#define SMF2_LIMITCHATSTABS 0x00000100
-#define SMF2_HIDECONTAINERS 0x00000200
-#define SMF2_SHOWINFOBAR 0x00000400
-#define SMF2_SHOWSTATUSBAR 0x00010000
-#define SMF2_SHOWTITLEBAR 0x00020000
-#define SMF2_SHOWTOOLBAR 0x00040000
-#define SMF2_USETRANSPARENCY 0x00080000
-#define SMF2_SHOWTYPING 0x01000000
-#define SMF2_SHOWTYPINGWIN 0x02000000
-#define SMF2_SHOWTYPINGTRAY 0x04000000
-#define SMF2_SHOWTYPINGCLIST 0x08000000
-#define SMF2_SHOWTYPINGSWITCH 0x10000000
-
typedef struct ImageListUsageEntry_tag
{
int index;
@@ -82,10 +37,69 @@ enum SendMode
SEND_ON_SHIFT_ENTER
};
+struct WindowFlags
+{
+ bool bAutoPopup : 1;
+ bool bStayMinimized : 1;
+ bool bCloseOnSend : 1;
+ bool bMinimizeOnSend : 1;
+ bool bSaveDrafts : 1;
+ bool bDelTemp : 1;
+ bool bShowProgress : 1;
+ bool bShowAvatar : 1;
+ bool bRtl : 1;
+ bool bUseIeview : 1;
+ bool bShowIcons : 1;
+ bool bHideNames : 1;
+ bool bShowTime : 1;
+ bool bShowDate : 1;
+ bool bLongDate : 1;
+ bool bRelativeDate : 1;
+ bool bShowSeconds : 1;
+ bool bGroupMessages : 1;
+ bool bMarkFollowups : 1;
+ bool bMsgOnNewline : 1;
+ bool bDrawLines : 1;
+ bool bIndentText : 1;
+ bool bOriginalAvatarH : 1;
+};
+
+struct TabFlags
+{
+ bool bUseTabs : 1;
+ bool bHideOneTab : 1;
+ bool bTabsAtBottom : 1;
+ bool bLimitNames : 1;
+ bool bSwitchToActive : 1;
+ bool bSeparateChats : 1;
+ bool bTabCloseButton : 1;
+ bool bLimitTabs : 1;
+ bool bLimitChatTabs : 1;
+ bool bHideContainer : 1;
+ bool bShowInfoBar : 1;
+ bool bShowStatusBar : 1;
+ bool bShowTitleBar : 1;
+ bool bShowToolBar : 1;
+ bool bUseTransparency : 1;
+ bool bShowTyping : 1;
+ bool bShowTypingWin : 1;
+ bool bShowTypingTray : 1;
+ bool bShowTypingClist : 1;
+ bool bShowTypingSwitch : 1;
+};
+
struct GlobalMessageData
{
- unsigned flags;
- unsigned flags2;
+ union {
+ DWORD dwFlags;
+ WindowFlags flags;
+ };
+
+ union {
+ DWORD dwFlags2;
+ TabFlags flags2;
+ };
+
DWORD openFlags;
DWORD limitNamesLength;
int activeAlpha;
@@ -115,8 +129,8 @@ struct GlobalMessageData
wchar_t wszTitleFormat[200];
MWindowList hParentWindowList;
- ParentWindowData *lastParent;
- ParentWindowData *lastChatParent;
+ struct ParentWindowData *lastParent;
+ struct ParentWindowData *lastChatParent;
ImageListUsageEntry *tabIconListUsage;
};
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp
index 6cd62573ff..52ebca192d 100644
--- a/plugins/Scriver/src/infobar.cpp
+++ b/plugins/Scriver/src/infobar.cpp
@@ -136,7 +136,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
GetClientRect(hwnd, &rc);
dlgWidth = rc.right - rc.left;
dlgHeight = rc.bottom - rc.top;
- if (idat->m_hbmpAvatarPic && (g_dat.flags & SMF_AVATAR)) {
+ if (idat->m_hbmpAvatarPic && g_dat.flags.bShowAvatar) {
BITMAP bminfo;
GetObject(idat->m_hbmpAvatarPic, sizeof(bminfo), &bminfo);
if (bminfo.bmWidth != 0 && bminfo.bmHeight != 0) {
@@ -218,7 +218,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
rect.right = itemWidth - 1;
rect.bottom = itemHeight - 1;
FillRect(hdcMem, &rect, g_dat.hInfobarBrush);
- if (idat->m_hbmpAvatarPic && (g_dat.flags & SMF_AVATAR)) {
+ if (idat->m_hbmpAvatarPic && g_dat.flags.bShowAvatar) {
BITMAP bminfo;
GetObject(idat->m_hbmpAvatarPic, sizeof(bminfo), &bminfo);
if (bminfo.bmWidth != 0 && bminfo.bmHeight != 0) {
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 6b23e03e8c..d93d1498c1 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -162,7 +162,7 @@ CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool bIncoming)
{
m_hContact = hContact;
- m_hwndParent = GetParentWindow(hContact, FALSE);
+ m_hwndParent = GetParentWindow(hContact, false);
m_btnOk.OnClick = Callback(this, &CSrmmWindow::onClick_Ok);
m_btnAdd.OnClick = Callback(this, &CSrmmWindow::onClick_Add);
@@ -197,7 +197,7 @@ bool CSrmmWindow::OnInitDialog()
m_startTime = time(0);
m_bUseRtl = g_plugin.getByte(m_hContact, "UseRTL", 0) != 0;
- m_bUseIEView = g_dat.ieviewInstalled ? (g_dat.flags & SMF_USEIEVIEW) != 0 : false;
+ m_bUseIEView = g_dat.ieviewInstalled ? g_dat.flags.bUseIeview : false;
PARAFORMAT2 pf2;
memset(&pf2, 0, sizeof(pf2));
@@ -243,7 +243,7 @@ bool CSrmmWindow::OnInitDialog()
m_message.SetText(m_wszInitialText);
mir_free(m_wszInitialText);
}
- else if (g_dat.flags & SMF_SAVEDRAFTS) {
+ else if (g_dat.flags.bSaveDrafts) {
int len = 0;
ptrW ptszSavedMsg(db_get_wsa(m_hContact, "SRMM", "SavedMsg"));
if (ptszSavedMsg)
@@ -393,7 +393,7 @@ void CSrmmWindow::OnDestroy()
}
ReleaseSendQueueItems(m_hwnd);
- if (g_dat.flags & SMF_SAVEDRAFTS) {
+ if (g_dat.flags.bSaveDrafts) {
ptrA szText(m_message.GetRichTextRtf(true));
if (szText)
db_set_utf(m_hContact, "SRMM", "SavedMsg", szText);
@@ -408,7 +408,7 @@ void CSrmmWindow::OnDestroy()
DeleteObject(hFont);
g_plugin.setByte(m_hContact, "UseRTL", m_bUseRtl);
- if (m_hContact && (g_dat.flags & SMF_DELTEMP)) {
+ if (m_hContact && g_dat.flags.bDelTemp) {
m_hContact = INVALID_CONTACT_ID; // to prevent recursion
if (db_get_b(m_hContact, "CList", "NotOnList", 0))
@@ -593,7 +593,7 @@ HICON CSrmmWindow::GetTabIcon()
void CSrmmWindow::GetTitlebarIcon(TitleBarData *tbd)
{
- if (m_bShowTyping && (g_dat.flags2 & SMF2_SHOWTYPINGWIN))
+ if (m_bShowTyping && g_dat.flags2.bShowTypingWin)
tbd->hIconNot = tbd->hIcon = g_plugin.getIcon(IDI_TYPING);
else if (m_iShowUnread && (GetActiveWindow() != m_hwndParent || GetForegroundWindow() != m_hwndParent)) {
tbd->hIcon = m_hStatusIcon;
@@ -692,7 +692,7 @@ void CSrmmWindow::SetDialogToType()
showToolbar = false;
ParentWindowData *pdat = m_pParent;
- if (pdat->flags2 & SMF2_SHOWINFOBAR)
+ if (pdat->flags2.bShowInfoBar)
ShowWindow(m_hwndInfo, SW_SHOW);
else
ShowWindow(m_hwndInfo, SW_HIDE);
@@ -745,7 +745,7 @@ void CSrmmWindow::UpdateStatusBar()
wchar_t szText[256];
StatusBarData sbd = { 0 };
sbd.iFlags = SBDF_TEXT | SBDF_ICON;
- if (m_iMessagesInProgress && (g_dat.flags & SMF_SHOWPROGRESS)) {
+ if (m_iMessagesInProgress && g_dat.flags.bShowProgress) {
sbd.hIcon = g_plugin.getIcon(IDI_TIMESTAMP);
sbd.pszText = szText;
mir_snwprintf(szText, TranslateT("Sending in progress: %d message(s) left..."), m_iMessagesInProgress);
@@ -770,7 +770,7 @@ void CSrmmWindow::UpdateStatusBar()
Srmm_SetIconFlags(m_hContact, SRMM_MODULE, 0, MBF_DISABLED);
- if (IsTypingNotificationSupported() && g_dat.flags2 & SMF2_SHOWTYPINGSWITCH) {
+ if (IsTypingNotificationSupported() && g_dat.flags2.bShowTypingSwitch) {
int mode = g_plugin.getByte(m_hContact, SRMSGSET_TYPING, g_plugin.getByte(SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
Srmm_SetIconFlags(m_hContact, SRMM_MODULE, 1, mode ? 0 : MBF_DISABLED);
}
@@ -837,7 +837,7 @@ void CSrmmWindow::UpdateTitle()
void CSrmmWindow::MessageDialogResize(int w, int h)
{
ParentWindowData *pdat = m_pParent;
- bool bToolbar = (pdat->flags2 & SMF2_SHOWTOOLBAR) != 0;
+ bool bToolbar = (pdat->flags2.bShowToolBar) != 0;
int hSplitterPos = pdat->iSplitterY, toolbarHeight = (bToolbar) ? TOOLBAR_HEIGHT : 0;
int hSplitterMinTop = toolbarHeight + m_minLogBoxHeight, hSplitterMinBottom = m_minEditBoxHeight;
int infobarInnerHeight = INFO_BAR_INNER_HEIGHT;
@@ -849,7 +849,7 @@ void CSrmmWindow::MessageDialogResize(int w, int h)
if (hSplitterMinBottom < g_dat.minInputAreaHeight)
hSplitterMinBottom = g_dat.minInputAreaHeight;
- if (!(pdat->flags2 & SMF2_SHOWINFOBAR)) {
+ if (!(pdat->flags2.bShowInfoBar)) {
infobarHeight = 0;
infobarInnerHeight = 0;
}
@@ -866,8 +866,8 @@ void CSrmmWindow::MessageDialogResize(int w, int h)
if (hSplitterPos < hSplitterMinBottom)
hSplitterPos = hSplitterMinBottom;
- if (!(pdat->flags2 & SMF2_SHOWINFOBAR)) {
- if (m_hbmpAvatarPic && (g_dat.flags & SMF_AVATAR)) {
+ if (!(pdat->flags2.bShowInfoBar)) {
+ if (m_hbmpAvatarPic && g_dat.flags.bShowAvatar) {
avatarWidth = BOTTOM_RIGHT_AVATAR_HEIGHT;
avatarHeight = toolbarHeight + hSplitterPos - 2;
if (avatarHeight < BOTTOM_RIGHT_AVATAR_HEIGHT) {
@@ -1178,7 +1178,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
break;
case DM_OPTIONSAPPLIED:
- m_bUseIEView = g_dat.ieviewInstalled ? (g_dat.flags & SMF_USEIEVIEW) != 0 : false;
+ m_bUseIEView = g_dat.ieviewInstalled ? g_dat.flags.bUseIeview : false;
if (m_bUseIEView && m_hwndIeview == nullptr) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_CREATE;
@@ -1231,7 +1231,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
memset(&pf2, 0, sizeof(pf2));
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_OFFSET;
- pf2.dxOffset = (g_dat.flags & SMF_INDENTTEXT) ? g_dat.indentSize * 1440 / g_dat.logPixelSX : 0;
+ pf2.dxOffset = (g_dat.flags.bIndentText) ? g_dat.indentSize * 1440 / g_dat.logPixelSX : 0;
ClearLog();
m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
@@ -1388,7 +1388,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
Skin_PlaySound("RecvMsgActive");
else
Skin_PlaySound("RecvMsgInactive");
- if ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(m_hwndParent) || GetActiveWindow() != m_hwndParent) && IsWindowVisible(m_hwndParent))
+ if (g_dat.flags2.bSwitchToActive && (IsIconic(m_hwndParent) || GetActiveWindow() != m_hwndParent) && IsWindowVisible(m_hwndParent))
SendMessage(m_hwndParent, CM_ACTIVATECHILD, 0, (LPARAM)m_hwnd);
if (IsAutoPopup(m_hContact))
SendMessage(m_hwndParent, CM_POPUPWINDOW, 1, (LPARAM)m_hwnd);
@@ -1480,14 +1480,14 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
m_iMessagesInProgress++;
case DM_SHOWMESSAGESENDING:
SetTimer(m_hwnd, TIMERID_MSGSEND, 1000, nullptr);
- if (g_dat.flags & SMF_SHOWPROGRESS)
+ if (g_dat.flags.bShowProgress)
UpdateStatusBar();
break;
case DM_STOPMESSAGESENDING:
if (m_iMessagesInProgress > 0) {
m_iMessagesInProgress--;
- if (g_dat.flags & SMF_SHOWPROGRESS)
+ if (g_dat.flags.bShowProgress)
UpdateStatusBar();
}
if (m_iMessagesInProgress == 0)
@@ -1540,7 +1540,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
rect.bottom = itemHeight - 1;
FillRect(hdcMem, &rect, GetSysColorBrush(COLOR_BTNFACE));
- if (m_hbmpAvatarPic && (g_dat.flags & SMF_AVATAR)) {
+ if (m_hbmpAvatarPic && g_dat.flags.bShowAvatar) {
BITMAP bminfo;
GetObject(m_hbmpAvatarPic, sizeof(bminfo), &bminfo);
if (bminfo.bmWidth != 0 && bminfo.bmHeight != 0) {
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 908a6269b1..f7bd6d435b 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -36,8 +36,6 @@ static HIMAGELIST g_hImageList;
#define STREAMSTAGE_TAIL 2
#define STREAMSTAGE_STOP 3
-#define SMF_AFTERMASK (SMF_SHOWTIME | SMF_GROUPMESSAGES | SMF_MARKFOLLOWUPS)
-
struct EventData
{
int cbSize;
@@ -321,7 +319,7 @@ static char* SetToStyle(int style)
}
// mode: 0 - date & time, 1 - date, 2 - time
-wchar_t* TimestampToString(DWORD dwFlags, time_t check, int mode)
+static wchar_t* TimestampToString(WindowFlags flags, time_t check, int mode)
{
static wchar_t szResult[512];
wchar_t str[80];
@@ -329,7 +327,7 @@ wchar_t* TimestampToString(DWORD dwFlags, time_t check, int mode)
szResult[0] = '\0';
format[0] = '\0';
- if ((mode == 0 || mode == 1) && (dwFlags & SMF_SHOWDATE)) {
+ if ((mode == 0 || mode == 1) && flags.bShowDate) {
struct tm tm_now, tm_today;
time_t now = time(0);
time_t today;
@@ -338,28 +336,28 @@ wchar_t* TimestampToString(DWORD dwFlags, time_t check, int mode)
tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0;
today = mktime(&tm_today);
- if (dwFlags & SMF_RELATIVEDATE && check >= today) {
+ if (flags.bRelativeDate && check >= today) {
mir_wstrcpy(szResult, TranslateT("Today"));
if (mode == 0)
mir_wstrcat(szResult, L",");
}
- else if (dwFlags & SMF_RELATIVEDATE && check > (today - 86400)) {
+ else if (flags.bRelativeDate && check > (today - 86400)) {
mir_wstrcpy(szResult, TranslateT("Yesterday"));
if (mode == 0)
mir_wstrcat(szResult, L",");
}
else {
- if (dwFlags & SMF_LONGDATE)
+ if (flags.bLongDate)
mir_wstrcpy(format, L"D");
else
mir_wstrcpy(format, L"d");
}
}
if (mode == 0 || mode == 2) {
- if (mode == 0 && (dwFlags & SMF_SHOWDATE))
+ if (mode == 0 && (flags.bShowDate))
mir_wstrcat(format, L" ");
- mir_wstrcat(format, (dwFlags & SMF_SHOWSECONDS) ? L"s" : L"t");
+ mir_wstrcat(format, (flags.bShowSeconds) ? L"s" : L"t");
}
if (format[0] != '\0') {
TimeZone_PrintTimeStamp(nullptr, check, format, str, _countof(str), 0);
@@ -412,7 +410,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD
int isGroupBreak = TRUE;
int highlight = 0;
- if ((gdat->flags & SMF_GROUPMESSAGES) && evt->dwFlags == LOWORD(dat->m_lastEventType) &&
+ if ((gdat->flags.bGroupMessages) && evt->dwFlags == LOWORD(dat->m_lastEventType) &&
evt->eventType == EVENTTYPE_MESSAGE && HIWORD(dat->m_lastEventType) == EVENTTYPE_MESSAGE &&
(isSameDate(evt->time, dat->m_lastEventTime)) && ((((int)evt->time < dat->m_startTime) == (dat->m_lastEventTime < dat->m_startTime)) || !(evt->dwFlags & IEEDF_READ))) {
isGroupBreak = FALSE;
@@ -420,7 +418,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD
CMStringA buf;
if (!streamData->isFirst && !dat->m_isMixed) {
- if (isGroupBreak || gdat->flags & SMF_MARKFOLLOWUPS)
+ if (isGroupBreak || gdat->flags.bMarkFollowups)
buf.Append("\\par");
else
buf.Append("\\line");
@@ -429,7 +427,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD
if (evt->dwFlags & IEEDF_RTL)
dat->m_isMixed = 1;
- if (!streamData->isFirst && isGroupBreak && (gdat->flags & SMF_DRAWLINES))
+ if (!streamData->isFirst && isGroupBreak && (gdat->flags.bDrawLines))
buf.AppendFormat("\\sl-1\\slmult0\\highlight%d\\cf%d\\fs1 \\par\\sl0", fontOptionsListSize + 4, fontOptionsListSize + 4);
buf.Append((evt->dwFlags & IEEDF_RTL) ? "\\rtlpar" : "\\ltrpar");
@@ -453,7 +451,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD
else
buf.Append("\\rtlch\\ltrch");
}
- if ((gdat->flags & SMF_SHOWICONS) && isGroupBreak) {
+ if ((gdat->flags.bShowIcons) && isGroupBreak) {
int i = LOGICON_MSG_NOTICE;
switch (evt->eventType) {
@@ -474,17 +472,17 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD
buf.AppendChar(' ');
}
- if (gdat->flags & SMF_SHOWTIME && (evt->eventType != EVENTTYPE_MESSAGE ||
- (gdat->flags & SMF_MARKFOLLOWUPS || isGroupBreak || !(gdat->flags & SMF_GROUPMESSAGES)))) {
+ if (gdat->flags.bShowTime && (evt->eventType != EVENTTYPE_MESSAGE ||
+ (gdat->flags.bMarkFollowups || isGroupBreak || !(gdat->flags.bGroupMessages)))) {
wchar_t *timestampString = nullptr;
- if (gdat->flags & SMF_GROUPMESSAGES && evt->eventType == EVENTTYPE_MESSAGE) {
+ if (gdat->flags.bGroupMessages && evt->eventType == EVENTTYPE_MESSAGE) {
if (isGroupBreak) {
- if (!(gdat->flags & SMF_MARKFOLLOWUPS))
+ if (!(gdat->flags.bMarkFollowups))
timestampString = TimestampToString(gdat->flags, evt->time, 0);
- else if (gdat->flags & SMF_SHOWDATE)
+ else if (gdat->flags.bShowDate)
timestampString = TimestampToString(gdat->flags, evt->time, 1);
}
- else if (gdat->flags & SMF_MARKFOLLOWUPS)
+ else if (gdat->flags.bMarkFollowups)
timestampString = TimestampToString(gdat->flags, evt->time, 2);
}
else timestampString = TimestampToString(gdat->flags, evt->time, 0);
@@ -497,7 +495,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD
buf.AppendFormat("%s: ", SetToStyle(evt->dwFlags & IEEDF_SENT ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON));
showColon = 1;
}
- if ((!(gdat->flags & SMF_HIDENAMES) && evt->eventType == EVENTTYPE_MESSAGE && isGroupBreak) || evt->eventType == EVENTTYPE_JABBER_CHATSTATES || evt->eventType == EVENTTYPE_JABBER_PRESENCE) {
+ if ((!(gdat->flags.bHideNames) && evt->eventType == EVENTTYPE_MESSAGE && isGroupBreak) || evt->eventType == EVENTTYPE_JABBER_CHATSTATES || evt->eventType == EVENTTYPE_JABBER_PRESENCE) {
if (evt->eventType == EVENTTYPE_MESSAGE) {
if (showColon)
buf.AppendFormat(" %s ", SetToStyle(evt->dwFlags & IEEDF_SENT ? MSGFONTID_MYNAME : MSGFONTID_YOURNAME));
@@ -512,8 +510,8 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD
AppendAnsiToBuffer(buf, evt->pszNick);
showColon = 1;
- if (evt->eventType == EVENTTYPE_MESSAGE && gdat->flags & SMF_GROUPMESSAGES) {
- if (gdat->flags & SMF_MARKFOLLOWUPS)
+ if (evt->eventType == EVENTTYPE_MESSAGE && gdat->flags.bGroupMessages) {
+ if (gdat->flags.bMarkFollowups)
buf.Append("\\par");
else
buf.Append("\\line");
@@ -521,7 +519,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD
}
}
- if ((gdat->flags & SMF_AFTERMASK) == SMF_AFTERMASK && evt->eventType == EVENTTYPE_MESSAGE && isGroupBreak) {
+ if (gdat->flags.bShowTime && gdat->flags.bGroupMessages && gdat->flags.bMarkFollowups && evt->eventType == EVENTTYPE_MESSAGE && isGroupBreak) {
buf.AppendFormat(" %s ", SetToStyle(evt->dwFlags & IEEDF_SENT ? MSGFONTID_MYTIME : MSGFONTID_YOURTIME));
AppendUnicodeToBuffer(buf, TimestampToString(gdat->flags, evt->time, 2));
showColon = 1;
@@ -564,7 +562,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD
}
break;
default:
- if (gdat->flags & SMF_MSGONNEWLINE && showColon)
+ if (gdat->flags.bMsgOnNewline && showColon)
buf.Append("\\line");
style = evt->dwFlags & IEEDF_SENT ? MSGFONTID_MYMSG : MSGFONTID_YOURMSG;
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp
index cf5163cd6b..585c854807 100644
--- a/plugins/Scriver/src/msgoptions.cpp
+++ b/plugins/Scriver/src/msgoptions.cpp
@@ -334,6 +334,8 @@ public:
class CTabsOptionsDlg : public CBaseOptionDlg
{
CCtrlCheck chkUseTabs, chkLimitTabs, chkLimitChatTabs, chkLimitNames, chkSeparateChats;
+ CCtrlCheck chkTabCloseButton, chkHideOneTab, chkTabsAtBottom, chkSwitchToActive;
+ CCtrlSpin spinNames, spinTabs, spinChatTabs;
public:
CTabsOptionsDlg() :
@@ -342,8 +344,29 @@ public:
chkLimitTabs(this, IDC_LIMITTABS),
chkLimitNames(this, IDC_LIMITNAMES),
chkLimitChatTabs(this, IDC_LIMITCHATSTABS),
- chkSeparateChats(this, IDC_SEPARATECHATSCONTAINERS)
- {
+ chkHideOneTab(this, IDC_HIDEONETAB),
+ chkSeparateChats(this, IDC_SEPARATECHATSCONTAINERS),
+ chkTabsAtBottom(this, IDC_TABSATBOTTOM),
+ chkSwitchToActive(this, IDC_SWITCHTOACTIVE),
+ chkTabCloseButton(this, IDC_TABCLOSEBUTTON),
+ spinNames(this, IDC_LIMITNAMESLENSPIN, 100),
+ spinTabs(this, IDC_LIMITTABSNUMSPIN, 100, 1),
+ spinChatTabs(this, IDC_LIMITCHATSTABSNUMSPIN, 100, 1)
+ {
+ CreateLink(chkUseTabs, g_plugin.bUseTabs);
+ CreateLink(chkLimitTabs, g_plugin.bLimitTabs);
+ CreateLink(chkLimitNames, g_plugin.bLimitNames);
+ CreateLink(chkLimitChatTabs, g_plugin.bLimitChatTabs);
+ CreateLink(chkHideOneTab, g_plugin.bHideOneTab);
+ CreateLink(chkSeparateChats, g_plugin.bSeparateChats);
+ CreateLink(chkTabsAtBottom, g_plugin.bTabsAtBottom);
+ CreateLink(chkSwitchToActive, g_plugin.bSwitchToActive);
+ CreateLink(chkTabCloseButton, g_plugin.bTabCloseButton);
+
+ CreateLink(spinNames, g_plugin.iLimitNames);
+ CreateLink(spinTabs, g_plugin.iLimitTabs);
+ CreateLink(spinChatTabs, g_plugin.iLimitChatTabs);
+
chkUseTabs.OnChange = Callback(this, &CTabsOptionsDlg::onChange_UseTabs);
chkLimitTabs.OnChange = Callback(this, &CTabsOptionsDlg::onChange_LimitTabs);
chkLimitNames.OnChange = Callback(this, &CTabsOptionsDlg::onChange_LimitNames);
@@ -353,58 +376,20 @@ public:
bool OnInitDialog() override
{
- CheckDlgButton(m_hwnd, IDC_USETABS, g_plugin.getByte(SRMSGSET_USETABS, SRMSGDEFSET_USETABS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_ALWAYSSHOWTABS, !g_plugin.getByte(SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_TABSATBOTTOM, g_plugin.getByte(SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM));
- CheckDlgButton(m_hwnd, IDC_SWITCHTOACTIVE, g_plugin.getByte(SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_TABCLOSEBUTTON, g_plugin.getByte(SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_LIMITNAMES, g_plugin.getByte(SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(m_hwnd, IDC_LIMITNAMESLENSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(m_hwnd, IDC_LIMITNAMESLENSPIN, UDM_SETPOS, 0, g_plugin.getWord(SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN));
-
- CheckDlgButton(m_hwnd, IDC_LIMITTABS, g_plugin.getByte(SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(m_hwnd, IDC_LIMITTABSNUMSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1));
- SendDlgItemMessage(m_hwnd, IDC_LIMITTABSNUMSPIN, UDM_SETPOS, 0, g_plugin.getWord(SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM));
-
- CheckDlgButton(m_hwnd, IDC_LIMITCHATSTABS, g_plugin.getByte(SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(m_hwnd, IDC_LIMITCHATSTABSNUMSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1));
- SendDlgItemMessage(m_hwnd, IDC_LIMITCHATSTABSNUMSPIN, UDM_SETPOS, 0, g_plugin.getWord(SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM));
-
- CheckDlgButton(m_hwnd, IDC_SEPARATECHATSCONTAINERS, g_plugin.getByte(SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS) ? BST_CHECKED : BST_UNCHECKED);
-
onChange_UseTabs(0);
return true;
}
- bool OnApply() override
- {
- g_plugin.setByte(SRMSGSET_USETABS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_USETABS));
- g_plugin.setByte(SRMSGSET_TABSATBOTTOM, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_TABSATBOTTOM));
- g_plugin.setByte(SRMSGSET_LIMITNAMES, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_LIMITNAMES));
- g_plugin.setWord(SRMSGSET_LIMITNAMESLEN, (WORD)SendDlgItemMessage(m_hwnd, IDC_LIMITNAMESLENSPIN, UDM_GETPOS, 0, 0));
-
- g_plugin.setByte(SRMSGSET_LIMITTABS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_LIMITTABS));
- g_plugin.setWord(SRMSGSET_LIMITTABSNUM, (WORD)SendDlgItemMessage(m_hwnd, IDC_LIMITTABSNUMSPIN, UDM_GETPOS, 0, 0));
- g_plugin.setByte(SRMSGSET_LIMITCHATSTABS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_LIMITCHATSTABS));
- g_plugin.setWord(SRMSGSET_LIMITCHATSTABSNUM, (WORD)SendDlgItemMessage(m_hwnd, IDC_LIMITCHATSTABSNUMSPIN, UDM_GETPOS, 0, 0));
-
- g_plugin.setByte(SRMSGSET_HIDEONETAB, (BYTE)BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_ALWAYSSHOWTABS));
- g_plugin.setByte(SRMSGSET_SWITCHTOACTIVE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SWITCHTOACTIVE));
- g_plugin.setByte(SRMSGSET_TABCLOSEBUTTON, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_TABCLOSEBUTTON));
- g_plugin.setByte(SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SEPARATECHATSCONTAINERS));
- return true;
- }
-
void onChange_UseTabs(CCtrlCheck*)
{
int bChecked = chkUseTabs.GetState();
- EnableWindow(GetDlgItem(m_hwnd, IDC_ALWAYSSHOWTABS), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_TABSATBOTTOM), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_SWITCHTOACTIVE), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_TABCLOSEBUTTON), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITNAMES), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_SEPARATECHATSCONTAINERS), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITTABS), bChecked);
+ chkHideOneTab.Enable(bChecked);
+ chkTabsAtBottom.Enable(bChecked);
+ chkSwitchToActive.Enable(bChecked);
+ chkTabCloseButton.Enable(bChecked);
+ chkLimitNames.Enable(bChecked);
+ chkSeparateChats.Enable(bChecked);
+ chkLimitTabs.Enable(bChecked);
onChange_LimitTabs(0);
onChange_LimitNames(0);
@@ -415,29 +400,29 @@ public:
{
int bChecked = chkUseTabs.GetState() && chkLimitTabs.GetState();
EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITTABSNUM), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITTABSNUMSPIN), bChecked);
+ spinTabs.Enable(bChecked);
}
void onChange_SeparateChats(CCtrlCheck*)
{
int bChecked = chkUseTabs.GetState() && chkSeparateChats.GetState();
- EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITCHATSTABS), bChecked);
+ chkLimitChatTabs.Enable(bChecked);
onChange_LimitChatTabs(0);
}
void onChange_LimitChatTabs(CCtrlCheck*)
{
- int bChecked = chkUseTabs.GetState() && IsDlgButtonChecked(m_hwnd, IDC_SEPARATECHATSCONTAINERS) && chkLimitChatTabs.GetState();
+ int bChecked = chkUseTabs.GetState() && chkSeparateChats.GetState() && chkLimitChatTabs.GetState();
EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITCHATSTABSNUM), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITCHATSTABSNUMSPIN), bChecked);
+ spinChatTabs.Enable(bChecked);
}
void onChange_LimitNames(CCtrlCheck*)
{
int bChecked = chkUseTabs.GetState() && chkLimitNames.GetState();
EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITNAMESLEN), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITNAMESLENSPIN), bChecked);
+ spinNames.Enable(bChecked);
EnableWindow(GetDlgItem(m_hwnd, IDC_CHARS), bChecked);
}
};
@@ -485,7 +470,7 @@ public:
onChange_ShowTitlebar(0);
CheckDlgButton(m_hwnd, IDC_SHOWPROGRESS, g_plugin.getByte(SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_AVATARSUPPORT, g_dat.flags & SMF_AVATAR);
+ CheckDlgButton(m_hwnd, IDC_AVATARSUPPORT, g_dat.flags.bShowAvatar);
return true;
}
@@ -558,25 +543,25 @@ class CLogOptionsDlg : public CBaseOptionDlg
{
m_log.SetText(L"");
- struct GlobalMessageData gdat = { 0 };
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_SHOWLOGICONS) ? SMF_SHOWICONS : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_SHOWNAMES) ? 0 : SMF_HIDENAMES;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES) ? SMF_SHOWTIME : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_SHOWSECONDS) ? SMF_SHOWSECONDS : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_SHOWDATES) ? SMF_SHOWDATE : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_USELONGDATE) ? SMF_LONGDATE : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_USERELATIVEDATE) ? SMF_RELATIVEDATE : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_GROUPMESSAGES) ? SMF_GROUPMESSAGES : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_MARKFOLLOWUPS) ? SMF_MARKFOLLOWUPS : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_MESSAGEONNEWLINE) ? SMF_MSGONNEWLINE : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_DRAWLINES) ? SMF_DRAWLINES : 0;
- gdat.flags |= IsDlgButtonChecked(m_hwnd, IDC_INDENTTEXT) ? SMF_INDENTTEXT : 0;
+ struct GlobalMessageData gdat = {};
+ gdat.flags.bShowIcons = IsDlgButtonChecked(m_hwnd, IDC_SHOWLOGICONS);
+ gdat.flags.bHideNames = !IsDlgButtonChecked(m_hwnd, IDC_SHOWNAMES);
+ gdat.flags.bShowTime = IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES);
+ gdat.flags.bShowSeconds = IsDlgButtonChecked(m_hwnd, IDC_SHOWSECONDS);
+ gdat.flags.bShowDate = IsDlgButtonChecked(m_hwnd, IDC_SHOWDATES);
+ gdat.flags.bLongDate = IsDlgButtonChecked(m_hwnd, IDC_USELONGDATE);
+ gdat.flags.bRelativeDate = IsDlgButtonChecked(m_hwnd, IDC_USERELATIVEDATE);
+ gdat.flags.bGroupMessages = IsDlgButtonChecked(m_hwnd, IDC_GROUPMESSAGES);
+ gdat.flags.bMarkFollowups = IsDlgButtonChecked(m_hwnd, IDC_MARKFOLLOWUPS);
+ gdat.flags.bMsgOnNewline = IsDlgButtonChecked(m_hwnd, IDC_MESSAGEONNEWLINE);
+ gdat.flags.bDrawLines = IsDlgButtonChecked(m_hwnd, IDC_DRAWLINES);
+ gdat.flags.bIndentText = IsDlgButtonChecked(m_hwnd, IDC_INDENTTEXT);
gdat.indentSize = (int)SendDlgItemMessage(m_hwnd, IDC_INDENTSPIN, UDM_GETPOS, 0, 0);
PARAFORMAT2 pf2;
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_OFFSET;
- pf2.dxOffset = (gdat.flags & SMF_INDENTTEXT) ? gdat.indentSize * 1440 / g_dat.logPixelSX : 0;
+ pf2.dxOffset = (gdat.flags.bIndentText) ? gdat.indentSize * 1440 / g_dat.logPixelSX : 0;
m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
StreamInTestEvents(m_log.GetHwnd(), &gdat);
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 7569692e0f..adf8d22b98 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -27,8 +27,6 @@ HCURSOR hDragCursor;
HGENMENU hMsgMenuItem;
HMODULE hMsftEdit;
-extern HWND GetParentWindow(MCONTACT hContact, BOOL bChat);
-
#define SCRIVER_DB_GETEVENTTEXT "Scriver/GetText"
static int SRMMStatusToPf2(int status)
@@ -55,7 +53,7 @@ static int SRMMStatusToPf2(int status)
}
int IsAutoPopup(MCONTACT hContact) {
- if (g_dat.flags & SMF_AUTOPOPUP) {
+ if (g_dat.flags.bAutoPopup) {
char *szProto = GetContactProto(hContact);
hContact = db_mc_getSrmmSub(hContact);
@@ -182,7 +180,7 @@ static INT_PTR TypingMessageCommand(WPARAM, LPARAM lParam)
static int TypingMessage(WPARAM hContact, LPARAM lParam)
{
- if (!(g_dat.flags2 & SMF2_SHOWTYPING))
+ if (!g_dat.flags2.bShowTyping)
return 0;
hContact = db_mc_tryMeta(hContact);
@@ -192,10 +190,10 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
HWND hwnd = Srmm_FindWindow(hContact);
if (hwnd)
SendMessage(hwnd, DM_TYPING, 0, lParam);
- else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) {
+ else if (lParam && g_dat.flags2.bShowTypingTray) {
wchar_t szTip[256];
mir_snwprintf(szTip, TranslateT("%s is typing a message"), Clist_GetContactDisplayName(hContact));
- if (g_dat.flags2 & SMF2_SHOWTYPINGCLIST) {
+ if (g_dat.flags2.bShowTypingClist) {
g_clistApi.pfnRemoveEvent(hContact, 1);
CLISTEVENT cle = {};
@@ -354,7 +352,7 @@ void CScriverWindow::Reattach(HWND hwndContainer)
hParent = WindowList_Find(g_dat.hParentWindowList, (UINT_PTR)hParent);
if ((hParent != nullptr && hParent != hwndContainer) || (hParent == nullptr && m_pParent->childrenCount > 1 && (GetKeyState(VK_CONTROL) & 0x8000))) {
if (hParent == nullptr) {
- hParent = GetParentWindow(hContact, FALSE);
+ hParent = GetParentWindow(hContact, false);
RECT rc;
GetWindowRect(hParent, &rc);
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index f33f8fa99b..52f87d1fa9 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -57,7 +57,7 @@ struct ParentWindowData
HWND hwndActive;
HWND hwndStatus;
HWND hwndTabs;
- DWORD flags2;
+ TabFlags flags2;
RECT childRect;
POINT mouseLBDownPos;
int mouseLBDown;
@@ -319,29 +319,6 @@ extern int fontOptionsListSize;
#define SRMM_MODULE "SRMM"
-#define SRMSGSET_USETABS "UseTabs"
-#define SRMSGDEFSET_USETABS 1
-#define SRMSGSET_TABSATBOTTOM "TabsPosition"
-#define SRMSGDEFSET_TABSATBOTTOM 0
-#define SRMSGSET_TABCLOSEBUTTON "TabCloseButton"
-#define SRMSGDEFSET_TABCLOSEBUTTON 0
-#define SRMSGSET_LIMITNAMES "LimitNamesOnTabs"
-#define SRMSGDEFSET_LIMITNAMES 1
-#define SRMSGSET_LIMITNAMESLEN "LimitNamesLength"
-#define SRMSGDEFSET_LIMITNAMESLEN 20
-#define SRMSGSET_HIDEONETAB "HideOneTab"
-#define SRMSGDEFSET_HIDEONETAB 1
-#define SRMSGSET_SEPARATECHATSCONTAINERS "SeparateChatsContainers"
-#define SRMSGDEFSET_SEPARATECHATSCONTAINERS 0
-#define SRMSGSET_LIMITTABS "LimitTabs"
-#define SRMSGDEFSET_LIMITTABS 0
-#define SRMSGSET_LIMITTABSNUM "LimitTabsNum"
-#define SRMSGDEFSET_LIMITTABSNUM 10
-#define SRMSGSET_LIMITCHATSTABS "LimitChatsTabs"
-#define SRMSGDEFSET_LIMITCHATSTABS 0
-#define SRMSGSET_LIMITCHATSTABSNUM "LimitChatsTabsNum"
-#define SRMSGDEFSET_LIMITCHATSTABSNUM 10
-
#define SRMSGSET_SHOWTITLEBAR "ShowTitleBar"
#define SRMSGDEFSET_SHOWTITLEBAR 1
#define SRMSGSET_SHOWSTATUSBAR "ShowStatusBar"
@@ -358,8 +335,6 @@ extern int fontOptionsListSize;
#define SRMSGDEFSET_SHOWINFOLINE 1
#define SRMSGSET_SHOWPROGRESS "ShowProgress"
#define SRMSGDEFSET_SHOWPROGRESS 0
-#define SRMSGSET_SWITCHTOACTIVE "SwitchToActiveTab"
-#define SRMSGDEFSET_SWITCHTOACTIVE 0
#define SRMSGSET_AUTOCLOSE "AutoClose"
#define SRMSGDEFSET_AUTOCLOSE 0
#define SRMSGSET_SENDBUTTON "UseSendButton"
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h
index a24cbd440f..ea22cf4228 100644
--- a/plugins/Scriver/src/resource.h
+++ b/plugins/Scriver/src/resource.h
@@ -143,7 +143,7 @@
#define IDC_ATRANSPARENCYPERC 1620
#define IDC_ITRANSPARENCYVALUE 1621
#define IDC_ITRANSPARENCYPERC 1622
-#define IDC_ALWAYSSHOWTABS 1623
+#define IDC_HIDEONETAB 1623
#define IDC_SENDALL 1624
#define IDC_TRANSPARENCYTEXT1 1627
#define IDC_TRANSPARENCYTEXT2 1628
diff --git a/plugins/Scriver/src/srmm.cpp b/plugins/Scriver/src/srmm.cpp
index 33f18aa9bf..cd13a56627 100644
--- a/plugins/Scriver/src/srmm.cpp
+++ b/plugins/Scriver/src/srmm.cpp
@@ -54,7 +54,21 @@ CMPlugin::CMPlugin() :
bSaveDrafts(SRMM_MODULE, "SaveDrafts", 0),
bHideContainer(SRMM_MODULE, "HideContainers", 0),
bStayMinimized(SRMM_MODULE, "StayMinimized", 0),
- bSavePerContact(SRMM_MODULE, "SavePerContact", 0)
+ bSavePerContact(SRMM_MODULE, "SavePerContact", 0),
+
+ bUseTabs(SRMM_MODULE, "UseTabs", 1),
+ bLimitTabs(SRMM_MODULE, "LimitTabs", 0),
+ bLimitChatTabs(SRMM_MODULE, "LimitChatsTabs", 0),
+ bLimitNames(SRMM_MODULE, "LimitNamesOnTabs", 1),
+ bHideOneTab(SRMM_MODULE, "HideOneTab", 1),
+ bTabsAtBottom(SRMM_MODULE, "TabsPosition", 0),
+ bSeparateChats(SRMM_MODULE, "SeparateChatsContainers", 0),
+ bTabCloseButton(SRMM_MODULE, "TabCloseButton", 0),
+ bSwitchToActive(SRMM_MODULE, "SwitchToActiveTab", 0),
+
+ iLimitNames(SRMM_MODULE, "LimitNamesLength", 20),
+ iLimitTabs(SRMM_MODULE, "LimitTabsNum", 10),
+ iLimitChatTabs(SRMM_MODULE, "LimitChatsTabsNum", 10)
{
}
diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h
index 1d375415ea..4165870743 100644
--- a/plugins/Scriver/src/stdafx.h
+++ b/plugins/Scriver/src/stdafx.h
@@ -71,6 +71,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct CMPlugin : public PLUGIN<CMPlugin>
{
CMOption<BYTE> bSavePerContact, bCascade, bStayMinimized, bAutoMin, bSaveDrafts, bDelTemp, bHideContainer, bAutoPopup;
+ CMOption<BYTE> bUseTabs, bLimitTabs, bLimitChatTabs, bLimitNames, bSeparateChats, bTabCloseButton, bHideOneTab, bTabsAtBottom, bSwitchToActive;
+ CMOption<WORD> iLimitNames, iLimitTabs, iLimitChatTabs;
CMPlugin();
@@ -117,8 +119,8 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam);
#include "cmdlist.h"
#include "sendqueue.h"
-#include "msgs.h"
#include "globals.h"
+#include "msgs.h"
#include "tabs.h"
#include "utils.h"
#include "input.h"
diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp
index 167a6465e4..f3722a02ff 100644
--- a/plugins/Scriver/src/tabs.cpp
+++ b/plugins/Scriver/src/tabs.cpp
@@ -45,20 +45,20 @@ static void GetChildWindowRect(ParentWindowData *dat, RECT *rcChild)
GetClientRect(dat->hwndTabs, &rcTabs);
TabCtrl_AdjustRect(dat->hwndTabs, FALSE, &rcTabs);
rcStatus.top = rcStatus.bottom = 0;
- if (dat->flags2 & SMF2_SHOWSTATUSBAR)
+ if (dat->flags2.bShowStatusBar)
GetWindowRect(dat->hwndStatus, &rcStatus);
rcChild->left = 0;
rcChild->right = rc.right;
- if (dat->flags2 & SMF2_TABSATBOTTOM) {
+ if (dat->flags2.bTabsAtBottom) {
rcChild->top = 2;
- if ((dat->flags2 & SMF2_USETABS && !(dat->flags2 & SMF2_HIDEONETAB)) || (dat->childrenCount > 1))
+ if ((dat->flags2.bUseTabs && !(dat->flags2.bHideOneTab)) || (dat->childrenCount > 1))
rcChild->bottom = rcTabs.bottom + 4;
else
rcChild->bottom = rc.bottom - rc.top - (rcStatus.bottom - rcStatus.top);
}
else {
- if ((dat->flags2 & SMF2_USETABS && !(dat->flags2 & SMF2_HIDEONETAB)) || (dat->childrenCount > 1))
+ if ((dat->flags2.bUseTabs && !(dat->flags2.bHideOneTab)) || (dat->childrenCount > 1))
rcChild->top = rcTabs.top;
else
rcChild->top = 2;
@@ -282,26 +282,26 @@ static void ActivateChildByIndex(ParentWindowData *dat, int index)
static void SetContainerWindowStyle(ParentWindowData *dat)
{
- ShowWindow(dat->hwndStatus, (dat->flags2 & SMF2_SHOWSTATUSBAR) ? SW_SHOW : SW_HIDE);
+ ShowWindow(dat->hwndStatus, (dat->flags2.bShowStatusBar) ? SW_SHOW : SW_HIDE);
DWORD ws = GetWindowLongPtr(dat->hwnd, GWL_STYLE) & ~(WS_CAPTION);
- if (dat->flags2 & SMF2_SHOWTITLEBAR)
+ if (dat->flags2.bShowTitleBar)
ws |= WS_CAPTION;
SetWindowLongPtr(dat->hwnd, GWL_STYLE, ws);
ws = GetWindowLongPtr(dat->hwnd, GWL_EXSTYLE)& ~WS_EX_LAYERED;
- ws |= dat->flags2 & SMF2_USETRANSPARENCY ? WS_EX_LAYERED : 0;
+ ws |= dat->flags2.bUseTransparency ? WS_EX_LAYERED : 0;
SetWindowLongPtr(dat->hwnd, GWL_EXSTYLE, ws);
- if (dat->flags2 & SMF2_USETRANSPARENCY)
+ if (dat->flags2.bUseTransparency)
SetLayeredWindowAttributes(dat->hwnd, RGB(255, 255, 255), (BYTE)(255 - g_dat.inactiveAlpha), LWA_ALPHA);
ws = GetWindowLongPtr(dat->hwndTabs, GWL_STYLE) & ~(TCS_BOTTOM | 0x2000);
- if (dat->flags2 & SMF2_TABSATBOTTOM)
+ if (dat->flags2.bTabsAtBottom)
ws |= TCS_BOTTOM;
ws |= 0x2000;
- if (dat->flags2 & SMF2_TABCLOSEBUTTON)
+ if (dat->flags2.bTabCloseButton)
TabCtrl_SetPadding(dat->hwndTabs, GetSystemMetrics(SM_CXEDGE) + 12, GetSystemMetrics(SM_CYEDGE) + 1);
else
TabCtrl_SetPadding(dat->hwndTabs, GetSystemMetrics(SM_CXEDGE) + 4, GetSystemMetrics(SM_CYEDGE) + 1);
@@ -437,7 +437,7 @@ static LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
}
}
- else if (dat->srcTab >= 0 && g_dat.flags2 & SMF2_TABCLOSEBUTTON) {
+ else if (dat->srcTab >= 0 && g_dat.flags2.bTabCloseButton) {
int atTop = (GetWindowLongPtr(hwnd, GWL_STYLE) & TCS_BOTTOM) == 0;
RECT rect;
@@ -568,44 +568,6 @@ __forceinline void UnsubclassTabCtrl(HWND hwnd)
/////////////////////////////////////////////////////////////////////////////////////////
-static int ScriverRestoreWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix, int flags, int showCmd)
-{
- WINDOWPLACEMENT wp;
- wp.length = sizeof(wp);
- GetWindowPlacement(hwnd, &wp);
-
- char szSettingName[64];
- mir_snprintf(szSettingName, "%sx", szNamePrefix);
- int x = db_get_dw(hContact, szModule, szSettingName, -1);
- mir_snprintf(szSettingName, "%sy", szNamePrefix);
- int y = db_get_dw(hContact, szModule, szSettingName, -1);
- if (x == -1)
- return 1;
-
- if (flags & RWPF_NOSIZE)
- OffsetRect(&wp.rcNormalPosition, x - wp.rcNormalPosition.left, y - wp.rcNormalPosition.top);
- else {
- wp.rcNormalPosition.left = x;
- wp.rcNormalPosition.top = y;
- mir_snprintf(szSettingName, "%swidth", szNamePrefix);
- wp.rcNormalPosition.right = wp.rcNormalPosition.left + db_get_dw(hContact, szModule, szSettingName, -1);
- mir_snprintf(szSettingName, "%sheight", szNamePrefix);
- wp.rcNormalPosition.bottom = wp.rcNormalPosition.top + db_get_dw(hContact, szModule, szSettingName, -1);
- }
- wp.flags = 0;
- wp.showCmd = showCmd;
-
- HMONITOR hMonitor = MonitorFromRect(&wp.rcNormalPosition, MONITOR_DEFAULTTONEAREST);
- MONITORINFO mi;
- mi.cbSize = sizeof(mi);
- GetMonitorInfo(hMonitor, &mi);
- RECT rcDesktop = mi.rcWork;
- if (wp.rcNormalPosition.left > rcDesktop.right || wp.rcNormalPosition.top > rcDesktop.bottom ||
- wp.rcNormalPosition.right < rcDesktop.left || wp.rcNormalPosition.bottom < rcDesktop.top) return 1;
- SetWindowPlacement(hwnd, &wp);
- return 0;
-}
-
struct NewMessageWindowLParam
{
MCONTACT hContact;
@@ -623,7 +585,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
switch (msg) {
case WM_INITDIALOG:
{
- int savePerContact = g_plugin.bSavePerContact;
+ int savePerContact = g_plugin.bSavePerContact && !g_dat.flags2.bUseTabs;
NewMessageWindowLParam *newData = (NewMessageWindowLParam *)lParam;
dat = (ParentWindowData *)mir_alloc(sizeof(ParentWindowData));
dat->hContact = newData->hContact;
@@ -667,7 +629,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
MCONTACT hSContact = savePerContact ? dat->hContact : 0;
dat->bTopmost = g_plugin.getByte(hSContact, SRMSGSET_TOPMOST, SRMSGDEFSET_TOPMOST);
- if (ScriverRestoreWindowPosition(hwndDlg, hSContact, SRMM_MODULE, (newData->isChat && !savePerContact) ? "chat" : "", 0, SW_HIDE))
+ if (Utils_RestoreWindowPosition(hwndDlg, hSContact, SRMM_MODULE, (newData->isChat && !savePerContact) ? "chat" : "", RWPF_HIDDEN))
SetWindowPos(hwndDlg, nullptr, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW);
if (!savePerContact && g_plugin.bCascade)
@@ -728,7 +690,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
GetClientRect(hwndDlg, &rc);
GetWindowRect(hwndDlg, &rcWindow);
rcStatus.top = rcStatus.bottom = 0;
- if (dat->flags2 & SMF2_SHOWSTATUSBAR) {
+ if (dat->flags2.bShowStatusBar) {
GetWindowRect(dat->hwndStatus, &rcStatus);
SetupStatusBar(dat);
}
@@ -746,7 +708,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
dat->childRect = rcChild;
MoveWindow(dat->hwndActive, rcChild.left, rcChild.top, rcChild.right - rcChild.left, rcChild.bottom - rcChild.top, TRUE);
RedrawWindow(GetDlgItem(dat->hwndActive, IDC_SRMM_LOG), nullptr, nullptr, RDW_INVALIDATE);
- if (dat->flags2 & SMF2_SHOWSTATUSBAR) {
+ if (dat->flags2.bShowStatusBar) {
SendMessage(dat->hwndStatus, WM_SIZE, 0, 0);
RedrawWindow(dat->hwndStatus, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
}
@@ -759,7 +721,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
return TRUE;
case WM_CLOSE:
- if (g_dat.flags2 & SMF2_HIDECONTAINERS && dat->childrenCount > 0)
+ if (g_dat.flags2.bHideContainer && dat->childrenCount > 0)
ShowWindow(hwndDlg, SW_HIDE);
else
DestroyWindow(hwndDlg);
@@ -902,9 +864,9 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
case WM_ACTIVATE:
if (LOWORD(wParam) == WA_INACTIVE) {
ws = GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_LAYERED;
- ws |= dat->flags2 & SMF2_USETRANSPARENCY ? WS_EX_LAYERED : 0;
+ ws |= dat->flags2.bUseTransparency ? WS_EX_LAYERED : 0;
SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, ws);
- if (dat->flags2 & SMF2_USETRANSPARENCY)
+ if (dat->flags2.bUseTransparency)
SetLayeredWindowAttributes(hwndDlg, RGB(255, 255, 255), (BYTE)(255 - g_dat.inactiveAlpha), LWA_ALPHA);
break;
}
@@ -918,9 +880,9 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
dat->nFlash = 0;
}
ws = GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_LAYERED;
- ws |= dat->flags2 & SMF2_USETRANSPARENCY ? WS_EX_LAYERED : 0;
+ ws |= dat->flags2.bUseTransparency ? WS_EX_LAYERED : 0;
SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, ws);
- if (dat->flags2 & SMF2_USETRANSPARENCY)
+ if (dat->flags2.bUseTransparency)
SetLayeredWindowAttributes(hwndDlg, RGB(255, 255, 255), (BYTE)(255 - g_dat.activeAlpha), LWA_ALPHA);
break;
@@ -999,8 +961,6 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
break;
case WM_DESTROY:
- char szSettingName[64];
-
for (int i = dat->childrenCount; i >= 0; i--) {
TCITEM tci;
tci.mask = TCIF_PARAM | TCIF_IMAGE;
@@ -1016,46 +976,30 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
WindowList_Remove(g_dat.hParentWindowList, hwndDlg);
{
- int savePerContact = g_plugin.bSavePerContact;
+ int savePerContact = g_plugin.bSavePerContact && !dat->flags2.bUseTabs;
MCONTACT hContact = (savePerContact) ? dat->hContact : 0;
-
- WINDOWPLACEMENT wp = { sizeof(wp) };
- GetWindowPlacement(hwndDlg, &wp);
-
- char *szNamePrefix = (!savePerContact && dat->isChat) ? "chat" : "";
- if (!dat->windowWasCascaded) {
- mir_snprintf(szSettingName, "%sx", szNamePrefix);
- g_plugin.setDword(hContact, szSettingName, wp.rcNormalPosition.left);
- mir_snprintf(szSettingName, "%sy", szNamePrefix);
- g_plugin.setDword(hContact, szSettingName, wp.rcNormalPosition.top);
- }
- mir_snprintf(szSettingName, "%swidth", szNamePrefix);
- g_plugin.setDword(hContact, szSettingName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- mir_snprintf(szSettingName, "%sheight", szNamePrefix);
- g_plugin.setDword(hContact, szSettingName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
+ Utils_SaveWindowPosition(hwndDlg, hContact, SRMM_MODULE, (!savePerContact && dat->isChat) ? "chat" : "");
g_plugin.setByte(hContact, SRMSGSET_TOPMOST, (BYTE)dat->bTopmost);
- if (g_dat.lastParent == dat)
- g_dat.lastParent = dat->prev;
+ }
- if (g_dat.lastChatParent == dat)
- g_dat.lastChatParent = dat->prev;
+ if (g_dat.lastParent == dat)
+ g_dat.lastParent = dat->prev;
- if (dat->prev != nullptr)
- dat->prev->next = dat->next;
+ if (g_dat.lastChatParent == dat)
+ g_dat.lastChatParent = dat->prev;
- if (dat->next != nullptr)
- dat->next->prev = dat->prev;
+ if (dat->prev != nullptr)
+ dat->prev->next = dat->next;
- UnsubclassTabCtrl(dat->hwndTabs);
- mir_free(dat);
- }
- break;
+ if (dat->next != nullptr)
+ dat->next->prev = dat->prev;
- case DM_ERRORDECIDED:
+ UnsubclassTabCtrl(dat->hwndTabs);
+ mir_free(dat);
break;
case CM_STARTFLASHING:
- if ((GetActiveWindow() != hwndDlg || GetForegroundWindow() != hwndDlg)) {// && !(g_dat.flags2 & SMF2_STAYMINIMIZED)) {
+ if ((GetActiveWindow() != hwndDlg || GetForegroundWindow() != hwndDlg)) {
dat->nFlash = 0;
SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
}
@@ -1064,17 +1008,17 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
case CM_POPUPWINDOW:
EnableWindow(hwndDlg, TRUE);
if (wParam) { /* incoming message */
- if (g_dat.flags & SMF_STAYMINIMIZED) {
+ if (g_dat.flags.bStayMinimized) {
if (!IsWindowVisible(hwndDlg))
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
- if (dat->childrenCount == 1 || ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(hwndDlg) || GetForegroundWindow() != hwndDlg)))
+ if (dat->childrenCount == 1 || (g_dat.flags2.bSwitchToActive && (IsIconic(hwndDlg) || GetForegroundWindow() != hwndDlg)))
SendMessage(hwndDlg, CM_ACTIVATECHILD, 0, (LPARAM)lParam);
}
else {
ShowWindow(hwndDlg, IsIconic(hwndDlg) ? SW_SHOWNORMAL : SW_SHOWNA);
- if (dat->childrenCount == 1 || ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(hwndDlg) || GetForegroundWindow() != hwndDlg)))
+ if (dat->childrenCount == 1 || (g_dat.flags2.bSwitchToActive && (IsIconic(hwndDlg) || GetForegroundWindow() != hwndDlg)))
SendMessage(hwndDlg, CM_ACTIVATECHILD, 0, (LPARAM)lParam);
SetWindowPos(hwndDlg, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
@@ -1127,7 +1071,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
return TRUE;
case CM_GETTOOLBARSTATUS:
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)(dat->flags2 & SMF2_SHOWTOOLBAR) != 0);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)(dat->flags2.bShowToolBar) != 0);
return TRUE;
case DM_SENDMESSAGE:
@@ -1197,7 +1141,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
if (tcd->iFlags & TCDF_TEXT) {
tci.mask |= TCIF_TEXT;
tci.pszText = tcd->pszText;
- if (g_dat.flags2 & SMF2_LIMITNAMES) {
+ if (g_dat.flags2.bLimitNames) {
wchar_t *ltext = limitText(tcd->pszText, g_dat.limitNamesLength);
if (ltext != tcd->pszText)
tci.pszText = ptszTemp = ltext;
@@ -1221,7 +1165,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
break;
case DM_SWITCHINFOBAR:
- dat->flags2 ^= SMF2_SHOWINFOBAR;
+ dat->flags2.bShowInfoBar = !dat->flags2.bShowInfoBar;
for (int i = 0; i < dat->childrenCount; i++) {
CScriverWindow * pDlg = GetChildFromTab(dat->hwndTabs, i);
@@ -1231,13 +1175,13 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
break;
case DM_SWITCHSTATUSBAR:
- dat->flags2 ^= SMF2_SHOWSTATUSBAR;
- ShowWindow(dat->hwndStatus, (dat->flags2 & SMF2_SHOWSTATUSBAR) ? SW_SHOW : SW_HIDE);
+ dat->flags2.bShowStatusBar = !dat->flags2.bShowStatusBar;
+ ShowWindow(dat->hwndStatus, (dat->flags2.bShowStatusBar) ? SW_SHOW : SW_HIDE);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
break;
case DM_SWITCHTOOLBAR:
- dat->flags2 ^= SMF2_SHOWTOOLBAR;
+ dat->flags2.bShowToolBar = !dat->flags2.bShowToolBar;
for (int i = 0; i < dat->childrenCount; i++) {
CScriverWindow * pDlg = GetChildFromTab(dat->hwndTabs, i);
@@ -1248,9 +1192,9 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara
break;
case DM_SWITCHTITLEBAR:
- dat->flags2 ^= SMF2_SHOWTITLEBAR;
+ dat->flags2.bShowTitleBar = !dat->flags2.bShowTitleBar;
ws = GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~(WS_CAPTION);
- if (dat->flags2 & SMF2_SHOWTITLEBAR)
+ if (dat->flags2.bShowTitleBar)
ws |= WS_CAPTION;
SetWindowLongPtr(hwndDlg, GWL_STYLE, ws);
@@ -1285,7 +1229,6 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM, LPARAM lParam)
return;
TabCtrlData *tcdat = (TabCtrlData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- HANDLE hTheme = nullptr;
int tstate = 0;
wchar_t szLabel[1024];
TCITEM tci;
@@ -1293,129 +1236,131 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM, LPARAM lParam)
tci.pszText = szLabel;
tci.cchTextMax = _countof(szLabel);
tci.dwStateMask = TCIS_HIGHLIGHTED;
- if (TabCtrl_GetItem(hwnd, iTabIndex, &tci)) {
- IMAGEINFO info;
- RECT rIcon = lpDIS->rcItem;
- RECT rect = lpDIS->rcItem;
- RECT rectTab = lpDIS->rcItem;
- int bSelected = lpDIS->itemState & ODS_SELECTED;
- int atTop = (GetWindowLongPtr(hwnd, GWL_STYLE) & TCS_BOTTOM) == 0;
- UINT dwFormat;
- if (!IsAppThemed())
- FillRect(lpDIS->hDC, &rect, GetSysColorBrush(COLOR_BTNFACE));
- else {
- if (lpDIS->itemState & ODS_SELECTED)
- tstate = TTIS_SELECTED;
- else if (lpDIS->itemState & ODS_FOCUS)
- tstate = TTIS_FOCUSED;
- else if (lpDIS->itemState & ODS_HOTLIGHT)
- tstate = TTIS_HOT;
- else
- tstate = TTIS_NORMAL;
+ if (!TabCtrl_GetItem(hwnd, iTabIndex, &tci))
+ return;
- if (!bSelected)
- InflateRect(&rectTab, 1, 1);
+ IMAGEINFO info;
+ RECT rIcon = lpDIS->rcItem;
+ RECT rect = lpDIS->rcItem;
+ RECT rectTab = lpDIS->rcItem;
+ int bSelected = lpDIS->itemState & ODS_SELECTED;
+ int atTop = (GetWindowLongPtr(hwnd, GWL_STYLE) & TCS_BOTTOM) == 0;
+ UINT dwFormat;
+ HANDLE hTheme = nullptr;
+ if (!IsAppThemed())
+ FillRect(lpDIS->hDC, &rect, GetSysColorBrush(COLOR_BTNFACE));
+ else {
+ if (lpDIS->itemState & ODS_SELECTED)
+ tstate = TTIS_SELECTED;
+ else if (lpDIS->itemState & ODS_FOCUS)
+ tstate = TTIS_FOCUSED;
+ else if (lpDIS->itemState & ODS_HOTLIGHT)
+ tstate = TTIS_HOT;
+ else
+ tstate = TTIS_NORMAL;
- hTheme = OpenThemeData(hwnd, L"TAB");
- if (IsThemeBackgroundPartiallyTransparent(hTheme, TABP_TABITEM, tstate))
- DrawThemeParentBackground(hwnd, lpDIS->hDC, &rectTab);
- DrawThemeBackground(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, &rectTab, nullptr);
+ if (!bSelected)
+ InflateRect(&rectTab, 1, 1);
+
+ hTheme = OpenThemeData(hwnd, L"TAB");
+ if (IsThemeBackgroundPartiallyTransparent(hTheme, TABP_TABITEM, tstate))
+ DrawThemeParentBackground(hwnd, lpDIS->hDC, &rectTab);
+ DrawThemeBackground(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, &rectTab, nullptr);
+ }
+ if (atTop) {
+ dwFormat = DT_SINGLELINE | DT_TOP | DT_CENTER | DT_NOPREFIX | DT_NOCLIP;
+ rIcon.top = rect.top + GetSystemMetrics(SM_CYEDGE);
+ if (tci.iImage >= 0) {
+ rIcon.left = rect.left + GetSystemMetrics(SM_CXEDGE) + (bSelected ? 6 : 2);
+ ImageList_GetImageInfo(g_dat.hTabIconList, tci.iImage, &info);
+ ImageList_DrawEx(g_dat.hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left);
}
- if (atTop) {
- dwFormat = DT_SINGLELINE | DT_TOP | DT_CENTER | DT_NOPREFIX | DT_NOCLIP;
- rIcon.top = rect.top + GetSystemMetrics(SM_CYEDGE);
- if (tci.iImage >= 0) {
- rIcon.left = rect.left + GetSystemMetrics(SM_CXEDGE) + (bSelected ? 6 : 2);
- ImageList_GetImageInfo(g_dat.hTabIconList, tci.iImage, &info);
- ImageList_DrawEx(g_dat.hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
- rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left);
- }
- if (dat->flags2 & SMF2_TABCLOSEBUTTON) {
- ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
- rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left);
- ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
- rect.right = rIcon.left - 1;
- }
- rect.top += GetSystemMetrics(SM_CYEDGE) + 2;
+ if (dat->flags2.bTabCloseButton) {
+ ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
+ rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left);
+ ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ rect.right = rIcon.left - 1;
}
- else {
- dwFormat = DT_SINGLELINE | DT_BOTTOM | DT_CENTER | DT_NOPREFIX | DT_NOCLIP;
- rIcon.left = rect.left + GetSystemMetrics(SM_CXEDGE) + (bSelected ? 6 : 2);
- if (tci.iImage >= 0) {
- ImageList_GetImageInfo(g_dat.hTabIconList, tci.iImage, &info);
- rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 1;
- ImageList_DrawEx(g_dat.hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
- rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left);
- }
- if (dat->flags2 & SMF2_TABCLOSEBUTTON) {
- ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
- rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 2;
- rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left);
- ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
- rect.right = rIcon.left - 1;
- }
- rect.bottom -= GetSystemMetrics(SM_CYEDGE) + 2;
+ rect.top += GetSystemMetrics(SM_CYEDGE) + 2;
+ }
+ else {
+ dwFormat = DT_SINGLELINE | DT_BOTTOM | DT_CENTER | DT_NOPREFIX | DT_NOCLIP;
+ rIcon.left = rect.left + GetSystemMetrics(SM_CXEDGE) + (bSelected ? 6 : 2);
+ if (tci.iImage >= 0) {
+ ImageList_GetImageInfo(g_dat.hTabIconList, tci.iImage, &info);
+ rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 1;
+ ImageList_DrawEx(g_dat.hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left);
}
+ if (dat->flags2.bTabCloseButton) {
+ ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
+ rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 2;
+ rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left);
+ ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ rect.right = rIcon.left - 1;
+ }
+ rect.bottom -= GetSystemMetrics(SM_CYEDGE) + 2;
+ }
- if (hTheme)
- DrawThemeText(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, szLabel, -1, dwFormat, 0, &rect);
- else
- DrawText(lpDIS->hDC, szLabel, -1, &rect, dwFormat);
-
- if (tcdat->bDragged && iTabIndex == tcdat->destTab && iTabIndex != tcdat->srcTab) {
- RECT hlRect = lpDIS->rcItem;
- if (bSelected) {
- hlRect.bottom -= GetSystemMetrics(SM_CYEDGE);
+ if (hTheme)
+ DrawThemeText(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, szLabel, -1, dwFormat, 0, &rect);
+ else
+ DrawText(lpDIS->hDC, szLabel, -1, &rect, dwFormat);
+
+ if (tcdat->bDragged && iTabIndex == tcdat->destTab && iTabIndex != tcdat->srcTab) {
+ RECT hlRect = lpDIS->rcItem;
+ if (bSelected) {
+ hlRect.bottom -= GetSystemMetrics(SM_CYEDGE);
+ hlRect.top += GetSystemMetrics(SM_CYEDGE);
+ hlRect.left += GetSystemMetrics(SM_CXEDGE);
+ hlRect.right -= GetSystemMetrics(SM_CXEDGE);
+ }
+ else {
+ if (atTop) {
hlRect.top += GetSystemMetrics(SM_CYEDGE);
- hlRect.left += GetSystemMetrics(SM_CXEDGE);
- hlRect.right -= GetSystemMetrics(SM_CXEDGE);
+ hlRect.bottom += GetSystemMetrics(SM_CYEDGE);
}
else {
- if (atTop) {
- hlRect.top += GetSystemMetrics(SM_CYEDGE);
- hlRect.bottom += GetSystemMetrics(SM_CYEDGE);
- }
- else {
- hlRect.top -= GetSystemMetrics(SM_CYEDGE);
- hlRect.bottom -= GetSystemMetrics(SM_CYEDGE);
- }
+ hlRect.top -= GetSystemMetrics(SM_CYEDGE);
+ hlRect.bottom -= GetSystemMetrics(SM_CYEDGE);
}
- FrameRect(lpDIS->hDC, &hlRect, GetSysColorBrush(COLOR_HIGHLIGHT));
- hlRect.left++;
- hlRect.top++;
- hlRect.right--;
- hlRect.bottom--;
- FrameRect(lpDIS->hDC, &hlRect, GetSysColorBrush(COLOR_HIGHLIGHT));
}
- if (hTheme)
- CloseThemeData(hTheme);
+ FrameRect(lpDIS->hDC, &hlRect, GetSysColorBrush(COLOR_HIGHLIGHT));
+ hlRect.left++;
+ hlRect.top++;
+ hlRect.right--;
+ hlRect.bottom--;
+ FrameRect(lpDIS->hDC, &hlRect, GetSysColorBrush(COLOR_HIGHLIGHT));
}
+ if (hTheme)
+ CloseThemeData(hTheme);
}
-HWND GetParentWindow(MCONTACT hContact, BOOL bChat)
+HWND GetParentWindow(MCONTACT hContact, bool bChat)
{
NewMessageWindowLParam newData = { 0 };
newData.hContact = hContact;
newData.isChat = bChat;
- if (g_dat.flags2 & SMF2_USETABS) {
- if (!bChat || !(g_dat.flags2 & SMF2_SEPARATECHATSCONTAINERS)) {
+ if (g_dat.flags2.bUseTabs) {
+ if (!bChat || !g_dat.flags2.bSeparateChats) {
if (g_dat.lastParent != nullptr) {
int tabsNum = (int)SendMessage(g_dat.lastParent->hwnd, CM_GETCHILDCOUNT, 0, 0);
- if (!(g_dat.flags2 & SMF2_LIMITTABS) || tabsNum < g_dat.limitTabsNum)
+ if (!g_dat.flags2.bLimitTabs || tabsNum < g_dat.limitTabsNum)
return g_dat.lastParent->hwnd;
}
}
else {
if (g_dat.lastChatParent != nullptr) {
int tabsNum = (int)SendMessage(g_dat.lastChatParent->hwnd, CM_GETCHILDCOUNT, 0, 0);
- if (!(g_dat.flags2 & SMF2_LIMITCHATSTABS) || tabsNum < g_dat.limitChatsTabsNum)
+ if (!g_dat.flags2.bLimitChatTabs || tabsNum < g_dat.limitChatsTabsNum)
return g_dat.lastChatParent->hwnd;
}
}
}
- if (!(g_dat.flags2 & SMF2_SEPARATECHATSCONTAINERS))
- newData.isChat = FALSE;
+ if (!g_dat.flags2.bSeparateChats)
+ newData.isChat = false;
return CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGWIN), nullptr, DlgProcParentWindow, (LPARAM)&newData);
}
diff --git a/plugins/Scriver/src/tabs.h b/plugins/Scriver/src/tabs.h
index 9af8c6d786..463bf90d10 100644
--- a/plugins/Scriver/src/tabs.h
+++ b/plugins/Scriver/src/tabs.h
@@ -84,6 +84,6 @@ struct TabControlData
HICON hIcon;
};
-HWND GetParentWindow(MCONTACT hContact, BOOL bChat);
+HWND GetParentWindow(MCONTACT hContact, bool bChat);
#endif
diff --git a/plugins/Scriver/src/version.h b/plugins/Scriver/src/version.h
index 7d819ff22b..6e6998af6c 100644
--- a/plugins/Scriver/src/version.h
+++ b/plugins/Scriver/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 3
#define __MINOR_VERSION 0
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 11
+#define __RELEASE_NUM 2
+#define __BUILD_NUM 1
#include <stdver.h>