diff options
Diffstat (limited to 'plugins/TabSRMM/src/msgoptions.cpp')
-rw-r--r-- | plugins/TabSRMM/src/msgoptions.cpp | 887 |
1 files changed, 432 insertions, 455 deletions
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index f62a9b77de..a7ac5fad7b 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -31,9 +31,8 @@ #define DM_GETSTATUSMASK (WM_USER + 10)
-INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-struct FontOptionsList {
+struct FontOptionsList
+{
COLORREF defColour;
char *szDefFace;
BYTE defStyle;
@@ -46,6 +45,7 @@ static fontOptionsList[] = { static HIMAGELIST g_himlStates = 0;
+
HIMAGELIST CreateStateImageList()
{
if (g_himlStates == 0) {
@@ -68,21 +68,20 @@ void TSAPI LoadLogfont(int i, LOGFONTA * lf, COLORREF * colour, char *szModule) {
LOGFONT lfResult;
LoadMsgDlgFont((i < 100) ? FONTSECTION_IM : FONTSECTION_IP, i, &lfResult, colour, szModule);
- if (lf)
- {
- lf->lfHeight = lfResult.lfHeight;
- lf->lfWidth = lfResult.lfWidth;
- lf->lfEscapement = lfResult.lfEscapement;
- lf->lfOrientation = lfResult.lfOrientation;
- lf->lfWeight = lfResult.lfWeight;
- lf->lfItalic = lfResult.lfItalic;
- lf->lfUnderline = lfResult.lfUnderline;
- lf->lfStrikeOut = lfResult.lfStrikeOut;
- lf->lfCharSet = lfResult.lfCharSet;
- lf->lfOutPrecision = lfResult.lfOutPrecision;
- lf->lfClipPrecision = lfResult.lfClipPrecision;
- lf->lfQuality = lfResult.lfQuality;
- lf->lfPitchAndFamily = lfResult.lfPitchAndFamily;
+ if (lf) {
+ lf->lfHeight = lfResult.lfHeight;
+ lf->lfWidth = lfResult.lfWidth;
+ lf->lfEscapement = lfResult.lfEscapement;
+ lf->lfOrientation = lfResult.lfOrientation;
+ lf->lfWeight = lfResult.lfWeight;
+ lf->lfItalic = lfResult.lfItalic;
+ lf->lfUnderline = lfResult.lfUnderline;
+ lf->lfStrikeOut = lfResult.lfStrikeOut;
+ lf->lfCharSet = lfResult.lfCharSet;
+ lf->lfOutPrecision = lfResult.lfOutPrecision;
+ lf->lfClipPrecision = lfResult.lfClipPrecision;
+ lf->lfQuality = lfResult.lfQuality;
+ lf->lfPitchAndFamily = lfResult.lfPitchAndFamily;
mir_snprintf(lf->lfFaceName, SIZEOF(lf->lfFaceName), "%S", lfResult.lfFaceName);
}
}
@@ -91,33 +90,31 @@ HIMAGELIST g_himlOptions; static HWND hwndTabConfig = 0;
-/**
- * scan a single skin directory and find the .TSK file. Fill the combobox and set the
- * relative path name as item extra data.
- *
- * If available, read the Name property from the [Global] section and use it in the
- * combo box. If such property is not found, the base filename (without .tsk extension)
- * will be used as the name of the skin.
- *
- * [Global]/Name property is new in TabSRMM version 3.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// scan a single skin directory and find the.TSK file.Fill the combobox and set the
+// relative path name as item extra data.
+//
+// If available, read the Name property from the [Global] section and use it in the
+// combo box. If such property is not found, the base filename (without .tsk extension)
+// will be used as the name of the skin.
+//
+// [Global]/Name property is new in TabSRMM version 3.
+
static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox)
{
- WIN32_FIND_DATA fd = {0};
- bool fValid = false;
- TCHAR tszMask[MAX_PATH];
-
+ bool fValid = false;
+ TCHAR tszMask[MAX_PATH];
mir_sntprintf(tszMask, MAX_PATH, _T("%s*.*"), tszFolder);
+ WIN32_FIND_DATA fd = { 0 };
HANDLE h = FindFirstFile(tszMask, &fd);
-
- while(h != INVALID_HANDLE_VALUE) {
+ while (h != INVALID_HANDLE_VALUE) {
if (lstrlen(fd.cFileName) >= 5 && !_tcsnicmp(fd.cFileName + lstrlen(fd.cFileName) - 4, _T(".tsk"), 4)) {
fValid = true;
break;
}
- if (FindNextFile(h, &fd) == 0)
- break;
+ if (FindNextFile(h, &fd) == 0)
+ break;
}
if (h != INVALID_HANDLE_VALUE)
FindClose(h);
@@ -146,22 +143,20 @@ static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox) return 0;
}
-/**
- * scan the skin root folder for subfolder(s). Each folder is supposed to contain a single
- * skin. This function won't dive deeper into the folder structure, so the folder
- * structure for any VALID skin should be:
- * $SKINS_ROOT/skin_folder/skin_name.tsk
- *
- * By default, $SKINS_ROOT is set to %miranda_userdata% or custom folder
- * selected by the folders plugin.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// scan the skin root folder for subfolder(s).Each folder is supposed to contain a single
+// skin. This function won't dive deeper into the folder structure, so the folder
+// structure for any VALID skin should be:
+// $SKINS_ROOT/skin_folder/skin_name.tsk
+//
+// By default, $SKINS_ROOT is set to %miranda_userdata% or custom folder
+// selected by the folders plugin.
+
static int TSAPI RescanSkins(HWND hwndCombobox)
{
- WIN32_FIND_DATA fd = {0};
- TCHAR tszSkinRoot[MAX_PATH], tszFindMask[MAX_PATH];
- DBVARIANT dbv = {0};
-
+ DBVARIANT dbv = { 0 };
+ TCHAR tszSkinRoot[MAX_PATH], tszFindMask[MAX_PATH];
mir_sntprintf(tszSkinRoot, MAX_PATH, _T("%s"), M.getSkinPath());
SetDlgItemText(GetParent(hwndCombobox), IDC_SKINROOTFOLDER, tszSkinRoot);
@@ -170,6 +165,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox) SendMessage(hwndCombobox, CB_RESETCONTENT, 0, 0);
SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)TranslateT("<no skin>"));
+ WIN32_FIND_DATA fd = { 0 };
HANDLE h = FindFirstFile(tszFindMask, &fd);
while (h != INVALID_HANDLE_VALUE) {
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && fd.cFileName[0] != '.') {
@@ -177,19 +173,17 @@ static int TSAPI RescanSkins(HWND hwndCombobox) mir_sntprintf(tszSubDir, MAX_PATH, _T("%s%s\\"), tszSkinRoot, fd.cFileName);
ScanSkinDir(tszSubDir, hwndCombobox);
}
- if (FindNextFile(h, &fd) == 0)
- break;
+ if (FindNextFile(h, &fd) == 0)
+ break;
}
if (h != INVALID_HANDLE_VALUE)
FindClose(h);
-
SendMessage(hwndCombobox, CB_SETCURSEL, 0, 0);
if (0 == db_get_ts(0, SRMSGMOD_T, "ContainerSkin", &dbv)) {
LRESULT lr = SendMessage(hwndCombobox, CB_GETCOUNT, 0, 0);
for (int i = 1; i < lr; i++) {
-
- TCHAR* idata = (TCHAR*)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0);
+ TCHAR *idata = (TCHAR*)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0);
if (idata && idata != (TCHAR*)CB_ERR) {
if (!_tcsicmp(dbv.ptszVal, idata)) {
SendMessage(hwndCombobox, CB_SETCURSEL, i, 0);
@@ -202,10 +196,9 @@ static int TSAPI RescanSkins(HWND hwndCombobox) return 0;
}
-/**
- * mir_free the item extra data (used to store the skin filenames for
- * each entry).
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// mir_free the item extra data (used to store the skin filenames for each entry).
+
static void TSAPI FreeComboData(HWND hwndCombobox)
{
LRESULT lr = SendMessage(hwndCombobox, CB_GETCOUNT, 0, 0);
@@ -218,211 +211,202 @@ static void TSAPI FreeComboData(HWND hwndCombobox) }
}
-/*
- * controls to disable when loading or unloading a skin is not possible (because
- * of at least one message window being open).
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// controls to disable when loading or unloading a skin is not possible (because
+// of at least one message window being open).
+
static UINT _ctrls[] = { IDC_SKINNAME, IDC_RESCANSKIN, IDC_RESCANSKIN, IDC_RELOADSKIN, 0 };
static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg) {
- case WM_INITDIALOG: {
- RescanSkins(GetDlgItem(hwndDlg, IDC_SKINNAME));
- BYTE loadMode = M.GetByte("skin_loadmode", 0);
- TranslateDialogDefault(hwndDlg);
+ BYTE loadMode;
- CheckDlgButton(hwndDlg, IDC_USESKIN, M.GetByte("useskin", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SKIN_LOADFONTS, loadMode & THEME_READ_FONTS);
- CheckDlgButton(hwndDlg, IDC_SKIN_LOADTEMPLATES, loadMode & THEME_READ_TEMPLATES);
+ switch (msg) {
+ case WM_INITDIALOG:
+ RescanSkins(GetDlgItem(hwndDlg, IDC_SKINNAME));
+ TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- SetTimer(hwndDlg, 1000, 100, 0);
- return TRUE;
- }
+ CheckDlgButton(hwndDlg, IDC_USESKIN, M.GetByte("useskin", 0) ? BST_CHECKED : BST_UNCHECKED);
+
+ loadMode = M.GetByte("skin_loadmode", 0);
+ CheckDlgButton(hwndDlg, IDC_SKIN_LOADFONTS, loadMode & THEME_READ_FONTS);
+ CheckDlgButton(hwndDlg, IDC_SKIN_LOADTEMPLATES, loadMode & THEME_READ_TEMPLATES);
- case WM_CTLCOLORSTATIC:
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SKIN_WARN)) {
- SetTextColor((HDC)wParam, RGB(255, 50, 50));
- return 0;
- }
- break;
+ SendMessage(hwndDlg, WM_USER + 100, 0, 0);
+ SetTimer(hwndDlg, 1000, 100, 0);
+ return TRUE;
- /*
- * self - configure the dialog, don't let the user load or unload
- * a skin while a message window is open. Show the warning that all
- * windows must be closed.
- */
- case WM_USER + 100: {
- bool fWindowsOpen = (pFirstContainer != 0 ? true : false);
- UINT i = 0;
+ case WM_CTLCOLORSTATIC:
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SKIN_WARN)) {
+ SetTextColor((HDC)wParam, RGB(255, 50, 50));
+ return 0;
+ }
+ break;
- while(_ctrls[i]) {
+ // self - configure the dialog, don't let the user load or unload
+ // a skin while a message window is open. Show the warning that all
+ // windows must be closed.
+ case WM_USER + 100:
+ {
+ bool fWindowsOpen = (pFirstContainer != 0 ? true : false);
+ for (int i = 0; _ctrls[i]; i++)
Utils::enableDlgControl(hwndDlg, _ctrls[i], fWindowsOpen ? FALSE : TRUE);
- i++;
- }
+
Utils::showDlgControl(hwndDlg, IDC_SKIN_WARN, fWindowsOpen ? SW_SHOW : SW_HIDE);
Utils::showDlgControl(hwndDlg, IDC_SKIN_CLOSENOW, fWindowsOpen ? SW_SHOW : SW_HIDE);
- return 0;
}
+ return 0;
- case WM_TIMER:
- if (wParam == 1000)
- SendMessage(hwndDlg, WM_USER + 100, 0, 0);
+ case WM_TIMER:
+ if (wParam == 1000)
+ SendMessage(hwndDlg, WM_USER + 100, 0, 0);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_USESKIN:
+ db_set_b(0, SRMSGMOD_T, "useskin", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_USESKIN) ? 1 : 0));
break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_USESKIN:
- db_set_b(0, SRMSGMOD_T, "useskin", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_USESKIN) ? 1 : 0));
- break;
+ case IDC_SKIN_LOADFONTS:
+ loadMode = M.GetByte("skin_loadmode", 0);
+ loadMode = IsDlgButtonChecked(hwndDlg, IDC_SKIN_LOADFONTS) ? loadMode | THEME_READ_FONTS : loadMode & ~THEME_READ_FONTS;
+ db_set_b(0, SRMSGMOD_T, "skin_loadmode", loadMode);
+ break;
- case IDC_SKIN_LOADFONTS: {
- BYTE loadMode = M.GetByte("skin_loadmode", 0);
- loadMode = IsDlgButtonChecked(hwndDlg, IDC_SKIN_LOADFONTS) ? loadMode | THEME_READ_FONTS : loadMode & ~THEME_READ_FONTS;
- db_set_b(0, SRMSGMOD_T, "skin_loadmode", loadMode);
- break;
- }
+ case IDC_SKIN_LOADTEMPLATES:
+ loadMode = M.GetByte("skin_loadmode", 0);
+ loadMode = IsDlgButtonChecked(hwndDlg, IDC_SKIN_LOADTEMPLATES) ? loadMode | THEME_READ_TEMPLATES : loadMode & ~THEME_READ_TEMPLATES;
+ db_set_b(0, SRMSGMOD_T, "skin_loadmode", loadMode);
+ break;
- case IDC_SKIN_LOADTEMPLATES: {
- BYTE loadMode = M.GetByte("skin_loadmode", 0);
- loadMode = IsDlgButtonChecked(hwndDlg, IDC_SKIN_LOADTEMPLATES) ? loadMode | THEME_READ_TEMPLATES : loadMode & ~THEME_READ_TEMPLATES;
- db_set_b(0, SRMSGMOD_T, "skin_loadmode", loadMode);
- break;
- }
+ case IDC_UNLOAD:
+ Skin->Unload();
+ SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
+ break;
- case IDC_UNLOAD:
- Skin->Unload();
- SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
- break;
+ case IDC_RELOADSKIN:
+ Skin->setFileName();
+ Skin->Load();
+ SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
+ break;
- case IDC_RELOADSKIN:
- Skin->setFileName();
- Skin->Load();
- SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
- break;
+ case IDC_RESCANSKIN:
+ FreeComboData(GetDlgItem(hwndDlg, IDC_SKINNAME));
+ RescanSkins(GetDlgItem(hwndDlg, IDC_SKINNAME));
+ break;
- case IDC_RESCANSKIN:
- FreeComboData(GetDlgItem(hwndDlg, IDC_SKINNAME));
- RescanSkins(GetDlgItem(hwndDlg, IDC_SKINNAME));
- break;
+ case IDC_THEMEEXPORT:
+ {
+ const TCHAR *szFilename = GetThemeFileName(1);
+ if (szFilename != NULL)
+ WriteThemeToINI(szFilename, 0);
+ }
+ break;
- case IDC_THEMEEXPORT: {
- const TCHAR *szFilename = GetThemeFileName(1);
- if (szFilename != NULL)
- WriteThemeToINI(szFilename, 0);
- break;
+ case IDC_THEMEIMPORT:
+ if (CSkin::m_skinEnabled) {
+ LRESULT r = CWarning::show(CWarning::WARN_THEME_OVERWRITE, MB_YESNOCANCEL | MB_ICONQUESTION);
+ if (r == IDNO || r == IDCANCEL)
+ return 0;
+ }
+ {
+ LRESULT r = CWarning::show(CWarning::WARN_OPTION_CLOSE, MB_YESNOCANCEL | MB_ICONQUESTION);
+ if (r == IDNO || r == IDCANCEL)
+ return 0;
+
+ const wchar_t* szFilename = GetThemeFileName(0);
+ DWORD dwFlags = THEME_READ_FONTS;
+
+ if (szFilename != NULL) {
+ int result = MessageBox(0, TranslateT("Do you want to also read message templates from the theme?\nCaution: This will overwrite the stored template set which may affect the look of your message window significantly.\nSelect cancel to not load anything at all."),
+ TranslateT("Load theme"), MB_YESNOCANCEL);
+ if (result == IDCANCEL)
+ return 1;
+ if (result == IDYES)
+ dwFlags |= THEME_READ_TEMPLATES;
+ ReadThemeFromINI(szFilename, 0, 0, dwFlags);
+ CacheLogFonts();
+ CacheMsgLogIcons();
+ PluginConfig.reloadSettings();
+ CSkin::setAeroEffect(-1);
+ M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0);
+ M.BroadcastMessage(DM_FORCEDREMAKELOG, 0, 0);
+ SendMessage(GetParent(hwndDlg), WM_COMMAND, IDCANCEL, 0);
}
+ }
+ break;
- case IDC_THEMEIMPORT: {
- LRESULT r;
+ case IDC_HELP_GENERAL:
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/UsingSkins");
+ break;
- if (CSkin::m_skinEnabled) {
- r = CWarning::show(CWarning::WARN_THEME_OVERWRITE, MB_YESNOCANCEL|MB_ICONQUESTION);
- if (r == IDNO || r == IDCANCEL)
- return 0;
- }
+ case IDC_SKIN_CLOSENOW:
+ CloseAllContainers();
+ break;
- r = CWarning::show(CWarning::WARN_OPTION_CLOSE, MB_YESNOCANCEL|MB_ICONQUESTION);
- if (r == IDNO || r == IDCANCEL)
- return 0;
-
- const wchar_t* szFilename = GetThemeFileName(0);
- DWORD dwFlags = THEME_READ_FONTS;
- int result;
-
- if (szFilename != NULL) {
- result = MessageBox(0, TranslateT("Do you want to also read message templates from the theme?\nCaution: This will overwrite the stored template set which may affect the look of your message window significantly.\nSelect cancel to not load anything at all."),
- TranslateT("Load theme"), MB_YESNOCANCEL);
- if (result == IDCANCEL)
- return 1;
- else if (result == IDYES)
- dwFlags |= THEME_READ_TEMPLATES;
- ReadThemeFromINI(szFilename, 0, 0, dwFlags);
- CacheLogFonts();
- CacheMsgLogIcons();
- PluginConfig.reloadSettings();
- CSkin::setAeroEffect(-1);
- M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0);
- M.BroadcastMessage(DM_FORCEDREMAKELOG, 0, 0);
- SendMessage(GetParent(hwndDlg), WM_COMMAND, IDCANCEL, 0);
- }
- break;
+ case IDC_SKINNAME:
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
+ LRESULT lr = SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETCURSEL, 0, 0);
+ if (lr != CB_ERR && lr > 0) {
+ TCHAR *tszRelPath = (TCHAR*)SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETITEMDATA, lr, 0);
+ if (tszRelPath && tszRelPath != (TCHAR*)CB_ERR)
+ db_set_ts(0, SRMSGMOD_T, "ContainerSkin", tszRelPath);
+ SendMessage(hwndDlg, WM_COMMAND, IDC_RELOADSKIN, 0);
}
-
- case IDC_HELP_GENERAL:
- CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/UsingSkins");
- break;
-
- case IDC_SKIN_CLOSENOW:
- CloseAllContainers();
- break;
-
- case IDC_SKINNAME: {
- if (HIWORD(wParam) == CBN_SELCHANGE) {
- LRESULT lr = SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETCURSEL, 0 ,0);
- if (lr != CB_ERR && lr > 0) {
- TCHAR *tszRelPath = (TCHAR*)SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETITEMDATA, lr, 0);
- if (tszRelPath && tszRelPath != (TCHAR*)CB_ERR)
- db_set_ts(0, SRMSGMOD_T, "ContainerSkin", tszRelPath);
- SendMessage(hwndDlg, WM_COMMAND, IDC_RELOADSKIN, 0);
- }
- else if (lr == 0) { // selected the <no skin> entry
- db_unset(0, SRMSGMOD_T, "ContainerSkin");
- Skin->Unload();
- SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
- }
- return 0;
- }
- break;
+ else if (lr == 0) { // selected the <no skin> entry
+ db_unset(0, SRMSGMOD_T, "ContainerSkin");
+ Skin->Unload();
+ SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
}
- }
- if ((LOWORD(wParam) == IDC_SKINNAME) && (HIWORD(wParam) != CBN_SELCHANGE || (HWND) lParam != GetFocus()))
return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- return TRUE;
- }
- break;
}
break;
+ }
- case WM_DESTROY:
- KillTimer(hwndDlg, 1000);
- FreeComboData(GetDlgItem(hwndDlg, IDC_SKINNAME));
+ if ((LOWORD(wParam) == IDC_SKINNAME) && (HIWORD(wParam) != CBN_SELCHANGE || (HWND)lParam != GetFocus()))
+ return 0;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ return TRUE;
+ }
break;
+ }
+ break;
+
+ case WM_DESTROY:
+ KillTimer(hwndDlg, 1000);
+ FreeComboData(GetDlgItem(hwndDlg, IDC_SKINNAME));
+ break;
}
return FALSE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG: {
- BOOL translated;
- TVINSERTSTRUCT tvi = {0};
- int i;
-
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ {
DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
- TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_WINDOWOPTIONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_WINDOWOPTIONS), GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES));
-
g_himlOptions = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_WINDOWOPTIONS, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList());
ImageList_Destroy(g_himlOptions);
- /*
- * fill the list box, create groups first, then add items
- */
-
+ // fill the list box, create groups first, then add items
+ TVINSERTSTRUCT tvi = { 0 };
TOptionListGroup *defaultGroups = CTranslator::getGroupTree(CTranslator::TREE_MSG);
- for (i=0; defaultGroups[i].szName != NULL; i++) {
+ for (int i = 0; defaultGroups[i].szName != NULL; i++) {
tvi.hParent = 0;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
@@ -433,7 +417,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
TOptionListItem *defaultItems = CTranslator::getTree(CTranslator::TREE_MSG);
- for (i=0; defaultItems[i].szName != 0; i++) {
+ for (int i = 0; defaultItems[i].szName != 0; i++) {
tvi.hParent = (HTREEITEM)defaultGroups[defaultItems[i].uGroup].handle;
tvi.hInsertAfter = TVI_LAST;
tvi.item.pszText = TranslateTS(defaultItems[i].szName);
@@ -448,98 +432,102 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemInt(hwndDlg, IDC_MAXAVATARHEIGHT, M.GetDword("avatarheight", 100), FALSE);
CheckDlgButton(hwndDlg, IDC_PRESERVEAVATARSIZE, M.GetByte("dontscaleavatars", 0) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_AVATARSPIN, UDM_SETRANGE, 0, MAKELONG(150, 0));
+
+ BOOL translated;
SendDlgItemMessage(hwndDlg, IDC_AVATARSPIN, UDM_SETPOS, 0, GetDlgItemInt(hwndDlg, IDC_MAXAVATARHEIGHT, &translated, FALSE));
- return TRUE;
}
- case WM_DESTROY:
- //ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_WINDOWOPTIONS, TVM_GETIMAGELIST, 0, 0));
+ return TRUE;
+
+ case WM_DESTROY:
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_MAXAVATARHEIGHT:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
+ return TRUE;
break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_MAXAVATARHEIGHT: {
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- break;
- }
- case IDC_HELP_GENERAL:
- CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/GeneralSettings");
- break;
- case IDC_RESETWARNINGS:
- db_set_dw(0, SRMSGMOD_T, "cWarningsL", 0);
- db_set_dw(0, SRMSGMOD_T, "cWarningsH", 0);
- break;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_HELP_GENERAL:
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/GeneralSettings");
break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case IDC_WINDOWOPTIONS:
- if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
- TVHITTESTINFO hti;
- TVITEM item = {0};
-
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
- if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
- hti.flags |= TVHT_ONITEMSTATEICON;
- item.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
- } else
- item.hItem = (HTREEITEM)hti.hItem;
- SendDlgItemMessageA(hwndDlg, IDC_WINDOWOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
- if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
- item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
- SendDlgItemMessageA(hwndDlg, IDC_WINDOWOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
- } else if (hti.flags & TVHT_ONITEMSTATEICON) {
-
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
- item.state = INDEXTOSTATEIMAGEMASK(1);
- SendDlgItemMessageA(hwndDlg, IDC_WINDOWOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
+
+ case IDC_RESETWARNINGS:
+ db_set_dw(0, SRMSGMOD_T, "cWarningsL", 0);
+ db_set_dw(0, SRMSGMOD_T, "cWarningsH", 0);
+ break;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case IDC_WINDOWOPTIONS:
+ if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
+ TVITEM item = { 0 };
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
+
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
+ if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
+ hti.flags |= TVHT_ONITEMSTATEICON;
+ item.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
}
- break;
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY: {
- BOOL translated;
- TVITEM item = {0};
-
- db_set_dw(0, SRMSGMOD_T, "avatarheight", GetDlgItemInt(hwndDlg, IDC_MAXAVATARHEIGHT, &translated, FALSE));
-
- db_set_b(0, SRMSGMOD_T, "dontscaleavatars", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PRESERVEAVATARSIZE) ? 1 : 0));
-
- /*
- * scan the tree view and obtain the options...
- */
-
- TOptionListItem *defaultItems = CTranslator::getTree(CTranslator::TREE_MSG);
- for (int i=0; defaultItems[i].szName != NULL; i++) {
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.hItem = (HTREEITEM)defaultItems[i].handle;
- item.stateMask = TVIS_STATEIMAGEMASK;
-
- SendDlgItemMessageA(hwndDlg, IDC_WINDOWOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
- if (defaultItems[i].uType == LOI_TYPE_SETTING)
- db_set_b(0, SRMSGMOD_T, (char *)defaultItems[i].lParam, (BYTE)((item.state >> 12) == 3 ? 1 : 0));
- }
- PluginConfig.reloadSettings();
- M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0);
- return TRUE;
+ else item.hItem = (HTREEITEM)hti.hItem;
+
+ SendDlgItemMessageA(hwndDlg, IDC_WINDOWOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
+ if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
+ item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
+ SendDlgItemMessageA(hwndDlg, IDC_WINDOWOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
+ }
+ else if (hti.flags & TVHT_ONITEMSTATEICON) {
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
+ item.state = INDEXTOSTATEIMAGEMASK(1);
+ SendDlgItemMessageA(hwndDlg, IDC_WINDOWOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
}
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- break;
+ }
+ }
+ break;
+
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ BOOL translated;
+ db_set_dw(0, SRMSGMOD_T, "avatarheight", GetDlgItemInt(hwndDlg, IDC_MAXAVATARHEIGHT, &translated, FALSE));
+
+ db_set_b(0, SRMSGMOD_T, "dontscaleavatars", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PRESERVEAVATARSIZE) ? 1 : 0));
+
+ // scan the tree view and obtain the options...
+ TVITEM item = { 0 };
+ TOptionListItem *defaultItems = CTranslator::getTree(CTranslator::TREE_MSG);
+ for (int i = 0; defaultItems[i].szName != NULL; i++) {
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.hItem = (HTREEITEM)defaultItems[i].handle;
+ item.stateMask = TVIS_STATEIMAGEMASK;
+
+ SendDlgItemMessageA(hwndDlg, IDC_WINDOWOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
+ if (defaultItems[i].uType == LOI_TYPE_SETTING)
+ db_set_b(0, SRMSGMOD_T, (char *)defaultItems[i].lParam, (BYTE)((item.state >> 12) == 3 ? 1 : 0));
+ }
+ PluginConfig.reloadSettings();
+ M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0);
+ return TRUE;
}
break;
+ }
+ break;
}
return FALSE;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int have_ieview = 0, have_hpp = 0;
static UINT __ctrls[] = { IDC_INDENTSPIN, IDC_RINDENTSPIN, IDC_INDENTAMOUNT, IDC_RIGHTINDENT,
@@ -552,12 +540,10 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
- TVINSERTSTRUCT tvi = {0};
- int i;
DWORD maxhist = M.GetDword("maxhist", 0);
- TranslateDialogDefault(hwndDlg);
switch (M.GetByte(SRMSGMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
case LOADHISTORY_UNREAD:
CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED);
@@ -579,12 +565,10 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, g_himlOptions = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LOGOPTIONS, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList());
ImageList_Destroy(g_himlOptions);
- /*
- * fill the list box, create groups first, then add items
- */
-
+ // fill the list box, create groups first, then add items
+ TVINSERTSTRUCT tvi = { 0 };
TOptionListGroup *lvGroups = CTranslator::getGroupTree(CTranslator::TREE_LOG);
- for (i=0; lvGroups[i].szName != NULL; i++) {
+ for (int i = 0; lvGroups[i].szName != NULL; i++) {
tvi.hParent = 0;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
@@ -595,7 +579,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, }
TOptionListItem *lvItems = CTranslator::getTree(CTranslator::TREE_LOG);
- for (i=0; lvItems[i].szName != 0; i++) {
+ for (int i = 0; lvItems[i].szName != 0; i++) {
tvi.hParent = (HTREEITEM)lvGroups[lvItems[i].uGroup].handle;
tvi.hInsertAfter = TVI_LAST;
tvi.item.pszText = TranslateTS(lvItems[i].szName);
@@ -634,8 +618,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Internal message log"));
SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_SETCURSEL, 0, 0);
- if (have_ieview || have_hpp)
- {
+ if (have_ieview || have_hpp) {
if (have_ieview) {
SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_INSERTSTRING, -1, (LPARAM)TranslateT("IEView plugin"));
if (M.GetByte("default_ieview", 0))
@@ -649,21 +632,17 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_SETCURSEL, have_ieview ? 2 : 1, 0);
}
}
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_MSGLOGDIDSPLAY),FALSE);
- }
+ else EnableWindow(GetDlgItem(hwndDlg, IDC_MSGLOGDIDSPLAY), FALSE);
+
SetDlgItemText(hwndDlg, IDC_EXPLAINMSGLOGSETTINGS, TranslateT("You have chosen to use an external plugin for displaying the message history in the chat window. Most of the settings on this page are for the standard message log viewer only and will have no effect. To change the appearance of the message log, you must configure either IEView or History++."));
SendMessage(hwndDlg, WM_USER + 100, 0, 0);
}
return TRUE;
- /*
- * 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
- * the user, because they are not working and the user needs to configure the 3rd
- * party plugin.
- */
+ // 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
+ // the user, because they are not working and the user needs to configure the 3rd
+ // party plugin.
case WM_USER + 100:
{
LRESULT r = SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_GETCURSEL, 0, 0);
@@ -718,11 +697,11 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_LOGOPTIONS:
if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
TVHITTESTINFO hti;
- TVITEM item = {0};
+ TVITEM item = { 0 };
item.mask = TVIF_HANDLE | TVIF_STATE;
item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
@@ -733,14 +712,15 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
hti.flags |= TVHT_ONITEMSTATEICON;
item.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
- } else
- item.hItem = (HTREEITEM)hti.hItem;
+ }
+ else item.hItem = (HTREEITEM)hti.hItem;
+
SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
- } else if (hti.flags & TVHT_ONITEMSTATEICON) {
-
+ }
+ else if (hti.flags & TVHT_ONITEMSTATEICON) {
if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
item.state = INDEXTOSTATEIMAGEMASK(1);
SendDlgItemMessageA(hwndDlg, IDC_LOGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
@@ -754,8 +734,6 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, default:
switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
- int i;
- TVITEM item = {0};
LRESULT msglogmode = SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_GETCURSEL, 0, 0);
dwFlags &= ~(MWF_LOG_ALL);
@@ -788,12 +766,10 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
- /*
- * scan the tree view and obtain the options...
- */
-
+ // scan the tree view and obtain the options...
+ TVITEM item = { 0 };
TOptionListItem *lvItems = CTranslator::getTree(CTranslator::TREE_LOG);
- for (i=0; lvItems[i].szName != NULL; i++) {
+ for (int i=0; lvItems[i].szName != NULL; i++) {
item.mask = TVIF_HANDLE | TVIF_STATE;
item.hItem = (HTREEITEM)lvItems[i].handle;
item.stateMask = TVIS_STATEIMAGEMASK;
@@ -820,10 +796,11 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// typing notify options
+
static void ResetCList(HWND hwndDlg)
{
- int i;
-
if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !M.GetByte("CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, FALSE, 0);
else
@@ -831,10 +808,10 @@ static void ResetCList(HWND hwndDlg) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0);
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKBITMAP, 0, (LPARAM)(HBITMAP) NULL);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKBITMAP, 0, (LPARAM)(HBITMAP)NULL);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETINDENT, 10, 0);
- for (i=0; i <= FONTID_MAX; i++)
+ for (int i = 0; i <= FONTID_MAX; i++)
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT));
}
@@ -877,8 +854,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- CLCINFOITEM cii = { 0 };
- cii.cbSize = sizeof(cii);
+ CLCINFOITEM cii = { sizeof(cii) };
cii.flags = CLCIIF_GROUPFONT | CLCIIF_CHECKBOX;
cii.pszText = TranslateT("** New contacts **");
hItemNew = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
@@ -951,9 +927,9 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam break;
case WM_NOTIFY:
- switch (((NMHDR*) lParam)->idFrom) {
+ switch (((NMHDR*)lParam)->idFrom) {
case IDC_CLIST:
- switch (((NMHDR*) lParam)->code) {
+ switch (((NMHDR*)lParam)->code) {
case CLN_OPTIONSCHANGED:
ResetCList(hwndDlg);
break;
@@ -963,16 +939,16 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam }
break;
case 0:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
SaveList(hwndDlg, hItemNew, hItemUnknown);
- db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
- db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEFLASHWIN));
- db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPENOWIN));
- db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN));
- db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
- db_set_b(0, SRMSGMOD, "ShowTypingBalloon", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYBALLOON));
- db_set_b(0, SRMSGMOD, "ShowTypingPopup",(BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP));
+ db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
+ db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPEFLASHWIN));
+ db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPENOWIN));
+ db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN));
+ db_set_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
+ db_set_b(0, SRMSGMOD, "ShowTypingBalloon", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYBALLOON));
+ db_set_b(0, SRMSGMOD, "ShowTypingPopup", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP));
db_set_b(0, SRMSGMOD_T, "MTN_PopupMode", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_GETCURSEL, 0, 0));
PluginConfig.reloadSettings();
}
@@ -981,29 +957,26 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam return FALSE;
}
-/*
- * options for tabbed messaging got their own page.. finally :)
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// options for tabbed messaging got their own page.. finally :)
static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG: {
- TVINSERTSTRUCT tvi = {0};
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ {
+ TVINSERTSTRUCT tvi = { 0 };
int i;
- TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TABMSGOPTIONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TABMSGOPTIONS), GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES));
g_himlOptions = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_TABMSGOPTIONS, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList());
ImageList_Destroy(g_himlOptions);
- /*
- * fill the list box, create groups first, then add items
- */
-
+ // fill the list box, create groups first, then add items
TOptionListGroup *tabGroups = CTranslator::getGroupTree(CTranslator::TREE_TAB);
- for (i=0; tabGroups[i].szName != NULL; i++) {
+ for (i = 0; tabGroups[i].szName != NULL; i++) {
tvi.hParent = 0;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
@@ -1014,7 +987,7 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar }
TOptionListItem *tabItems = CTranslator::getTree(CTranslator::TREE_TAB);
- for (i=0; tabItems[i].szName != 0; i++) {
+ for (i = 0; tabItems[i].szName != 0; i++) {
tvi.hParent = (HTREEITEM)tabGroups[tabItems[i].uGroup].handle;
tvi.hInsertAfter = TVI_LAST;
tvi.item.pszText = TranslateTS(tabItems[i].szName);
@@ -1037,98 +1010,102 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar SendDlgItemMessage(hwndDlg, IDC_ESCMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Minimize the window to the task bar"));
SendDlgItemMessage(hwndDlg, IDC_ESCMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Close or hide window, depends on the close button setting above"));
SendDlgItemMessage(hwndDlg, IDC_ESCMODE, CB_SETCURSEL, (WPARAM)PluginConfig.m_EscapeCloses, 0);
- break;
}
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_CUT_TITLEMAX:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- break;
- case IDC_SETUPAUTOCREATEMODES: {
- HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hwndDlg, DlgProcSetupStatusModes, M.GetDword("autopopupmask", -1));
- SendMessage(hwndNew, DM_SETPARENTDIALOG, 0, (LPARAM)hwndDlg);
- break;
- }
- case IDC_CUT_TABTITLE:
- Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAX, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE));
- Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAXSPIN, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE));
- break;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_CUT_TITLEMAX:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
+ return TRUE;
break;
- case DM_STATUSMASKSET:
- db_set_dw(0, SRMSGMOD_T, "autopopupmask", (DWORD)lParam);
+ case IDC_SETUPAUTOCREATEMODES: {
+ HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hwndDlg, DlgProcSetupStatusModes, M.GetDword("autopopupmask", -1));
+ SendMessage(hwndNew, DM_SETPARENTDIALOG, 0, (LPARAM)hwndDlg);
break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case IDC_TABMSGOPTIONS:
- if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
- TVHITTESTINFO hti;
- TVITEM item = {0};
-
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
- if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
- hti.flags |= TVHT_ONITEMSTATEICON;
- item.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
- } else
- item.hItem = (HTREEITEM)hti.hItem;
- SendDlgItemMessageA(hwndDlg, IDC_TABMSGOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
- if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
- item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
- SendDlgItemMessageA(hwndDlg, IDC_TABMSGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
- } else if (hti.flags & TVHT_ONITEMSTATEICON) {
-
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
- item.state = INDEXTOSTATEIMAGEMASK(1);
- SendDlgItemMessageA(hwndDlg, IDC_TABMSGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
- }
-
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
+ }
+ case IDC_CUT_TABTITLE:
+ Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAX, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE));
+ Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAXSPIN, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE));
+ break;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case DM_STATUSMASKSET:
+ db_set_dw(0, SRMSGMOD_T, "autopopupmask", (DWORD)lParam);
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case IDC_TABMSGOPTIONS:
+ if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) {
+ TVITEM item = { 0 };
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
+
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
+ if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
+ hti.flags |= TVHT_ONITEMSTATEICON;
+ item.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom);
}
- break;
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY: {
- TVITEM item = {0};
- db_set_b(0, SRMSGMOD_T, "cuttitle", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE));
- db_set_w(NULL, SRMSGMOD_T, "cut_at", (WORD)SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_GETPOS, 0, 0));
-
- /*
- * scan the tree view and obtain the options...
- */
-
- TOptionListItem *tabItems = CTranslator::getTree(CTranslator::TREE_TAB);
- for (int i=0; tabItems[i].szName != NULL; i++) {
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.hItem = (HTREEITEM)tabItems[i].handle;
- item.stateMask = TVIS_STATEIMAGEMASK;
-
- SendDlgItemMessageA(hwndDlg, IDC_TABMSGOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
- if (tabItems[i].uType == LOI_TYPE_SETTING)
- db_set_b(0, SRMSGMOD_T, (char *)tabItems[i].lParam, (BYTE)((item.state >> 12) == 3/*2*/ ? 1 : 0));
- }
-
- PluginConfig.m_EscapeCloses = (int)SendDlgItemMessage(hwndDlg, IDC_ESCMODE, CB_GETCURSEL, 0, 0);
- db_set_b(0, SRMSGMOD_T, "escmode", (BYTE)PluginConfig.m_EscapeCloses);
- PluginConfig.reloadSettings();
- M.BroadcastMessage(DM_OPTIONSAPPLIED, 0, 0);
- return TRUE;
+ else item.hItem = (HTREEITEM)hti.hItem;
+
+ SendDlgItemMessageA(hwndDlg, IDC_TABMSGOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
+ if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
+ item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
+ SendDlgItemMessageA(hwndDlg, IDC_TABMSGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
+ }
+ else if (hti.flags & TVHT_ONITEMSTATEICON) {
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
+ item.state = INDEXTOSTATEIMAGEMASK(1);
+ SendDlgItemMessageA(hwndDlg, IDC_TABMSGOPTIONS, TVM_SETITEMA, 0, (LPARAM)&item);
}
+
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
+ }
}
break;
+
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ TVITEM item = { 0 };
+ db_set_b(0, SRMSGMOD_T, "cuttitle", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE));
+ db_set_w(NULL, SRMSGMOD_T, "cut_at", (WORD)SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_GETPOS, 0, 0));
+
+ // scan the tree view and obtain the options...
+ TOptionListItem *tabItems = CTranslator::getTree(CTranslator::TREE_TAB);
+ for (int i = 0; tabItems[i].szName != NULL; i++) {
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.hItem = (HTREEITEM)tabItems[i].handle;
+ item.stateMask = TVIS_STATEIMAGEMASK;
+
+ SendDlgItemMessageA(hwndDlg, IDC_TABMSGOPTIONS, TVM_GETITEMA, 0, (LPARAM)&item);
+ if (tabItems[i].uType == LOI_TYPE_SETTING)
+ db_set_b(0, SRMSGMOD_T, (char *)tabItems[i].lParam, (BYTE)((item.state >> 12) == 3/*2*/ ? 1 : 0));
+ }
+
+ PluginConfig.m_EscapeCloses = (int)SendDlgItemMessage(hwndDlg, IDC_ESCMODE, CB_GETCURSEL, 0, 0);
+ db_set_b(0, SRMSGMOD_T, "escmode", (BYTE)PluginConfig.m_EscapeCloses);
+ PluginConfig.reloadSettings();
+ M.BroadcastMessage(DM_OPTIONSAPPLIED, 0, 0);
+ return TRUE;
+ }
+ }
+ break;
}
return FALSE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// container options
+
static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -1154,7 +1131,7 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM SendDlgItemMessage(hwndDlg, IDC_FLASHINTERVALSPIN, UDM_SETACCEL, 0, (int)M.GetDword("flashinterval", 1000));
CheckDlgButton(hwndDlg, IDC_USEAERO, M.GetByte("useAero", 1));
CheckDlgButton(hwndDlg, IDC_USEAEROPEEK, M.GetByte("useAeroPeek", 1));
- for (int i=0; i < CSkin::AERO_EFFECT_LAST; i++)
+ for (int i = 0; i < CSkin::AERO_EFFECT_LAST; i++)
SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(CSkin::m_aeroEffects[i].tszName));
SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_SETCURSEL, (WPARAM)CSkin::m_aeroEffect, 0);
@@ -1168,7 +1145,7 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_TABLIMIT:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
return TRUE;
break;
case IDC_USEAERO:
@@ -1188,9 +1165,9 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM break;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
BOOL translated;
bool fOldAeroState = M.getAeroState();
@@ -1217,6 +1194,8 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM return FALSE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
#define DBFONTF_BOLD 1
#define DBFONTF_ITALIC 2
#define DBFONTF_UNDERLINE 4
@@ -1475,8 +1454,8 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR bInit = TRUE;
- for (int i=0; i < SIZEOF(opts); ++i)
- OptCheckBox_Load(hwndDlg, opts+i);
+ for (int i = 0; i < SIZEOF(opts); ++i)
+ OptCheckBox_Load(hwndDlg, opts + i);
// Always on!
CheckDlgButton(hwndDlg, IDC_SENDCTRLENTER, BST_CHECKED);
@@ -1546,7 +1525,7 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR Utils::enableDlgControl(hwndDlg, IDC_TRIM, IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM));
break;
case IDC_TRIM:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
return TRUE;
break;
}
@@ -1555,12 +1534,12 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR break;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- for (int i=0; i < SIZEOF(opts); ++i)
- OptCheckBox_Save(hwndDlg, opts+i);
+ for (int i = 0; i < SIZEOF(opts); ++i)
+ OptCheckBox_Save(hwndDlg, opts + i);
if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
db_set_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
@@ -1568,8 +1547,8 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR db_set_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
else
db_set_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM))
db_set_dw(0, SRMSGMOD_T, "maxhist", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_GETPOS, 0, 0));
@@ -1609,10 +1588,8 @@ static int ModernOptInitialise(WPARAM wParam, LPARAM lParam) MODERNOPT_CTRL_LAST
};
- MODERNOPTOBJECT obj = {0};
-
- obj.cbSize = sizeof(obj);
- obj.dwFlags = MODEROPT_FLG_TCHAR|MODEROPT_FLG_NORESIZE;
+ MODERNOPTOBJECT obj = { sizeof(obj) };
+ obj.dwFlags = MODEROPT_FLG_TCHAR | MODEROPT_FLG_NORESIZE;
obj.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
obj.hInstance = g_hInst;
obj.iSection = MODERNOPT_PAGE_MSGS;
@@ -1685,7 +1662,7 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, DestroyWindow(hwndDlg);
break;
case IDC_ALWAYS:
- for (int i=ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
Utils::enableDlgControl(hwndDlg, i, !IsDlgButtonChecked(hwndDlg, IDC_ALWAYS));
break;
}
|