diff options
24 files changed, 266 insertions, 427 deletions
diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index 79160c1d8a..b637d7c526 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -66,7 +66,6 @@ BEGIN CONTROL "",IDC_HISTORYSIZESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,221,189,11,13
LTEXT "entries",IDC_STATIC,229,192,67,10
CONTROL "More about advanced tweaks",IDC_PLUS_HELP,"Hyperlink",WS_TABSTOP | 0x1,11,210,158,9
- PUSHBUTTON "Revert to (safe) defaults",IDC_PLUS_REVERT,180,207,111,14
END
IDD_CHOOSESTATUSMODES DIALOGEX 0, 0, 226, 154
diff --git a/plugins/TabSRMM/src/chat.h b/plugins/TabSRMM/src/chat.h index a326144485..42df2909a2 100644 --- a/plugins/TabSRMM/src/chat.h +++ b/plugins/TabSRMM/src/chat.h @@ -71,11 +71,9 @@ struct TMUCSettings : public GlobalLogSettingsBase COLORREF nickColors[8];
HBRUSH SelectionBGBrush;
- bool bOpenInDefault, bBBCodeInPopups;
- bool bLogClassicIndicators, bAlternativeSorting, bAnnoyingHighlight, bCreateWindowOnHighlight;
- bool bLogSymbols, bClassicIndicators, bClickableNicks, bColorizeNicks, bColorizeNicksInLog;
- bool bScaleIcons, bNewLineAfterNames;
+ bool bLogSymbols, bScaleIcons, bClickableNicks, bLogClassicIndicators, bColorizeNicksInLog;
+ bool bNewLineAfterNames, bAlternativeSorting, bColorizeNicks, bClassicIndicators;
CMUCHighlight *Highlight;
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index f433d42ef9..c9662c5dbc 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -82,28 +82,19 @@ static void OnCreateModule(MODULEINFO *mi) static void OnLoadSettings()
{
g_Settings.dwIconFlags = db_get_dw(0, CHAT_MODULE, "IconFlags", 0x0000);
- g_Settings.bOpenInDefault = M.GetBool(CHAT_MODULE, "DefaultContainer", true);
g_Settings.UserListColors[CHAT_STATUS_NORMAL] = db_get_dw(0, CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0));
g_Settings.UserListColors[CHAT_STATUS_AWAY] = db_get_dw(0, CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170));
g_Settings.UserListColors[CHAT_STATUS_OFFLINE] = db_get_dw(0, CHATFONT_MODULE, "Font5Col", RGB(160, 90, 90));
- g_Settings.bBBCodeInPopups = M.GetBool(CHAT_MODULE, "BBCodeInPopups", false);
- g_Settings.bClassicIndicators = M.GetBool(CHAT_MODULE, "ClassicIndicators", false);
- g_Settings.bLogClassicIndicators = M.GetBool(CHAT_MODULE, "LogClassicIndicators", false);
- g_Settings.bAlternativeSorting = M.GetBool(CHAT_MODULE, "AlternativeSorting", true);
- g_Settings.bAnnoyingHighlight = M.GetBool(CHAT_MODULE, "AnnoyingHighlight", false);
- g_Settings.bCreateWindowOnHighlight = M.GetBool(CHAT_MODULE, "CreateWindowOnHighlight", false);
- g_Settings.bLogSymbols = M.GetBool(CHAT_MODULE, "LogSymbols", true);
- g_Settings.bClickableNicks = M.GetBool(CHAT_MODULE, "ClickableNicks", true);
- g_Settings.bColorizeNicks = M.GetBool(CHAT_MODULE, "ColorizeNicks", true);
- g_Settings.bColorizeNicksInLog = M.GetBool(CHAT_MODULE, "ColorizeNicksInLog", true);
- g_Settings.bScaleIcons = M.GetBool(CHAT_MODULE, "ScaleIcons", true);
-
- g_Settings.bDoubleClick4Privat = M.GetBool(CHAT_MODULE, "DoubleClick4Privat", false);
- g_Settings.bShowContactStatus = M.GetBool(CHAT_MODULE, "ShowContactStatus", true);
- g_Settings.bContactStatusFirst = M.GetBool(CHAT_MODULE, "ContactStatusFirst", false);
-
- g_Settings.bNewLineAfterNames = M.GetBool(CHAT_MODULE, "NewlineAfterNames", false);
+ g_Settings.bLogSymbols = g_plugin.bLogSymbols;
+ g_Settings.bScaleIcons = g_plugin.bScaleIcons;
+ g_Settings.bColorizeNicks = g_plugin.bColorizeNicks;
+ g_Settings.bClickableNicks = g_plugin.bClickableNicks;
+ g_Settings.bNewLineAfterNames = g_plugin.bNewLineAfterNames;
+ g_Settings.bClassicIndicators = g_plugin.bClassicIndicators;
+ g_Settings.bAlternativeSorting = g_plugin.bAlternativeSorting;
+ g_Settings.bColorizeNicksInLog = g_plugin.bColorizeNicksInLog;
+ g_Settings.bLogClassicIndicators = g_plugin.bLogClassicIndicators;
replaceStrW(g_Settings.pszLogDir, M.getChatLogPath());
replaceStrW(g_Settings.pwszAutoText, db_get_wsa(0, CHAT_MODULE, "TextAutocomplete", L":"));
@@ -225,7 +216,7 @@ void ShowRoom(TContainerData *pContainer, SESSION_INFO *si) if (pContainer == nullptr) {
GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN);
- if (!g_Settings.bOpenInDefault && !mir_wstrcmp(szName, L"default"))
+ if (!g_plugin.bOpenInDefault && !mir_wstrcmp(szName, L"default"))
wcsncpy_s(szName, L"Chat Rooms", _TRUNCATE);
szName[CONTAINER_NAMELEN] = 0;
pContainer = FindContainerByName(szName);
@@ -306,7 +297,7 @@ void ShowRoom(TContainerData *pContainer, SESSION_INFO *si) SetFocus(pContainer->m_hwndActive);
}
- if (PluginConfig.m_bHideOnClose && !IsWindowVisible(pContainer->m_hwnd)) {
+ if (g_plugin.bHideOnClose && !IsWindowVisible(pContainer->m_hwnd)) {
WINDOWPLACEMENT wp = { 0 };
wp.length = sizeof(wp);
GetWindowPlacement(pContainer->m_hwnd, &wp);
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 02905efe57..e7a7219045 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -482,53 +482,12 @@ protected: /////////////////////////////////////////////////////////////////////////////////////////
// Group chat - Settings
-TOptionListGroup lvGroupsChat[] =
-{
- { 0, LPGENW("Appearance and functionality of chat room windows") },
- { 0, LPGENW("Appearance of the message log") },
- { 0 }
-};
-
-static TOptionListItem lvItemsChat[] =
-{
- { 0, LPGENW("Open new chat rooms in the default container"), 1, LOI_TYPE_SETTING, (UINT_PTR)"DefaultContainer", 0 },
- { 0, LPGENW("Flash window when someone speaks"), 0, LOI_TYPE_SETTING, (UINT_PTR)"FlashWindow", 0 },
- { 0, LPGENW("Flash window when a word is highlighted"), 1, LOI_TYPE_SETTING, (UINT_PTR)"FlashWindowHighlight", 0 },
- { 0, LPGENW("Create tabs or windows for highlight events"), 0, LOI_TYPE_SETTING, (UINT_PTR)"CreateWindowOnHighlight", 0 },
- { 0, LPGENW("Activate chat window on highlight"), 0, LOI_TYPE_SETTING, (UINT_PTR)"AnnoyingHighlight", 0 },
- { 0, LPGENW("Show list of users in the chat room"), 1, LOI_TYPE_SETTING, (UINT_PTR)"ShowNicklist", 0 },
- { 0, LPGENW("Colorize nicknames in member list (you need to adjust colors)"), 1, LOI_TYPE_SETTING, (UINT_PTR)"ColorizeNicks", 0 },
- { 0, LPGENW("Show topic as status message on the contact list"), 1, LOI_TYPE_SETTING, (UINT_PTR)"TopicOnClist", 0 },
- { 0, LPGENW("Do not pop up the window when joining a chat room"), 0, LOI_TYPE_SETTING, (UINT_PTR)"PopupOnJoin", 0 },
- { 0, LPGENW("Sync splitter position with standard IM sessions"), 0, LOI_TYPE_SETTING, (UINT_PTR)"SyncSplitter", 0 },
- { 0, LPGENW("Show contact's status modes if supported by the protocol"), 1, LOI_TYPE_SETTING, (UINT_PTR)"ShowContactStatus", 0 },
- { 0, LPGENW("Display contact's status icon before user role icon"), 0, LOI_TYPE_SETTING, (UINT_PTR)"ContactStatusFirst", 0 },
- { 0, LPGENW("Use IRC style status indicators in the nick list"), 0, LOI_TYPE_SETTING, (UINT_PTR)"ClassicIndicators", 0 },
- { 0, LPGENW("Use alternative sorting method in member list"), 1, LOI_TYPE_SETTING, (UINT_PTR)"AlternativeSorting", 0 },
-
- { 0, LPGENW("Prefix all events with a timestamp"), 1, LOI_TYPE_SETTING, (UINT_PTR)"ShowTimeStamp", 1 },
- { 0, LPGENW("Only prefix with timestamp if it has changed"), 0, LOI_TYPE_SETTING, (UINT_PTR)"ShowTimeStampIfChanged", 1 },
- { 0, LPGENW("Timestamp has same color as the event"), 0, LOI_TYPE_SETTING, (UINT_PTR)"TimeStampEventColour", 1 },
- { 0, LPGENW("Indent the second line of a message"), 1, LOI_TYPE_SETTING, (UINT_PTR)"LogIndentEnabled", 1 },
- { 0, LPGENW("Limit user names in the message log to 20 characters"), 1, LOI_TYPE_SETTING, (UINT_PTR)"LogLimitNames", 1 },
- { 0, LPGENW("Start private conversation on double click in nick list (insert nick if unchecked)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"DoubleClick4Privat", 1 },
- { 0, LPGENW("Strip colors from messages in the log"), 0, LOI_TYPE_SETTING, (UINT_PTR)"StripFormatting", 1 },
- { 0, LPGENW("Enable the 'event filter' for new rooms"), 0, LOI_TYPE_SETTING, (UINT_PTR)"FilterEnabled", 1 },
- { 0, LPGENW("Use IRC style status indicators in the log"), 0, LOI_TYPE_SETTING, (UINT_PTR)"LogClassicIndicators", 1 },
- { 0, LPGENW("Allow clickable user names in the message log"), 1, LOI_TYPE_SETTING, (UINT_PTR)"ClickableNicks", 1 },
- { 0, LPGENW("Add new line after names"), 0, LOI_TYPE_SETTING, (UINT_PTR)"NewlineAfterNames", 1 },
- { 0, LPGENW("Colorize user names in message log"), 1, LOI_TYPE_SETTING, (UINT_PTR)"ColorizeNicksInLog", 1 },
- { 0, LPGENW("Scale down icons to 10x10 pixels in the chat log"), 1, LOI_TYPE_SETTING, (UINT_PTR)"ScaleIcons", 1 },
-
- { 0, 0, 0, 0, 0, 0 }
-};
-
class CChatSettingsDlg : public CChatBaseOptionDlg
{
HTREEITEM hListHeading1 = nullptr;
HTREEITEM hListHeading2 = nullptr;
- CCtrlTreeView treeCheck;
+ CCtrlTreeOpts treeCheck;
CCtrlEdit edtGroup, edtAutocomplete;
public:
@@ -537,14 +496,42 @@ public: edtGroup(this, IDC_GROUP),
edtAutocomplete(this, IDC_AUTOCOMPLETE),
treeCheck(this, IDC_CHECKBOXES)
- {}
+ {
+ auto *pwszSection = LPGENW("Appearance and functionality of chat room windows");
+ treeCheck.AddOption(pwszSection, LPGENW("Open new chat rooms in the default container"), g_plugin.bOpenInDefault);
+ treeCheck.AddOption(pwszSection, LPGENW("Flash window when someone speaks"), Chat::bFlashWindow);
+ treeCheck.AddOption(pwszSection, LPGENW("Flash window when a word is highlighted"), Chat::bFlashWindowHighlight);
+ treeCheck.AddOption(pwszSection, LPGENW("Create tabs or windows for highlight events"), g_plugin.bCreateWindowOnHighlight);
+ treeCheck.AddOption(pwszSection, LPGENW("Activate chat window on highlight"), g_plugin.bAnnoyingHighlight);
+ treeCheck.AddOption(pwszSection, LPGENW("Show list of users in the chat room"), Chat::bShowNicklist);
+ treeCheck.AddOption(pwszSection, LPGENW("Colorize nicknames in member list (you need to adjust colors)"), g_plugin.bColorizeNicks);
+ treeCheck.AddOption(pwszSection, LPGENW("Show topic as status message on the contact list"), Chat::bTopicOnClist);
+ treeCheck.AddOption(pwszSection, LPGENW("Do not pop up the window when joining a chat room"), Chat::bPopupOnJoin);
+ treeCheck.AddOption(pwszSection, LPGENW("Show contact's status modes if supported by the protocol"), Chat::bShowContactStatus);
+ treeCheck.AddOption(pwszSection, LPGENW("Display contact's status icon before user role icon"), Chat::bContactStatusFirst);
+ treeCheck.AddOption(pwszSection, LPGENW("Use IRC style status indicators in the nick list"), g_plugin.bClassicIndicators);
+ treeCheck.AddOption(pwszSection, LPGENW("Use alternative sorting method in member list"), g_plugin.bAlternativeSorting);
+
+ pwszSection = LPGENW("Appearance of the message log");
+ treeCheck.AddOption(pwszSection, LPGENW("Prefix all events with a timestamp"), Chat::bShowTime);
+ treeCheck.AddOption(pwszSection, LPGENW("Only prefix with timestamp if it has changed"), Chat::bShowTimeIfChanged);
+ treeCheck.AddOption(pwszSection, LPGENW("Timestamp has same color as the event"), Chat::bTimeStampEventColour);
+ treeCheck.AddOption(pwszSection, LPGENW("Indent the second line of a message"), Chat::bLogIndentEnabled);
+ treeCheck.AddOption(pwszSection, LPGENW("Limit user names in the message log to 20 characters"), Chat::bLogLimitNames);
+ treeCheck.AddOption(pwszSection, LPGENW("Start private conversation on double click in nick list (insert nick if unchecked)"), Chat::bDoubleClick4Privat);
+ treeCheck.AddOption(pwszSection, LPGENW("Strip colors from messages in the log"), Chat::bStripFormat);
+ treeCheck.AddOption(pwszSection, LPGENW("Enable the 'event filter' for new rooms"), Chat::bFilterEnabled);
+ treeCheck.AddOption(pwszSection, LPGENW("Use IRC style status indicators in the log"), g_plugin.bLogClassicIndicators);
+ treeCheck.AddOption(pwszSection, LPGENW("Allow clickable user names in the message log"), g_plugin.bClickableNicks);
+ treeCheck.AddOption(pwszSection, LPGENW("Add new line after names"), g_plugin.bNewLineAfterNames);
+ treeCheck.AddOption(pwszSection, LPGENW("Colorize user names in message log"), g_plugin.bColorizeNicksInLog);
+ treeCheck.AddOption(pwszSection, LPGENW("Scale down icons to 10x10 pixels in the chat log"), g_plugin.bScaleIcons);
+ }
bool OnInitDialog() override
{
SetWindowLongPtr(treeCheck.GetHwnd(), GWL_STYLE, GetWindowLongPtr(treeCheck.GetHwnd(), GWL_STYLE) | (TVS_HASBUTTONS | TVS_CHECKBOXES | TVS_NOHSCROLL));
- TreeViewInit(treeCheck, lvGroupsChat, lvItemsChat, CHAT_MODULE);
-
if (mir_wstrlen(g_Settings.pwszAutoText))
edtAutocomplete.SetText(g_Settings.pwszAutoText);
@@ -558,8 +545,6 @@ public: replaceStrW(g_Settings.pwszAutoText, edtAutocomplete.GetText());
db_set_ws(0, CHAT_MODULE, "TextAutocomplete", g_Settings.pwszAutoText);
-
- TreeViewToDB(treeCheck, lvItemsChat, CHAT_MODULE, nullptr);
return true;
}
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 08277c5780..d2d7fdc31f 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -139,7 +139,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) TContainerData *pContainer = dat ? dat->m_pContainer : nullptr;
wchar_t *bbStart, *bbEnd;
- if (g_Settings.bBBCodeInPopups) {
+ if (g_plugin.bBBCodeInPopups) {
bbStart = L"[b]";
bbEnd = L"[/b]";
}
@@ -158,7 +158,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) if (dat && pContainer != nullptr) { // message window is open, need to check the container config if we want to see a popup nonetheless
if (NEN::bWindowCheck) { // no popups at all for open windows... no exceptions
- if (!PluginConfig.m_bHideOnClose)
+ if (!g_plugin.bHideOnClose)
return 0;
if (pContainer->m_bHidden)
goto passed;
@@ -228,17 +228,17 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (iMuteMode != CHATMODE_MUTE)
DoPopup(si, gce);
- if (g_Settings.bFlashWindowHighlight && bInactive)
+ if (Chat::bFlashWindowHighlight && bInactive)
bMustFlash = true;
bMustAutoswitch = true;
- if (g_Settings.bCreateWindowOnHighlight && dat == nullptr) {
+ if (g_plugin.bCreateWindowOnHighlight && dat == nullptr) {
Clist_ContactDoubleClicked(si->hContact);
bActiveTab = true;
bInactive = bMustAutoswitch = bMustFlash = false;
}
- if (dat && g_Settings.bAnnoyingHighlight && bInactive && dat->m_pContainer->m_hwnd != GetForegroundWindow()) {
+ if (dat && g_plugin.bAnnoyingHighlight && bInactive && dat->m_pContainer->m_hwnd != GetForegroundWindow()) {
bActiveTab = true;
bInactive = bMustAutoswitch = bMustFlash = false;
dat->ActivateTab();
@@ -269,7 +269,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (iEvent == GC_EVENT_MESSAGE) {
bMustAutoswitch = true;
- if (g_Settings.bFlashWindow)
+ if (Chat::bFlashWindow)
bMustFlash = true;
}
}
@@ -317,7 +317,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight // autoswitch tab..
if (bMustAutoswitch) {
- if ((IsIconic(dat->m_pContainer->m_hwnd)) && !IsZoomed(dat->m_pContainer->m_hwnd) && PluginConfig.m_bAutoSwitchTabs && dat->m_pContainer->m_hwndActive != dat->GetHwnd()) {
+ if ((IsIconic(dat->m_pContainer->m_hwnd)) && !IsZoomed(dat->m_pContainer->m_hwnd) && g_plugin.bAutoSwitchTabs && dat->m_pContainer->m_hwndActive != dat->GetHwnd()) {
int iItem = GetTabIndexFromHWND(dat->m_pContainer->m_hwndTabs, dat->GetHwnd());
if (iItem >= 0) {
TabCtrl_SetCurSel(dat->m_pContainer->m_hwndTabs, iItem);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 9b49ec16b9..c26ddddb23 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -405,7 +405,7 @@ void TContainerData::InitDialog(HWND hwndDlg) Configure();
// tab tooltips...
- if (!::ServiceExists(MS_TIPPER_SHOWTIPW) || M.GetByte("d_tooltips", 0) == 0) {
+ if (!::ServiceExists(MS_TIPPER_SHOWTIPW) || !g_plugin.bDetailedTooltips) {
m_hwndTip = ::CreateWindowEx(0, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, nullptr, g_plugin.getInst(), (LPVOID)nullptr);
@@ -2109,7 +2109,7 @@ panel_found: break;
case WM_CLOSE:
- if (PluginConfig.m_bHideOnClose && !lParam) {
+ if (g_plugin.bHideOnClose && !lParam) {
ShowWindow(hwndDlg, SW_HIDE);
pContainer->m_bHidden = true;
}
@@ -2297,9 +2297,9 @@ void TSAPI AutoCreateWindow(MCONTACT hContact, MEVENT hDbEvent) GetContainerNameForContact(hContact, szName, CONTAINER_NAMELEN);
bool bAllowAutoCreate = false;
- bool bAutoCreate = M.GetBool("autotabs", true);
- bool bAutoPopup = M.GetBool(SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP);
- bool bAutoContainer = M.GetBool("autocontainer", true);
+ bool bAutoCreate = g_plugin.bAutoTabs;
+ bool bAutoPopup = g_plugin.bAutoPopup;
+ bool bAutoContainer = g_plugin.bAutoContainer;
uint32_t dwStatusMask = M.GetDword("autopopupmask", -1);
if (dwStatusMask == -1)
@@ -2326,7 +2326,6 @@ void TSAPI AutoCreateWindow(MCONTACT hContact, MEVENT hDbEvent) return;
}
- bool bPopup = M.GetByte("cpopup", 0) != 0;
TContainerData *pContainer = FindContainerByName(szName);
if (pContainer != nullptr)
if (M.GetByte("limittabs", 0) && !wcsncmp(pContainer->m_wszName, L"default", 6))
@@ -2336,7 +2335,7 @@ void TSAPI AutoCreateWindow(MCONTACT hContact, MEVENT hDbEvent) pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, hContact);
if (pContainer != nullptr) {
- CreateNewTabForContact(pContainer, hContact, false, bPopup, true, hDbEvent);
+ CreateNewTabForContact(pContainer, hContact, false, g_plugin.bPopupContainer, true, hDbEvent);
return;
}
}
@@ -2400,18 +2399,18 @@ HMENU TSAPI BuildContainerMenu() void TSAPI CloseAllContainers()
{
- bool fOldHideSetting = PluginConfig.m_bHideOnClose;
+ bool fOldHideSetting = g_plugin.bHideOnClose;
while (pFirstContainer != nullptr) {
if (!IsWindow(pFirstContainer->m_hwnd))
pFirstContainer = pFirstContainer->pNext;
else {
- PluginConfig.m_bHideOnClose = false;
+ g_plugin.bHideOnClose = false;
::SendMessage(pFirstContainer->m_hwnd, WM_CLOSE, 0, 1);
}
}
- PluginConfig.m_bHideOnClose = fOldHideSetting;
+ g_plugin.bHideOnClose = fOldHideSetting;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 11e6bc1215..4e0d4dccaf 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -785,7 +785,7 @@ LONG_PTR CALLBACK CMsgDialog::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM rc.left = 0;
int iMaxSize = (int)dat->m_cache->getMaxMessageLength();
- if (!PluginConfig.m_autoSplit) {
+ if (!g_plugin.bAutoSplit) {
float fMax = (float)iMaxSize;
float uPercent = (float)dat->m_textLen / ((fMax / (float)100.0) ? (fMax / (float)100.0) : (float)75.0);
float fx = ((float)rc.right / (float)100.0) * uPercent;
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 48f4cb34a7..2236ad344a 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -243,7 +243,7 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara case IDC_PROTOMENU: submenu = GetSubMenu(PluginConfig.g_hMenuContext, 4); { - int iOldGlobalSendFormat = PluginConfig.m_SendFormat; + bool iOldGlobalSendFormat = g_plugin.bSendFormat; int iLocalFormat = M.GetDword(m_hContact, "sendformat", 0); int iNewLocalFormat = iLocalFormat; @@ -253,8 +253,8 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara CheckMenuItem(submenu, ID_MODE_PRIVATE, m_bSplitterOverride ? MF_CHECKED : MF_UNCHECKED); // formatting menu.. - CheckMenuItem(submenu, ID_GLOBAL_BBCODE, (PluginConfig.m_SendFormat) ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(submenu, ID_GLOBAL_OFF, (PluginConfig.m_SendFormat == SENDFORMAT_NONE) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(submenu, ID_GLOBAL_BBCODE, (g_plugin.bSendFormat) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(submenu, ID_GLOBAL_OFF, (g_plugin.bSendFormat == SENDFORMAT_NONE) ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(submenu, ID_THISCONTACT_GLOBALSETTING, (iLocalFormat == SENDFORMAT_NONE) ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(submenu, ID_THISCONTACT_BBCODE, (iLocalFormat > 0) ? MF_CHECKED : MF_UNCHECKED); @@ -281,11 +281,11 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara break; case ID_GLOBAL_BBCODE: - PluginConfig.m_SendFormat = SENDFORMAT_BBCODE; + g_plugin.bSendFormat = SENDFORMAT_BBCODE; break; case ID_GLOBAL_OFF: - PluginConfig.m_SendFormat = SENDFORMAT_NONE; + g_plugin.bSendFormat = SENDFORMAT_NONE; break; case ID_THISCONTACT_GLOBALSETTING: @@ -306,10 +306,8 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara else if (iNewLocalFormat != iLocalFormat) db_set_dw(m_hContact, SRMSGMOD_T, "sendformat", iNewLocalFormat); - if (PluginConfig.m_SendFormat != iOldGlobalSendFormat) - db_set_b(0, SRMSGMOD_T, "sendformat", (uint8_t)PluginConfig.m_SendFormat); - if (iNewLocalFormat != iLocalFormat || PluginConfig.m_SendFormat != iOldGlobalSendFormat) { - m_SendFormat = M.GetDword(m_hContact, "sendformat", PluginConfig.m_SendFormat); + if (iNewLocalFormat != iLocalFormat || g_plugin.bSendFormat != iOldGlobalSendFormat) { + m_SendFormat = M.GetDword(m_hContact, "sendformat", g_plugin.bSendFormat); if (m_SendFormat == -1) // per contact override to disable it.. m_SendFormat = 0; Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 1); @@ -695,7 +693,7 @@ HWND CMsgDialog::DM_CreateClist() SetWindowLongPtr(hwndClist, GWL_EXSTYLE, GetWindowLongPtr(hwndClist, GWL_EXSTYLE) & ~CLS_EX_TRACKSELECT); SetWindowLongPtr(hwndClist, GWL_EXSTYLE, GetWindowLongPtr(hwndClist, GWL_EXSTYLE) | (CLS_EX_NOSMOOTHSCROLLING | CLS_EX_NOTRANSLUCENTSEL)); - if (!PluginConfig.m_bAllowOfflineMultisend) + if (!g_plugin.bAllowOfflineMultisend) SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) | CLS_HIDEOFFLINE); if (hItem) @@ -1028,10 +1026,9 @@ int CMsgDialog::DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam) void CMsgDialog::DM_AddDivider() { - if (!m_bDividerSet && PluginConfig.m_bUseDividers) { + if (!m_bDividerSet && g_plugin.bUseDividers) if (GetWindowTextLength(m_pLog->GetHwnd()) > 0) m_bDividerSet = m_bDividerWanted = true; - } } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1068,11 +1065,11 @@ void CMsgDialog::DM_EventAdded(WPARAM, LPARAM lParam) // set the message log divider to mark new (maybe unseen) messages, if the container has // been minimized or in the background. if (!(dbei.flags & DBEF_SENT) && !bIsStatusChangeEvent) { - if (PluginConfig.m_bDividersUsePopupConfig && PluginConfig.m_bUseDividers) { + if (g_plugin.bDividersUsePopupConfig && g_plugin.bUseDividers) { if (!MessageWindowOpened(m_hContact, nullptr)) DM_AddDivider(); } - else if (PluginConfig.m_bUseDividers) { + else if (g_plugin.bUseDividers) { if (!m_pContainer->IsActive()) DM_AddDivider(); else if (m_pContainer->m_hwndActive != m_hwnd) @@ -1114,8 +1111,8 @@ void CMsgDialog::DM_EventAdded(WPARAM, LPARAM lParam) // autoswitch tab if option is set AND container is minimized (otherwise, we never autoswitch) // never switch for status changes... if (!(dbei.flags & DBEF_SENT) && !bIsStatusChangeEvent) { - if (PluginConfig.m_bAutoSwitchTabs && m_pContainer->m_hwndActive != m_hwnd) { - if ((IsIconic(m_pContainer->m_hwnd) && !IsZoomed(m_pContainer->m_hwnd)) || (PluginConfig.m_bHideOnClose && !IsWindowVisible(m_pContainer->m_hwnd))) { + if (g_plugin.bAutoSwitchTabs && m_pContainer->m_hwndActive != m_hwnd) { + if ((IsIconic(m_pContainer->m_hwnd) && !IsZoomed(m_pContainer->m_hwnd)) || (g_plugin.bHideOnClose && !IsWindowVisible(m_pContainer->m_hwnd))) { int iItem = GetTabIndexFromHWND(GetParent(m_hwnd), m_hwnd); if (iItem >= 0) { TabCtrl_SetCurSel(m_hwndParent, iItem); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index dcf827104c..953996a5cd 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -120,14 +120,8 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_ncm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &m_ncm, 0);
- m_bAutoSwitchTabs = M.GetBool("autoswitchtabs", true);
m_iTabNameLimit = db_get_w(0, SRMSGMOD_T, "cut_at", 15);
m_bCutContactNameOnTabs = M.GetBool("cuttitle", false);
- m_bStatusOnTabs = M.GetBool("tabstatus", true);
- m_bLogStatusChanges = M.GetBool("logstatuschanges", false);
- m_bUseSameSplitSize = M.GetBool("usesamesplitsize", true);
- m_bUseDividers = M.GetBool("usedividers", false);
- m_bDividersUsePopupConfig = M.GetBool("div_popupconfig", false);
m_MsgTimeout = g_plugin.getDword(SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
if (m_MsgTimeout < SRMSGSET_MSGTIMEOUT_MIN)
@@ -135,21 +129,14 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_EscapeCloses = M.GetByte("escmode", 0);
- m_bHideOnClose = M.GetBool("hideonclose", false);
- m_bAllowTab = M.GetBool("tabmode", false);
-
- m_bFlashOnClist = M.GetBool("flashcl", false);
m_bAlwaysFullToolbarWidth = M.GetBool("alwaysfulltoolbar", true);
m_LimitStaticAvatarHeight = M.GetDword("avatarheight", 96);
- m_SendFormat = M.GetByte("sendformat", 0);
m_panelHeight = (uint32_t)M.GetDword("panelheight", CInfoPanel::DEGRADE_THRESHOLD);
m_MUCpanelHeight = db_get_dw(0, CHAT_MODULE, "panelheight", CInfoPanel::DEGRADE_THRESHOLD);
m_bIdleDetect = M.GetBool("dimIconsForIdleContacts", true);
m_smcxicon = m_smcyicon = 16;
- m_PasteAndSend = M.GetByte("pasteandsend", 1);
m_LangPackCP = Langpack_GetDefaultCodePage();
m_visualMessageSizeIndicator = M.GetByte("msgsizebar", 0);
- m_autoSplit = M.GetByte("autosplit", 0);
m_FlashOnMTN = g_plugin.getByte(SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH);
if (m_MenuBar == nullptr) {
m_MenuBar = ::LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENUBAR));
@@ -194,7 +181,6 @@ void CGlobals::reloadAdv() g_plugin.addSound("SoundOnTyping", LPGENW("Other"), LPGENW("TabSRMM: typing"));
m_TypingSoundAdded = true;
}
- m_bAllowOfflineMultisend = M.GetBool("AllowOfflineMultisend", true);
}
const HMENU CGlobals::getMenuBar()
@@ -498,7 +484,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) return;
MCONTACT hContact = c->getContact();
- if (!PluginConfig.m_bLogStatusChanges && !M.GetByte(hContact, "logstatuschanges", 0))
+ if (!g_plugin.bLogStatusChanges && !M.GetByte(hContact, "logstatuschanges", 0))
return;
// don't log them if WE are logging off
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index e9c91009e7..fb52d01df2 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -78,24 +78,13 @@ public: // dynamic options, need reload when options change
int m_iTabNameLimit;
- bool m_bAllowTab;
- bool m_bAutoSwitchTabs;
bool m_bCutContactNameOnTabs;
- bool m_bHideOnClose;
- bool m_bStatusOnTabs;
- bool m_bLogStatusChanges;
- bool m_bUseSameSplitSize;
- bool m_bUseDividers;
- bool m_bDividersUsePopupConfig;
- bool m_bAllowOfflineMultisend;
- bool m_bFlashOnClist;
bool m_bAlwaysFullToolbarWidth;
bool m_bIdleDetect;
int m_MsgTimeout;
int m_EscapeCloses;
int m_LimitStaticAvatarHeight;
- int m_SendFormat;
int m_UnreadInTray;
int m_TrayFlashes;
int m_TrayFlashState;
@@ -107,7 +96,6 @@ public: myTabCtrl tabConfig;
int m_panelHeight, m_MUCpanelHeight;
int m_smcxicon, m_smcyicon;
- int m_PasteAndSend;
COLORREF crIncoming, crOutgoing, crOldIncoming, crOldOutgoing, crStatus;
BOOL bUnicodeBuild;
HFONT hFontCaption;
@@ -115,7 +103,6 @@ public: uint8_t m_SmileyButtonOverride;
HICON m_AnimTrayIcons[4];
BOOL m_visualMessageSizeIndicator;
- BOOL m_autoSplit;
BOOL m_FlashOnMTN;
uint32_t dwThreadID;
MWindowList m_hMessageWindowList, hUserPrefsWindowList;
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 2cc217774a..ebbd290ec5 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -119,7 +119,7 @@ static INT_PTR HotkeyProcessor(WPARAM, LPARAM lParam) SetFocus(GetDlgItem(pLastActiveContainer->m_hwndActive, IDC_SRMM_MESSAGE));
}
else {
- if (PluginConfig.m_bHideOnClose)
+ if (g_plugin.bHideOnClose)
ShowWindow(pLastActiveContainer->m_hwnd, SW_HIDE);
else
SendMessage(pLastActiveContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 2b394e14ba..cc7bed95c6 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -488,7 +488,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem) }
else str = tszUin;
- if (M.GetByte("ShowClientDescription", 1)) {
+ if (g_plugin.bShowDesc) {
ptrW szVersion(db_get_wsa(m_dat->m_cache->getActiveContact(), m_dat->m_cache->getActiveProto(), "MirVer"));
if (szVersion)
str.AppendFormat(TranslateT(" Client: %s"), szVersion.get());
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 01a02eaf28..736c9c5e86 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -271,7 +271,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM nSecs) if (pDlg == nullptr) fShow = true; else { - if (PluginConfig.m_bHideOnClose) { + if (g_plugin.bHideOnClose) { TContainerData *pCont = pDlg->m_pContainer; if (pCont && pCont->m_bHidden) fShow = true; @@ -407,13 +407,13 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) g_clistApi.pfnRemoveEvent(hContact, 1); - bool bAutoPopup = M.GetBool(SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP); - bool bAutoCreate = M.GetBool("autotabs", true); - bool bAutoContainer = M.GetBool("autocontainer", true); + bool bAutoPopup = g_plugin.bAutoPopup; + bool bAutoCreate = g_plugin.bAutoTabs; + bool bAutoContainer = g_plugin.bAutoContainer; if (pDlg) { TContainerData *pTargetContainer = pDlg->m_pContainer; - if (pTargetContainer == nullptr || !PluginConfig.m_bHideOnClose || IsWindowVisible(pTargetContainer->m_hwnd)) + if (pTargetContainer == nullptr || !g_plugin.bHideOnClose || IsWindowVisible(pTargetContainer->m_hwnd)) return 0; WINDOWPLACEMENT wp = { 0 }; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 7d594156d8..9d66f8c95e 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -248,7 +248,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM GetClientRect(hwnd, &rc);
int selection;
- if (PluginConfig.m_bUseSameSplitSize)
+ if (g_plugin.bUseSameSplitSize)
selection = ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS;
else if (dat->m_bIsAutosizingInput)
selection = ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION;
@@ -676,7 +676,7 @@ void CMsgDialog::OnDestroy() if (m_pContainer->cfg.flags.m_bSideBar)
m_pContainer->m_pSideBar->removeSession(this);
- if (M.GetByte("deletetemp", 0))
+ if (g_plugin.bDeleteTemp)
if (!Contact::OnList(m_hContact))
db_delete_contact(m_hContact);
@@ -1027,7 +1027,7 @@ void CMsgDialog::onDblClick_List(CCtrlListBox *pList) return;
bool bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
- if (g_Settings.bDoubleClick4Privat ? bShift : !bShift) {
+ if (Chat::bDoubleClick4Privat ? bShift : !bShift) {
int selStart = LOWORD(m_message.SendMsg(EM_GETSEL, 0, 0));
CMStringW tszName(ui->pszNick);
if (selStart == 0 && mir_wstrlen(g_Settings.pwszAutoText))
@@ -1593,7 +1593,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) // tabulation mod
if (msg == WM_KEYDOWN && wp == VK_TAB) {
- if (PluginConfig.m_bAllowTab) {
+ if (g_plugin.bAllowTab) {
if (pFilter->nmhdr.idFrom == IDC_SRMM_MESSAGE)
m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)"\t");
_clrMsgFilter(pFilter);
@@ -1701,7 +1701,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) // to the clipboard.
// holding ctrl while releasing the button pastes the selection to the input area, using plain text
// holding ctrl-alt does the same, but pastes formatted text
- if (pFilter->nmhdr.idFrom == IDC_SRMM_LOG && M.GetByte("autocopy", 1)) {
+ if (pFilter->nmhdr.idFrom == IDC_SRMM_LOG && g_plugin.bAutoCopy) {
CHARRANGE cr;
LOG()->WndProc(EM_EXGETSEL, 0, (LPARAM)&cr);
if (cr.cpMax == cr.cpMin)
@@ -1773,7 +1773,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) case WM_CHAR:
KbdState(isShift, isCtrl, isAlt);
- if (!isAlt && !isCtrl && !m_pContainer->cfg.flags.m_bNoSound && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_bAllowTab))
+ if (!isAlt && !isCtrl && !m_pContainer->cfg.flags.m_bNoSound && wParam != VK_ESCAPE && !(wParam == VK_TAB && g_plugin.bAllowTab))
Skin_PlaySound("SoundOnTyping");
break;
@@ -1823,7 +1823,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) // tab-autocomplete
if (wParam == VK_TAB && !isCtrl && !isShift) {
// if tab acts as a key pressing, simply do nothing
- if (PluginConfig.m_bAllowTab)
+ if (g_plugin.bAllowTab)
break;
m_message.SetDraw(false);
@@ -2925,7 +2925,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return TRUE;
case 2: // close or hide, optionally
- if (PluginConfig.m_bHideOnClose) {
+ if (g_plugin.bHideOnClose) {
ShowWindow(m_pContainer->m_hwnd, SW_HIDE);
return TRUE;
}
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 65e2189083..327439ab00 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -43,8 +43,8 @@ void CMsgDialog::ActivateTooltip(int iCtrlId, const wchar_t *pwszMessage) void CMsgDialog::AddLog() { - if (PluginConfig.m_bUseDividers) { - if (PluginConfig.m_bDividersUsePopupConfig) { + if (g_plugin.bUseDividers) { + if (g_plugin.bDividersUsePopupConfig) { if (!MessageWindowOpened(0, this)) DM_AddDivider(); } @@ -548,7 +548,7 @@ void CMsgDialog::FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei) if (hEvent == 0) return; - if (!PluginConfig.m_bFlashOnClist) + if (!g_plugin.bFlashOnClist) return; if ((GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE && !m_bFlashClist) { @@ -957,9 +957,9 @@ void CMsgDialog::GetClientIcon() ///////////////////////////////////////////////////////////////////////////////////////// -HICON CMsgDialog::GetMyContactIcon(LPCSTR szSetting) +HICON CMsgDialog::GetMyContactIcon(const CMOption<bool> *opt) { - int bUseMeta = (szSetting == nullptr) ? false : M.GetByte(szSetting, mir_strcmp(szSetting, "MetaiconTab") == 0); + int bUseMeta = (opt == nullptr) ? false : M.GetByte(opt->GetDBSettingName(), mir_strcmp(opt->GetDBSettingName(), "MetaiconTab") == 0); if (bUseMeta) return Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()); return Skin_LoadProtoIcon(m_cache->getActiveProto(), m_cache->getActiveStatus()); @@ -1008,11 +1008,11 @@ LRESULT CMsgDialog::GetSendButtonState() void CMsgDialog::GetSendFormat() { - m_SendFormat = M.GetDword(m_hContact, "sendformat", PluginConfig.m_SendFormat); + m_SendFormat = M.GetDword(m_hContact, "sendformat", g_plugin.bSendFormat); if (m_SendFormat == -1) // per contact override to disable it.. m_SendFormat = 0; else if (m_SendFormat == 0) - m_SendFormat = PluginConfig.m_SendFormat ? 1 : 0; + m_SendFormat = g_plugin.bSendFormat; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1035,7 +1035,7 @@ HICON CMsgDialog::GetXStatusIcon() const void CMsgDialog::HandlePasteAndSend() { // is feature disabled? - if (!PluginConfig.m_PasteAndSend) { + if (!g_plugin.bPasteAndSend) { ActivateTooltip(IDC_SRMM_MESSAGE, TranslateT("The 'paste and send' feature is disabled. You can enable it on the 'General' options page in the 'Sending messages' section")); return; } @@ -1544,7 +1544,7 @@ int CMsgDialog::MsgWindowMenuHandler(int selection, int menuId) void CMsgDialog::NotifyDeliveryFailure() const { - if (!M.GetByte("adv_ErrorPopups", 1) || !Popup_Enabled()) + if (!g_plugin.bErrorPopup || !Popup_Enabled()) return; POPUPDATAW ppd = {}; @@ -1992,7 +1992,7 @@ void CMsgDialog::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) else { hSubMenu = GetSubMenu(hMenu, 2); EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, m_SendFormat != 0 ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(hSubMenu, ID_EDITOR_PASTEANDSENDIMMEDIATELY, PluginConfig.m_PasteAndSend ? MF_ENABLED : MF_GRAYED); + EnableMenuItem(hSubMenu, ID_EDITOR_PASTEANDSENDIMMEDIATELY, g_plugin.bPasteAndSend ? MF_ENABLED : MF_GRAYED); CheckMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, PluginConfig.m_visualMessageSizeIndicator ? MF_CHECKED : MF_UNCHECKED); EnableMenuItem(hSubMenu, ID_EDITOR_SHOWMESSAGELENGTHINDICATOR, m_pContainer->m_hwndStatus ? MF_ENABLED : MF_GRAYED); } @@ -2612,7 +2612,7 @@ void CMsgDialog::UpdateTitle() Utils::DoubleAmpersands(newcontactname, _countof(newcontactname)); if (newcontactname[0] != 0) { - if (PluginConfig.m_bStatusOnTabs) + if (g_plugin.bStatusOnTabs) mir_snwprintf(newtitle, L"%s (%s)", newcontactname, m_wszStatus); else wcsncpy_s(newtitle, newcontactname, _TRUNCATE); @@ -2681,12 +2681,12 @@ void CMsgDialog::UpdateWindowIcon() } if (LPCSTR szProto = m_cache->getProto()) { - m_hTabIcon = m_hTabStatusIcon = GetMyContactIcon("MetaiconTab"); - if (M.GetByte("use_xicons", 1)) + m_hTabIcon = m_hTabStatusIcon = GetMyContactIcon(&g_plugin.bMetaTab); + if (g_plugin.bUseXStatus) m_hXStatusIcon = GetXStatusIcon(); SendDlgItemMessage(m_hwnd, IDC_PROTOCOL, BUTTONSETASDIMMED, m_bIsIdle, 0); - SendDlgItemMessage(m_hwnd, IDC_PROTOCOL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(m_hXStatusIcon ? m_hXStatusIcon : GetMyContactIcon("MetaiconBar"))); + SendDlgItemMessage(m_hwnd, IDC_PROTOCOL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(m_hXStatusIcon ? m_hXStatusIcon : GetMyContactIcon(&g_plugin.bMetaBar))); if (m_pContainer->m_hwndActive == m_hwnd) m_pContainer->SetIcon(this, m_hXStatusIcon ? m_hXStatusIcon : m_hTabIcon); diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 94d10c83eb..b4143a69a6 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1090,7 +1090,8 @@ INT_PTR CLogWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam) POINT pt = { LOWORD(lParam), HIWORD(lParam) };
CheckCustomLink(m_rtf.GetHwnd(), &pt, msg, wParam, lParam, TRUE);
}
- if (M.GetByte("autocopy", 1)) {
+
+ if (g_plugin.bAutoCopy) {
CHARRANGE sel;
SendMessage(m_rtf.GetHwnd(), EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 9ba3a141b1..a0011fb2eb 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -31,97 +31,6 @@ #define DM_GETSTATUSMASK (WM_USER + 10)
/////////////////////////////////////////////////////////////////////////////////////////
-
-void TreeViewInit(CCtrlTreeView &ctrl, TOptionListGroup *lvGroups, TOptionListItem *lvItems, const char *DBPath, uint32_t dwFlags, bool bFromMem)
-{
- SetWindowLongPtr(ctrl.GetHwnd(), GWL_STYLE, GetWindowLongPtr(ctrl.GetHwnd(), GWL_STYLE) | (TVS_HASBUTTONS | TVS_CHECKBOXES | TVS_NOHSCROLL));
-
- // fill the list box, create groups first, then add items
- TVINSERTSTRUCT tvi = {};
- for (int i = 0; lvGroups[i].szName != nullptr; i++) {
- tvi.hParent = nullptr;
- tvi.hInsertAfter = TVI_LAST;
- tvi.item.mask = TVIF_TEXT | TVIF_STATE;
- tvi.item.pszText = TranslateW(lvGroups[i].szName);
- tvi.item.stateMask = TVIS_EXPANDED | TVIS_BOLD;
- tvi.item.state = TVIS_EXPANDED | TVIS_BOLD;
- lvGroups[i].handle = ctrl.InsertItem(&tvi);
-
- ctrl.SetItemState(lvGroups[i].handle, 0, TVIS_STATEIMAGEMASK);
- }
-
- for (auto *p = lvItems; p->szName != nullptr; p++) {
- tvi.hParent = (HTREEITEM)lvGroups[p->uGroup].handle;
- tvi.hInsertAfter = TVI_LAST;
- tvi.item.pszText = TranslateW(p->szName);
- tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
- tvi.item.lParam = p - lvItems;
- p->handle = ctrl.InsertItem(&tvi);
-
- bool bCheck = false;
- if (bFromMem == false) {
- switch (p->uType) {
- case LOI_TYPE_FLAG:
- bCheck = (dwFlags & (UINT)p->lParam) != 0;
- break;
- case LOI_TYPE_SETTING:
- bCheck = db_get_b(0, DBPath, (char *)p->lParam, p->id) != 0;
- break;
- }
- }
- else {
- switch (p->uType) {
- case LOI_TYPE_FLAG:
- bCheck = ((*((UINT *)p->lParam)) & p->id) != 0;
- break;
- case LOI_TYPE_SETTING:
- bCheck = *((BOOL *)p->lParam) != 0;
- break;
- }
- }
- ctrl.SetCheckState(p->handle, bCheck);
- }
-}
-
-void TreeViewSetFromDB(CCtrlTreeView &ctrl, TOptionListItem *lvItems, uint32_t dwFlags)
-{
- for (auto *p = lvItems; p->szName != nullptr; p++) {
- bool bCheck = false;
- if (p->uType == LOI_TYPE_FLAG)
- bCheck = (dwFlags & (UINT)p->lParam) != 0;
- else if (p->uType == LOI_TYPE_SETTING)
- bCheck = M.GetByte((char *)p->lParam, p->id) != 0;
- ctrl.SetCheckState(p->handle, bCheck);
- }
-}
-
-void TreeViewToDB(CCtrlTreeView &ctrl, TOptionListItem *lvItems, const char *DBPath, uint32_t *dwFlags)
-{
- for (auto *p = lvItems; p->szName != nullptr; p++) {
- UINT iState = ctrl.GetCheckState(p->handle);
-
- switch (p->uType) {
- case LOI_TYPE_FLAG:
- if (dwFlags != nullptr)
- (*dwFlags) |= (iState == 1) ? p->lParam : 0;
- if (DBPath == nullptr) {
- UINT *tm = (UINT*)p->lParam;
- (*tm) = (iState == 1) ? ((*tm) | p->id) : ((*tm) & ~p->id);
- }
- break;
- case LOI_TYPE_SETTING:
- if (DBPath != nullptr) {
- db_set_b(0, DBPath, (char *)p->lParam, iState == 1);
- }
- else {
- (*((BOOL*)p->lParam)) = iState == 1;
- }
- break;
- }
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// options dialog for setting up tab options
/////////////////////////////////////////////////////////////////////////////////////////
@@ -466,34 +375,12 @@ public: /////////////////////////////////////////////////////////////////////////////////////////
// Main options dialog
-static TOptionListGroup lvGroupsMsg[] =
-{
- { 0, LPGENW("Message window behavior") },
- { 0, LPGENW("Sending messages") },
- { 0, LPGENW("Other options") },
- { 0, nullptr }
-};
-
-static TOptionListItem lvItemsMsg[] =
-{
- { 0, LPGENW("Minimize the message window on send"), SRMSGDEFSET_AUTOMIN, LOI_TYPE_SETTING, (UINT_PTR)SRMSGSET_AUTOMIN, 1 },
- { 0, LPGENW("Close the message window on send"), 0, LOI_TYPE_SETTING, (UINT_PTR)"AutoClose", 1 },
- { 0, LPGENW("Always flash contact list and tray icon for new messages"), 0, LOI_TYPE_SETTING, (UINT_PTR)"flashcl", 0 },
- { 0, LPGENW("Delete temporary contacts on close"), 0, LOI_TYPE_SETTING, (UINT_PTR)"deletetemp", 0 },
- { 0, LPGENW("Enable \"Paste and send\" feature"), 0, LOI_TYPE_SETTING, (UINT_PTR)"pasteandsend", 1 },
- { 0, LPGENW("Allow BBCode formatting in outgoing messages"), 0, LOI_TYPE_SETTING, (UINT_PTR)"sendformat", 1 },
- { 0, LPGENW("Automatically split long messages (experimental, use with care)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"autosplit", 2 },
- { 0, LPGENW("Use the same splitter height for all sessions"), 1, LOI_TYPE_SETTING, (UINT_PTR)"usesamesplitsize", 2 },
- { 0, LPGENW("Automatically copy selected text"), 1, LOI_TYPE_SETTING, (UINT_PTR)"autocopy", 2 },
- { 0, nullptr, 0, 0, 0, 0 }
-};
-
class COptMainDlg : public CDlgBase
{
CCtrlSpin spnAvaSize;
CCtrlCheck chkAvaPreserve;
CCtrlButton btnReset;
- CCtrlTreeView treeOpts;
+ CCtrlTreeOpts treeOpts;
CCtrlHyperlink urlHelp;
public:
@@ -506,12 +393,25 @@ public: chkAvaPreserve(this, IDC_PRESERVEAVATARSIZE)
{
btnReset.OnClick = Callback(this, &COptMainDlg::onClick_Reset);
+
+ auto *pwszSection = LPGENW("Message window behavior");
+ treeOpts.AddOption(pwszSection, LPGENW("Always flash contact list and tray icon for new messages"), g_plugin.bFlashOnClist);
+ treeOpts.AddOption(pwszSection, LPGENW("Delete temporary contacts on close"), g_plugin.bDeleteTemp);
+
+ pwszSection = LPGENW("Sending messages");
+ treeOpts.AddOption(pwszSection, LPGENW("Minimize the message window on send"), g_plugin.bAutoMin);
+ treeOpts.AddOption(pwszSection, LPGENW("Close the message window on send"), g_plugin.bAutoClose);
+ treeOpts.AddOption(pwszSection, LPGENW("Enable \"Paste and send\" feature"), g_plugin.bPasteAndSend);
+ treeOpts.AddOption(pwszSection, LPGENW("Allow BBCode formatting in outgoing messages"), g_plugin.bSendFormat);
+
+ pwszSection = LPGENW("Other options");
+ treeOpts.AddOption(pwszSection, LPGENW("Automatically split long messages (experimental, use with care)"), g_plugin.bAutoSplit);
+ treeOpts.AddOption(pwszSection, LPGENW("Use the same splitter height for all sessions"), g_plugin.bUseSameSplitSize);
+ treeOpts.AddOption(pwszSection, LPGENW("Automatically copy selected text"), g_plugin.bAutoCopy);
}
bool OnInitDialog() override
{
- TreeViewInit(treeOpts, lvGroupsMsg, lvItemsMsg, SRMSGMOD_T);
-
chkAvaPreserve.SetState(M.GetByte("dontscaleavatars", 0));
spnAvaSize.SetPosition(M.GetDword("avatarheight", 100));
@@ -523,8 +423,6 @@ public: db_set_dw(0, SRMSGMOD_T, "avatarheight", spnAvaSize.GetPosition());
db_set_b(0, SRMSGMOD_T, "dontscaleavatars", chkAvaPreserve.GetState());
- // scan the tree view and obtain the options...
- TreeViewToDB(treeOpts, lvItemsMsg, SRMSGMOD_T, nullptr);
PluginConfig.reloadSettings();
Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0);
return true;
@@ -829,46 +727,14 @@ public: static UINT __ctrls[] = { IDC_INDENTSPIN, IDC_RINDENTSPIN, IDC_INDENTAMOUNT, IDC_RIGHTINDENT, IDC_MODIFY, IDC_RTLMODIFY };
-static TOptionListGroup lvGroupsLog[] =
-{
- { 0, LPGENW("Message log appearance") },
- { 0, LPGENW("Support for external plugins") },
- { 0, LPGENW("Timestamp settings (note: timestamps also depend on your templates)") },
- { 0, LPGENW("Message log icons") },
- { 0, nullptr }
-};
-
-static TOptionListItem lvItemsLog[] =
-{
- { 0, LPGENW("Show timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWTIME, 2 },
- { 0, LPGENW("Show dates in timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWDATES, 2 },
- { 0, LPGENW("Show seconds in timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWSECONDS, 2 },
- { 0, LPGENW("Use contacts local time (if timezone info available)"), 0, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_LOCALTIME, 2 },
- { 0, LPGENW("Draw grid lines"), 1, LOI_TYPE_FLAG, MWF_LOG_GRID, 0 },
- { 0, LPGENW("Log status changes"), 0, LOI_TYPE_SETTING, (UINT_PTR)"logstatuschanges", 0 },
- { 0, LPGENW("Event type icons in the message log"), 1, LOI_TYPE_FLAG, MWF_LOG_SHOWICONS, 3 },
- { 0, LPGENW("Text symbols as event markers"), 0, LOI_TYPE_FLAG, MWF_LOG_SYMBOLS, 3 },
- { 0, LPGENW("Use incoming/outgoing icons"), 1, LOI_TYPE_FLAG, MWF_LOG_INOUTICONS, 3 },
- { 0, LPGENW("Use message grouping"), 1, LOI_TYPE_FLAG, MWF_LOG_GROUPMODE, 0 },
- { 0, LPGENW("Indent message body"), 1, LOI_TYPE_FLAG, MWF_LOG_INDENT, 0 },
- { 0, LPGENW("Simple text formatting (*bold*, etc.)"), 0, LOI_TYPE_FLAG, MWF_LOG_TEXTFORMAT, 0 },
- { 0, LPGENW("Support BBCode formatting"), 1, LOI_TYPE_FLAG, MWF_LOG_BBCODE, 0 },
- { 0, LPGENW("Place a separator in the log after a window lost its foreground status"), 0, LOI_TYPE_SETTING, (UINT_PTR)"usedividers", 0 },
- { 0, LPGENW("Only place a separator when an incoming event is announced with a popup"), 0, LOI_TYPE_SETTING, (UINT_PTR)"div_popupconfig", 0 },
- { 0, LPGENW("RTL is default text direction"), 0, LOI_TYPE_FLAG, MWF_LOG_RTL, 0 },
- { 0, LPGENW("Show events at the new line (IEView Compatibility Mode)"), 1, LOI_TYPE_FLAG, MWF_LOG_NEWLINE, 1 },
- { 0, LPGENW("Underline timestamp/nickname (IEView Compatibility Mode)"), 0, LOI_TYPE_FLAG, MWF_LOG_UNDERLINE, 1 },
- { 0, LPGENW("Show timestamp after nickname (IEView Compatibility Mode)"), 0, LOI_TYPE_FLAG, MWF_LOG_SWAPNICK, 1 },
- { 0, LPGENW("Use normal templates (uncheck to use simple templates if your template set supports them)"), 1, LOI_TYPE_FLAG, MWF_LOG_NORMALTEMPLATES, 0 },
- { 0, nullptr, 0, 0, 0, 0 }
-};
-
class COptLogDlg : public CDlgBase
{
CCtrlSpin spnLeft, spnRight, spnLoadCount, spnLoadTime, spnTrim;
CCtrlCheck chkAlwaysTrim, chkLoadUnread, chkLoadCount, chkLoadTime;
CCtrlButton btnModify, btnRtlModify;
- CCtrlTreeView logOpts;
+ CCtrlTreeOpts logOpts;
+
+ uint32_t m_flags;
// configure the option page - hide most of the settings here when either IEView
// or H++ is set as the global message log viewer. Showing these options may confuse
@@ -896,12 +762,40 @@ public: chkAlwaysTrim.OnChange = Callback(this, &COptLogDlg::onChange_Trim);
chkLoadTime.OnChange = chkLoadCount.OnChange = chkLoadUnread.OnChange = Callback(this, &COptLogDlg::onChange_Load);
+
+ m_flags = M.GetDword("mwflags", MWF_LOG_DEFAULT) & MWF_LOG_ALL;
+
+ auto *pwszSection = LPGENW("Message log appearance");
+ logOpts.AddOption(pwszSection, LPGENW("Draw grid lines"), m_flags, MWF_LOG_GRID);
+ logOpts.AddOption(pwszSection, LPGENW("Log status changes"), g_plugin.bLogStatusChanges);
+ logOpts.AddOption(pwszSection, LPGENW("Use message grouping"), m_flags, MWF_LOG_GROUPMODE);
+ logOpts.AddOption(pwszSection, LPGENW("Indent message body"), m_flags, MWF_LOG_INDENT);
+ logOpts.AddOption(pwszSection, LPGENW("Simple text formatting (*bold*, etc.)"), m_flags, MWF_LOG_TEXTFORMAT);
+ logOpts.AddOption(pwszSection, LPGENW("Support BBCode formatting"), m_flags, MWF_LOG_BBCODE);
+ logOpts.AddOption(pwszSection, LPGENW("Place a separator in the log after a window lost its foreground status"), g_plugin.bUseDividers);
+ logOpts.AddOption(pwszSection, LPGENW("Only place a separator when an incoming event is announced with a popup"), g_plugin.bDividersUsePopupConfig);
+ logOpts.AddOption(pwszSection, LPGENW("RTL is default text direction"), m_flags, MWF_LOG_RTL);
+ logOpts.AddOption(pwszSection, LPGENW("Use normal templates (uncheck to use simple templates if your template set supports them)"), m_flags, MWF_LOG_NORMALTEMPLATES);
+
+ pwszSection = LPGENW("Support for external plugins");
+ logOpts.AddOption(pwszSection, LPGENW("Show events at the new line (IEView Compatibility Mode)"), m_flags, MWF_LOG_NEWLINE);
+ logOpts.AddOption(pwszSection, LPGENW("Underline timestamp/nickname (IEView Compatibility Mode)"), m_flags, MWF_LOG_UNDERLINE);
+ logOpts.AddOption(pwszSection, LPGENW("Show timestamp after nickname (IEView Compatibility Mode)"), m_flags, MWF_LOG_SWAPNICK);
+
+ pwszSection = LPGENW("Timestamp settings (note: timestamps also depend on your templates)");
+ logOpts.AddOption(pwszSection, LPGENW("Show timestamps"), m_flags, MWF_LOG_SHOWTIME);
+ logOpts.AddOption(pwszSection, LPGENW("Show dates in timestamps"), m_flags, MWF_LOG_SHOWDATES);
+ logOpts.AddOption(pwszSection, LPGENW("Show seconds in timestamps"), m_flags, MWF_LOG_SHOWSECONDS);
+ logOpts.AddOption(pwszSection, LPGENW("Use contacts local time (if timezone info available)"), m_flags, MWF_LOG_LOCALTIME);
+
+ pwszSection = LPGENW("Message log icons");
+ logOpts.AddOption(pwszSection, LPGENW("Event type icons in the message log"), m_flags, MWF_LOG_SHOWICONS);
+ logOpts.AddOption(pwszSection, LPGENW("Text symbols as event markers"), m_flags, MWF_LOG_SYMBOLS);
+ logOpts.AddOption(pwszSection, LPGENW("Use incoming/outgoing icons"), m_flags, MWF_LOG_INOUTICONS);
}
bool OnInitDialog() override
{
- uint32_t dwFlags = M.GetDword("mwflags", MWF_LOG_DEFAULT);
-
switch (g_plugin.getByte(SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
case LOADHISTORY_UNREAD:
chkLoadUnread.SetState(true);
@@ -919,8 +813,6 @@ public: break;
}
- TreeViewInit(logOpts, lvGroupsLog, lvItemsLog, SRMSGMOD_T, dwFlags);
-
spnLeft.SetPosition(M.GetDword("IndentAmount", 20));
spnRight.SetPosition(M.GetDword("RightIndent", 20));
spnLoadCount.SetPosition(g_plugin.getWord(SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT));
@@ -936,9 +828,8 @@ public: bool OnApply() override
{
- uint32_t dwFlags = M.GetDword("mwflags", MWF_LOG_DEFAULT);
-
- dwFlags &= ~(MWF_LOG_ALL);
+ uint32_t dwFlags = M.GetDword("mwflags", MWF_LOG_DEFAULT) & ~(MWF_LOG_ALL);
+ db_set_dw(0, SRMSGMOD_T, "mwflags", m_flags | dwFlags);
if (chkLoadCount.GetState())
g_plugin.setByte(SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
@@ -953,8 +844,6 @@ public: db_set_dw(0, SRMSGMOD_T, "RightIndent", spnRight.GetPosition());
// scan the tree view and obtain the options...
- TreeViewToDB(logOpts, lvItemsLog, SRMSGMOD_T, &dwFlags);
- db_set_dw(0, SRMSGMOD_T, "mwflags", dwFlags);
if (chkAlwaysTrim.GetState())
db_set_dw(0, SRMSGMOD_T, "maxhist", spnTrim.GetPosition());
else
@@ -1140,30 +1029,6 @@ public: /////////////////////////////////////////////////////////////////////////////////////////
// options for tabbed messaging got their own page.. finally :)
-static TOptionListGroup lvGroupsTab[] =
-{
- { 0, LPGENW("Tab options") },
- { 0, LPGENW("How to create tabs and windows for incoming messages") },
- { 0, LPGENW("Miscellaneous options") },
- { 0, nullptr }
-};
-
-static TOptionListItem lvItemsTab[] =
-{
- { 0, LPGENW("Show status text on tabs"), 1, LOI_TYPE_SETTING, (UINT_PTR)"tabstatus", 0 },
- { 0, LPGENW("Prefer xStatus icons when available"), 1, LOI_TYPE_SETTING, (UINT_PTR)"use_xicons", 0 },
- { 0, LPGENW("Detailed tooltip on tabs (requires Tipper plugin)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"d_tooltips", 0 },
- { 0, LPGENW("ALWAYS activate new message sessions (has PRIORITY over the options below)"), SRMSGDEFSET_AUTOPOPUP, LOI_TYPE_SETTING, (UINT_PTR)SRMSGSET_AUTOPOPUP, 1 },
- { 0, LPGENW("Automatically create new message sessions without activating them"), 1, LOI_TYPE_SETTING, (UINT_PTR)"autotabs", 1 },
- { 0, LPGENW("New windows are minimized (the option above MUST be active)"), 1, LOI_TYPE_SETTING, (UINT_PTR)"autocontainer", 1 },
- { 0, LPGENW("Activate a minimized window when a new tab is created inside it"), 0, LOI_TYPE_SETTING, (UINT_PTR)"cpopup", 1 },
- { 0, LPGENW("Automatically switch existing tabs in minimized windows on incoming messages (ignored when using Aero Peek task bar features)"), 1, LOI_TYPE_SETTING, (UINT_PTR)"autoswitchtabs", 1 },
- { 0, LPGENW("Close button only hides message windows"), 0, LOI_TYPE_SETTING, (UINT_PTR)"hideonclose", 2 },
- { 0, LPGENW("Allow Tab key in typing area (this will disable focus selection by Tab key)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"tabmode", 2 },
- { 0, LPGENW("Add offline contacts to multisend list"), 0, LOI_TYPE_SETTING, (UINT_PTR) "AllowOfflineMultisend", 2 },
- { 0, nullptr, 0, 0, 0, 0 }
-};
-
class COptTabbedDlg : public CDlgBase
{
CCtrlEdit edtLimit;
@@ -1171,7 +1036,7 @@ class COptTabbedDlg : public CDlgBase CCtrlCombo cmbEscMode;
CCtrlCheck chkLimit;
CCtrlButton btnSetup;
- CCtrlTreeView tabOptions;
+ CCtrlTreeOpts tabOptions;
public:
COptTabbedDlg() :
@@ -1186,12 +1051,27 @@ public: btnSetup.OnClick = Callback(this, &COptTabbedDlg::onClick_Setup);
chkLimit.OnChange = Callback(this, &COptTabbedDlg::onChange_Cut);
+
+ auto *pwszSection = LPGENW("Tab options");
+ tabOptions.AddOption(pwszSection, LPGENW("Show status text on tabs"), g_plugin.bStatusOnTabs);
+ tabOptions.AddOption(pwszSection, LPGENW("Prefer xStatus icons when available"), g_plugin.bUseXStatus);
+ tabOptions.AddOption(pwszSection, LPGENW("Detailed tooltip on tabs (requires Tipper plugin)"), g_plugin.bDetailedTooltips);
+
+ pwszSection = LPGENW("How to create tabs and windows for incoming messages");
+ tabOptions.AddOption(pwszSection, LPGENW("ALWAYS activate new message sessions (has PRIORITY over the options below)"), g_plugin.bAutoPopup);
+ tabOptions.AddOption(pwszSection, LPGENW("Automatically create new message sessions without activating them"), g_plugin.bAutoTabs);
+ tabOptions.AddOption(pwszSection, LPGENW("New windows are minimized (the option above MUST be active)"), g_plugin.bAutoContainer);
+ tabOptions.AddOption(pwszSection, LPGENW("Activate a minimized window when a new tab is created inside it"), g_plugin.bPopupContainer);
+ tabOptions.AddOption(pwszSection, LPGENW("Automatically switch existing tabs in minimized windows on incoming messages (ignored when using Aero Peek task bar features)"), g_plugin.bAutoSwitchTabs);
+
+ pwszSection = LPGENW("Miscellaneous options");
+ tabOptions.AddOption(pwszSection, LPGENW("Close button only hides message windows"), g_plugin.bHideOnClose);
+ tabOptions.AddOption(pwszSection, LPGENW("Allow Tab key in typing area (this will disable focus selection by Tab key)"), g_plugin.bAllowTab);
+ tabOptions.AddOption(pwszSection, LPGENW("Add offline contacts to multisend list"), g_plugin.bAllowOfflineMultisend);
}
bool OnInitDialog() override
{
- TreeViewInit(tabOptions, lvGroupsTab, lvItemsTab, SRMSGMOD_T);
-
chkLimit.SetState(M.GetByte("cuttitle", 0));
spnLimit.SetPosition(db_get_w(0, SRMSGMOD_T, "cut_at", 15));
@@ -1209,8 +1089,6 @@ public: db_set_b(0, SRMSGMOD_T, "cuttitle", chkLimit.GetState());
db_set_b(0, SRMSGMOD_T, "escmode", cmbEscMode.GetCurSel());
- TreeViewToDB(tabOptions, lvItemsTab, SRMSGMOD_T, nullptr);
-
PluginConfig.reloadSettings();
Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0);
return true;
@@ -1331,48 +1209,35 @@ public: /////////////////////////////////////////////////////////////////////////////////////////
// TabModPlus options
-TOptionListGroup lvGroupsModPlus[] =
-{
- { 0, LPGENW("Message window tweaks") },
- { 0, LPGENW("Display metacontact icons") },
- { 0, LPGENW("Error feedback") },
- { 0, nullptr }
-};
-
-TOptionListItem lvItemsModPlus[] =
-{
- { 0, LPGENW("Close current tab on send"), 0, LOI_TYPE_SETTING, (UINT_PTR)"adv_AutoClose_2", 0 },
- { 0, LPGENW("Enable unattended send (experimental feature, required for multisend and send later)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"sendLaterAvail", 0 },
- { 0, LPGENW("Show client description in info panel"), 1, LOI_TYPE_SETTING, (UINT_PTR)"ShowClientDescription", 0 },
- { 0, LPGENW("On tab control"), 1, LOI_TYPE_SETTING, (UINT_PTR)"MetaiconTab", 1 },
- { 0, LPGENW("On the button bar"), 0, LOI_TYPE_SETTING, (UINT_PTR)"MetaiconBar", 1 },
- { 0, LPGENW("Enable error popups on sending failures"), 1, LOI_TYPE_SETTING, (UINT_PTR)"adv_ErrorPopups", 2 },
- { 0, nullptr, 0, 0, 0, 0 }
-};
-
class COptAdvancedDlg : public CDlgBase
{
CCtrlSpin spnTimeout, spnHistSize;
- CCtrlButton btnRevert;
- CCtrlTreeView plusOptions;
+ CCtrlTreeOpts plusOptions;
CCtrlHyperlink urlHelp;
public:
COptAdvancedDlg() :
CDlgBase(g_plugin, IDD_OPTIONS_PLUS),
urlHelp(this, IDC_PLUS_HELP, "https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Typing_notifications"),
- btnRevert(this, IDC_PLUS_REVERT),
spnTimeout(this, IDC_TIMEOUTSPIN, 300, SRMSGSET_MSGTIMEOUT_MIN / 1000),
spnHistSize(this, IDC_HISTORYSIZESPIN, 255, 15),
plusOptions(this, IDC_PLUS_CHECKTREE)
{
- btnRevert.OnClick = Callback(this, &COptAdvancedDlg::onClick_Revert);
+ auto *pwszSection = LPGENW("Message window tweaks");
+ plusOptions.AddOption(pwszSection, LPGENW("Close current tab on send"), g_plugin.bCloseSend);
+ plusOptions.AddOption(pwszSection, LPGENW("Enable unattended send (experimental feature, required for multisend and send later)"), SendLater::Avail);
+ plusOptions.AddOption(pwszSection, LPGENW("Show client description in info panel"), g_plugin.bShowDesc);
+
+ pwszSection = LPGENW("Display metacontact icons");
+ plusOptions.AddOption(pwszSection, LPGENW("On tab control"), g_plugin.bMetaTab);
+ plusOptions.AddOption(pwszSection, LPGENW("On the button bar"), g_plugin.bMetaBar);
+
+ pwszSection = LPGENW("Error feedback");
+ plusOptions.AddOption(pwszSection, LPGENW("Enable error popups on sending failures"), g_plugin.bErrorPopup);
}
bool OnInitDialog() override
{
- TreeViewInit(plusOptions, lvGroupsModPlus, lvItemsModPlus, SRMSGMOD_T);
-
spnTimeout.SetPosition(PluginConfig.m_MsgTimeout / 1000);
spnHistSize.SetPosition(M.GetByte("historysize", 0));
return true;
@@ -1380,8 +1245,6 @@ public: bool OnApply() override
{
- TreeViewToDB(plusOptions, lvItemsModPlus, SRMSGMOD_T, nullptr);
-
int msgTimeout = 1000 * spnTimeout.GetPosition();
PluginConfig.m_MsgTimeout = msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout : SRMSGSET_MSGTIMEOUT_MIN;
g_plugin.setDword(SRMSGSET_MSGTIMEOUT, PluginConfig.m_MsgTimeout);
@@ -1390,15 +1253,6 @@ public: PluginConfig.reloadAdv();
return true;
}
-
- void onClick_Revert(CCtrlButton*)
- {
- for (auto &it : lvItemsModPlus)
- if (it.uType == LOI_TYPE_SETTING)
- db_set_b(0, SRMSGMOD_T, (char *)it.lParam, it.id);
-
- TreeViewSetFromDB(plusOptions, lvItemsModPlus, 0);
- }
};
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 2d54f9a3d6..7753b418d0 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -279,7 +279,7 @@ void TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, wchar_t *szStatus = Clist_GetStatusModeDescription(szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
- if (PluginConfig.m_bStatusOnTabs)
+ if (g_plugin.bStatusOnTabs)
mir_snwprintf(tabtitle, L"%s (%s)", newcontactname, szStatus);
else
mir_snwprintf(tabtitle, L"%s", newcontactname);
@@ -362,7 +362,7 @@ void TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, RedrawWindow(pContainer->m_hwndActive, nullptr, nullptr, RDW_ERASENOW | RDW_UPDATENOW);
}
- if (PluginConfig.m_bHideOnClose && !IsWindowVisible(pContainer->m_hwnd)) {
+ if (g_plugin.bHideOnClose && !IsWindowVisible(pContainer->m_hwnd)) {
WINDOWPLACEMENT wp = { 0 };
wp.length = sizeof(wp);
GetWindowPlacement(pContainer->m_hwnd, &wp);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 1bcc55a762..693f5aa08c 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -682,7 +682,7 @@ public: bool FormatTitleBar(const wchar_t *szFormat, CMStringW &dest);
bool GetAvatarVisibility(void);
void GetClientIcon(void);
- HICON GetMyContactIcon(LPCSTR szSetting);
+ HICON GetMyContactIcon(const CMOption<bool> *opt);
void GetMyNick(void);
HICON IconFromAvatar(void) const;
void KbdState(bool &isShift, bool &isControl, bool &isAlt);
@@ -814,10 +814,6 @@ struct TIconDescW #define LOADHISTORY_COUNT 1
#define LOADHISTORY_TIME 2
-#define SRMSGSET_AUTOPOPUP "AutoPopup"
-#define SRMSGDEFSET_AUTOPOPUP false
-#define SRMSGSET_AUTOMIN "AutoMin"
-#define SRMSGDEFSET_AUTOMIN 0
#define SRMSGSET_MSGTIMEOUT "MessageTimeout"
#define SRMSGDEFSET_MSGTIMEOUT 30000
#define SRMSGSET_MSGTIMEOUT_MIN 5000 // minimum value (5 seconds)
@@ -892,25 +888,6 @@ struct TCpTable { wchar_t *cpName;
};
-#define LOI_TYPE_FLAG 1
-#define LOI_TYPE_SETTING 2
-
-struct TOptionListGroup
-{
- HTREEITEM handle;
- wchar_t *szName;
-};
-
-struct TOptionListItem
-{
- HTREEITEM handle;
- wchar_t *szName;
- UINT id;
- UINT uType;
- UINT_PTR lParam;
- UINT uGroup;
-};
-
// sidebar button flags
#define SBI_TOP 1
@@ -1070,9 +1047,28 @@ struct CMPlugin : public PLUGIN<CMPlugin> {
HANDLE hLogger;
+ // window settings
+ CMOption<bool> bAutoMin, bAutoClose, bFlashOnClist, bDeleteTemp;
+ CMOption<bool> bPasteAndSend, bSendFormat, bAutoSplit, bUseSameSplitSize, bAutoCopy;
+ CMOption<bool> bStatusOnTabs, bUseXStatus, bDetailedTooltips, bAllowOfflineMultisend;
+ CMOption<bool> bAutoPopup, bAutoTabs, bAutoSwitchTabs, bAutoContainer, bPopupContainer, bHideOnClose, bAllowTab;
+
+ // advanced options
+ CMOption<bool> bCloseSend, bShowDesc, bMetaTab, bMetaBar, bErrorPopup;
+
+ // chat settings
+ CMOption<bool> bOpenInDefault, bCreateWindowOnHighlight, bBBCodeInPopups;
+ CMOption<bool> bLogClassicIndicators, bAlternativeSorting, bAnnoyingHighlight;
+ CMOption<bool> bLogSymbols, bClassicIndicators, bClickableNicks, bColorizeNicks, bColorizeNicksInLog;
+ CMOption<bool> bScaleIcons, bNewLineAfterNames;
+
+ // typing settings
CMOption<bool> bPopups;
CMOption<bool> bTypingNew, bTypingUnknown;
+ // log settings
+ CMOption<bool> bLogStatusChanges, bUseDividers, bDividersUsePopupConfig;
+
CMPlugin();
int Load() override;
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index 4b7231c1ad..9d0bf92519 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -445,7 +445,6 @@ #define IDC_LABEL_PRIVATETHEME 1405
#define IDC_BOTTOMTOOLBAR 1414
#define IDC_BUTTON1 1415
-#define IDC_PLUS_REVERT 1415
#define IDC_SIZECOMPACT 1415
#define IDC_RESCANSKIN 1415
#define IDC_RESETWARNINGS 1415
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 0fb240111c..bf6d9202fb 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -296,7 +296,7 @@ int SendQueue::sendQueued(CMsgDialog *dat, const int iEntry) if (!(dat->m_sendMode & SMODE_NOACK)) ::HandleIconFeedback(dat, PluginConfig.g_IconSend); - if (M.GetByte(SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN)) + if (g_plugin.bAutoMin) ::SendMessage(dat->m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); return 0; } @@ -500,8 +500,8 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) if (iNextFailed >= 0 && !dat->m_bErrorState) handleError(dat, iNextFailed); else { - if (M.GetByte("AutoClose", 0)) { - if (M.GetByte("adv_AutoClose_2", 0)) + if (g_plugin.bAutoClose) { + if (g_plugin.bCloseSend) SendMessage(dat->GetHwnd(), WM_CLOSE, 0, 1); else SendMessage(dat->m_pContainer->m_hwnd, WM_CLOSE, 0, 0); diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 0c4118e01c..9c9c3c6d2f 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -53,9 +53,60 @@ PLUGININFOEX pluginInfoEx = { CMPlugin::CMPlugin() : PLUGIN<CMPlugin>("SRMsg", pluginInfoEx), + + // main settings + bAutoMin(SRMSGMOD_T, "AutoMin", false), + bAutoCopy(SRMSGMOD_T, "autocopy", true), + bAutoTabs(SRMSGMOD_T, "autotabs", true), + bAllowTab(SRMSGMOD_T, "tabmode", false), + bAutoClose(SRMSGMOD_T, "AutoClose", false), + bAutoPopup(SRMSGMOD_T, "AutoPopup", false), + bAutoSplit(SRMSGMOD_T, "autosplit", false), + bDeleteTemp(SRMSGMOD_T, "deletetemp", false), + bUseXStatus(SRMSGMOD_T, "use_xicons", true), + bSendFormat(SRMSGMOD_T, "sendformat", false), + bHideOnClose(SRMSGMOD_T, "hideonclose", false), + bStatusOnTabs(SRMSGMOD_T, "tabstatus", true), + bFlashOnClist(SRMSGMOD_T, "flashcl", false), + bPasteAndSend(SRMSGMOD_T, "pasteandsend", true), + bAutoContainer(SRMSGMOD_T, "autocontainer", true), + bAutoSwitchTabs(SRMSGMOD_T, "autoswitchtabs", true), + bPopupContainer(SRMSGMOD_T, "cpopup", true), + bDetailedTooltips(SRMSGMOD_T, "d_tooltips", false), + bUseSameSplitSize(SRMSGMOD_T, "usesamesplitsize", true), + bAllowOfflineMultisend(SRMSGMOD_T, "AllowOfflineMultisend", true), + + // advanced options + bMetaBar(SRMSGMOD_T, "MetaiconBar", true), + bMetaTab(SRMSGMOD_T, "MetaiconTab", true), + bShowDesc(SRMSGMOD_T, "ShowClientDescription", false), + bCloseSend(SRMSGMOD_T, "adv_AutoClose_2", false), + bErrorPopup(SRMSGMOD_T, "adv_ErrorPopups", true), + + // chat settings + bOpenInDefault(CHAT_MODULE, "DefaultContainer", true), + bCreateWindowOnHighlight(CHAT_MODULE, "CreateWindowOnHighlight", false), + bBBCodeInPopups(CHAT_MODULE, "BBCodeInPopups", false), + bClassicIndicators(CHAT_MODULE, "ClassicIndicators", false), + bLogClassicIndicators(CHAT_MODULE, "LogClassicIndicators", false), + bAlternativeSorting(CHAT_MODULE, "AlternativeSorting", true), + bAnnoyingHighlight(CHAT_MODULE, "AnnoyingHighlight", false), + bLogSymbols(CHAT_MODULE, "LogSymbols", true), + bClickableNicks(CHAT_MODULE, "ClickableNicks", true), + bColorizeNicks(CHAT_MODULE, "ColorizeNicks", true), + bColorizeNicksInLog(CHAT_MODULE, "ColorizeNicksInLog", true), + bScaleIcons(CHAT_MODULE, "ScaleIcons", true), + bNewLineAfterNames(CHAT_MODULE, "NewlineAfterNames", false), + + // typing settings bPopups(TypingModule, "TypingPopup", true), bTypingNew(TypingModule, "DefaultTyping", true), - bTypingUnknown(TypingModule, "UnknownTyping", false) + bTypingUnknown(TypingModule, "UnknownTyping", false), + + // log options + bUseDividers(SRMSGMOD_T, "usedividers", false), + bLogStatusChanges(SRMSGMOD_T, "logstatuschanges", false), + bDividersUsePopupConfig(SRMSGMOD_T, "div_popupconfig", false) {} ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index 8c95d3a86c..e09f24597b 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -243,10 +243,6 @@ INT_PTR SendMessageCommand(WPARAM, LPARAM); INT_PTR SendMessageCommand_W(WPARAM, LPARAM);
INT_PTR SetUserPrefs(WPARAM, LPARAM);
-void TreeViewInit(CCtrlTreeView&, TOptionListGroup *lvGroups, TOptionListItem *lvItems, const char *DBPath, uint32_t dwFlags = 0, bool bFromMem = false);
-void TreeViewSetFromDB(CCtrlTreeView&, TOptionListItem *lvItems, uint32_t dwFlags);
-void TreeViewToDB(CCtrlTreeView&, TOptionListItem *lvItems, const char *DBPath, uint32_t *dwFlags);
-
INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
CSrmmLogWindow *logBuilder(CMsgDialog &pDlg);
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 0b92baff07..29d2b0511b 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -1253,7 +1253,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_TIMER:
InvalidateRect(hwnd, nullptr, FALSE); /* wine: fix for erase/paint tab on mouse enter/leave tab. */
- if (wParam == TIMERID_HOVER_T && M.GetByte("d_tooltips", 0)) {
+ if (wParam == TIMERID_HOVER_T && g_plugin.bDetailedTooltips) {
KillTimer(hwnd, TIMERID_HOVER_T);
GetCursorPos(&pt);
|