summaryrefslogtreecommitdiff
path: root/plugins/TipperYM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-05 21:55:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-05 21:55:21 +0000
commit2aabf6594cb0fb4f8db16771c988bf5a6eab2c4b (patch)
tree202865579328cc407dc249ca6ed3ea80f9f6f80a /plugins/TipperYM
parent9de8f2a1584b810d0fc651704f7f732dc0943d86 (diff)
Unicode windows procedure, suddenly...
git-svn-id: http://svn.miranda-ng.org/main/trunk@13456 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TipperYM')
-rw-r--r--plugins/TipperYM/src/options.cpp1468
1 files changed, 643 insertions, 825 deletions
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp
index c20d0645ea..69444dcb69 100644
--- a/plugins/TipperYM/src/options.cpp
+++ b/plugins/TipperYM/src/options.cpp
@@ -36,8 +36,7 @@ extern int IsTrayProto(const TCHAR *swzProto, BOOL bExtendedTip)
DBVARIANT dbv;
int result = 1;
- if (!db_get_ts(NULL, MODULE, szSetting, &dbv))
- {
+ if (!db_get_ts(NULL, MODULE, szSetting, &dbv)) {
result = _tcsstr(dbv.ptszVal, swzProto) ? 1 : 0;
db_free(&dbv);
}
@@ -47,10 +46,8 @@ extern int IsTrayProto(const TCHAR *swzProto, BOOL bExtendedTip)
void CreateDefaultItems()
{
- for (int i = 0; defaultItemList[i].szName; i++)
- {
- if (defaultItemList[i].szName[0] == '-')
- {
+ for (int i = 0; defaultItemList[i].szName; i++) {
+ if (defaultItemList[i].szName[0] == '-') {
DIListNode *di_node = (DIListNode *)mir_alloc(sizeof(DIListNode));
_tcsncpy(di_node->di.swzLabel, _T(""), LABEL_LEN);
_tcsncpy(di_node->di.swzValue, _T(""), VALUE_LEN);
@@ -61,13 +58,11 @@ void CreateDefaultItems()
opt.diList = di_node;
opt.iDiCount++;
}
- else
- {
+ else {
PRESETITEM *item = GetPresetItemByName(defaultItemList[i].szName);
if (item == NULL) continue;
- for (int j = 0; j < MAX_PRESET_SUBST_COUNT; j++)
- {
+ for (int j = 0; j < MAX_PRESET_SUBST_COUNT; j++) {
PRESETSUBST *subst = GetPresetSubstByName(item->szNeededSubst[j]);
if (subst == NULL) continue;
@@ -114,8 +109,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index)
mir_snprintf(setting, SIZEOF(setting), "Module%d", index);
ds->szModuleName[0] = 0;
- if (!db_get(0, MODULE_ITEMS, setting, &dbv))
- {
+ if (!db_get(0, MODULE_ITEMS, setting, &dbv)) {
strncpy(ds->szModuleName, dbv.pszVal, MODULE_NAME_LEN);
ds->szModuleName[MODULE_NAME_LEN - 1] = 0;
db_free(&dbv);
@@ -123,8 +117,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index)
mir_snprintf(setting, SIZEOF(setting), "Setting%d", index);
ds->szSettingName[0] = 0;
- if (!db_get(0, MODULE_ITEMS, setting, &dbv))
- {
+ if (!db_get(0, MODULE_ITEMS, setting, &dbv)) {
strncpy(ds->szSettingName, dbv.pszVal, SETTING_NAME_LEN);
ds->szSettingName[SETTING_NAME_LEN - 1] = 0;
db_free(&dbv);
@@ -134,8 +127,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index)
ds->iTranslateFuncId = db_get_dw(0, MODULE_ITEMS, setting, (DWORD)-1);
// a little backward compatibility
- if ((DWORD)ds->iTranslateFuncId == (DWORD)-1)
- {
+ if ((DWORD)ds->iTranslateFuncId == (DWORD)-1) {
mir_snprintf(setting, SIZEOF(setting), "TransFunc%d", index);
ds->iTranslateFuncId = (DWORD)db_get_w(0, MODULE_ITEMS, setting, 0);
}
@@ -169,14 +161,13 @@ bool LoadDI(DISPLAYITEM *di, int index)
if (db_get_ts(0, MODULE_ITEMS, setting, &dbv))
return false;
- _tcsncpy( di->swzLabel, dbv.ptszVal, SIZEOF(di->swzLabel));
+ _tcsncpy(di->swzLabel, dbv.ptszVal, SIZEOF(di->swzLabel));
di->swzLabel[SIZEOF(di->swzLabel) - 1] = 0;
db_free(&dbv);
mir_snprintf(setting, SIZEOF(setting), "DIValue%d", index);
di->swzValue[0] = 0;
- if (!db_get_ts(0, MODULE_ITEMS, setting, &dbv))
- {
+ if (!db_get_ts(0, MODULE_ITEMS, setting, &dbv)) {
_tcsncpy(di->swzValue, dbv.ptszVal, SIZEOF(di->swzValue));
di->swzValue[SIZEOF(di->swzValue) - 1] = 0;
db_free(&dbv);
@@ -201,16 +192,14 @@ void SaveDI(DISPLAYITEM *di, int index)
char setting[512];
mir_snprintf(setting, SIZEOF(setting), "DILabel%d", index);
- if (db_set_ts(0, MODULE_ITEMS, setting, di->swzLabel))
- {
+ if (db_set_ts(0, MODULE_ITEMS, setting, di->swzLabel)) {
char buff[LABEL_LEN];
t2a(di->swzLabel, buff, LABEL_LEN);
db_set_s(0, MODULE_ITEMS, setting, buff);
}
mir_snprintf(setting, SIZEOF(setting), "DIValue%d", index);
- if (db_set_ts(0, MODULE_ITEMS, setting, di->swzValue))
- {
+ if (db_set_ts(0, MODULE_ITEMS, setting, di->swzValue)) {
char buff[VALUE_LEN];
t2a(di->swzValue, buff, VALUE_LEN);
db_set_s(0, MODULE_ITEMS, setting, buff);
@@ -273,8 +262,7 @@ void SaveItems()
{
int index = 0;
DSListNode *ds_node = opt.dsList;
- while (ds_node)
- {
+ while (ds_node) {
SaveDS(&ds_node->ds, index);
ds_node = ds_node->next;
index++;
@@ -285,8 +273,7 @@ void SaveItems()
index = 0;
DIListNode *di_node = opt.diList;
opt.bWaitForStatusMsg = false;
- while (di_node)
- {
+ while (di_node) {
SaveDI(&di_node->di, index);
if (di_node->di.bIsVisible && _tcsstr(di_node->di.swzValue, _T("sys:status_msg")))
opt.bWaitForStatusMsg = true;
@@ -316,13 +303,11 @@ void LoadObsoleteSkinSetting()
char setting[128];
DBVARIANT dbv;
- for (int i = 0; i < SKIN_ITEMS_COUNT; i++)
- {
+ for (int i = 0; i < SKIN_ITEMS_COUNT; i++) {
mir_snprintf(setting, SIZEOF(setting), "SPaintMode%d", i);
opt.transfMode[i] = (TransformationMode)db_get_b(0, MODULE, setting, 0);
mir_snprintf(setting, SIZEOF(setting), "SImgFile%d", i);
- if (!db_get_ts(NULL, MODULE, setting, &dbv))
- {
+ if (!db_get_ts(NULL, MODULE, setting, &dbv)) {
opt.szImgFile[i] = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -363,11 +348,9 @@ void LoadOptions()
DSListNode *ds_node;
opt.iDsCount = db_get_w(0, MODULE_ITEMS, "DSNumValues", 0);
- for (i = opt.iDsCount - 1; i >= 0; i--)
- {
+ for (i = opt.iDsCount - 1; i >= 0; i--) {
ds_node = (DSListNode *)mir_alloc(sizeof(DSListNode));
- if (LoadDS(&ds_node->ds, i))
- {
+ if (LoadDS(&ds_node->ds, i)) {
ds_node->next = opt.dsList;
opt.dsList = ds_node;
real_count++;
@@ -383,11 +366,9 @@ void LoadOptions()
opt.bWaitForStatusMsg = false;
opt.iDiCount = db_get_w(0, MODULE_ITEMS, "DINumValues", 0);
- for (i = opt.iDiCount - 1; i >= 0; i--)
- {
+ for (i = opt.iDiCount - 1; i >= 0; i--) {
di_node = (DIListNode *)mir_alloc(sizeof(DIListNode));
- if (LoadDI(&di_node->di, i))
- {
+ if (LoadDI(&di_node->di, i)) {
di_node->next = opt.diList;
opt.diList = di_node;
real_count++;
@@ -412,8 +393,7 @@ void LoadOptions()
opt.bStatusBarTips = (db_get_b(0, MODULE, "SBarTips", 1) == 1);
// convert defunct last message and status message options to new 'sys' items, and remove the old settings
- if (db_get_b(0, MODULE, "ShowLastMessage", 0))
- {
+ if (db_get_b(0, MODULE, "ShowLastMessage", 0)) {
db_unset(0, MODULE, "ShowLastMessage");
// find end of list
@@ -422,13 +402,11 @@ void LoadOptions()
di_node = di_node->next;
// last message item
- if (di_node)
- {
+ if (di_node) {
di_node->next = (DIListNode *)mir_alloc(sizeof(DIListNode));
di_node = di_node->next;
}
- else
- {
+ else {
opt.diList = (DIListNode *)mir_alloc(sizeof(DIListNode));
di_node = opt.diList;
}
@@ -440,8 +418,7 @@ void LoadOptions()
opt.iDiCount++;
}
- if (db_get_b(0, MODULE, "ShowStatusMessage", 0))
- {
+ if (db_get_b(0, MODULE, "ShowStatusMessage", 0)) {
db_unset(0, MODULE, "ShowStatusMessage");
// find end of list
@@ -450,13 +427,11 @@ void LoadOptions()
di_node = di_node->next;
// status message item
- if (di_node)
- {
+ if (di_node) {
di_node->next = (DIListNode *)mir_alloc(sizeof(DIListNode));
di_node = di_node->next;
}
- else
- {
+ else {
opt.diList = (DIListNode *)mir_alloc(sizeof(DIListNode));
di_node = opt.diList;
}
@@ -484,7 +459,7 @@ void LoadOptions()
opt.iFavoriteContFlags = db_get_dw(0, MODULE, "FavContFlags", FAVCONT_APPEND_PROTO);
// extra setting
- opt.bWaitForContent= db_get_b(0, MODULE, "WaitForContent", 0) ? true : false;
+ opt.bWaitForContent = db_get_b(0, MODULE, "WaitForContent", 0) ? true : false;
opt.bGetNewStatusMsg = db_get_b(0, MODULE, "GetNewStatusMsg", 0) ? true : false;
opt.bDisableIfInvisible = db_get_b(0, MODULE, "DisableInvisible", 1) ? true : false;
opt.bRetrieveXstatus = db_get_b(0, MODULE, "RetrieveXStatus", 0) ? true : false;
@@ -496,26 +471,22 @@ void LoadOptions()
DBVARIANT dbv;
// Load the icons order
- for (i = 0; i < EXICONS_COUNT; i++)
- {
- opt.exIconsOrder[i]=i;
- opt.exIconsVis[i]=1;
+ for (i = 0; i < EXICONS_COUNT; i++) {
+ opt.exIconsOrder[i] = i;
+ opt.exIconsVis[i] = 1;
}
- if (!db_get(NULL, MODULE, "IconOrder", &dbv))
- {
- memcpy(opt.exIconsOrder,dbv.pbVal,dbv.cpbVal);
+ if (!db_get(NULL, MODULE, "IconOrder", &dbv)) {
+ memcpy(opt.exIconsOrder, dbv.pbVal, dbv.cpbVal);
db_free(&dbv);
}
- if (!db_get(NULL, MODULE, "icons_vis", &dbv))
- {
- memcpy(opt.exIconsVis,dbv.pbVal,dbv.cpbVal);
+ if (!db_get(NULL, MODULE, "icons_vis", &dbv)) {
+ memcpy(opt.exIconsVis, dbv.pbVal, dbv.cpbVal);
db_free(&dbv);
}
- for (i = 0; i < EXICONS_COUNT; i++)
- {
+ for (i = 0; i < EXICONS_COUNT; i++) {
exIcons[i].order = opt.exIconsOrder[i];
exIcons[i].vis = opt.exIconsVis[i];
}
@@ -536,25 +507,21 @@ void LoadOptions()
int iBgImg = db_get_b(0, MODULE, "SBgImage", 0);
opt.skinMode = (SkinMode)db_get_b(0, MODULE, "SkinEngine", iBgImg ? SM_OBSOLOTE : SM_COLORFILL);
opt.bLoadFonts = db_get_b(0, MODULE, "LoadFonts", 1) ? true : false;
- opt.bLoadProportions= db_get_b(0, MODULE, "LoadProportions", 1) ? true : false;
+ opt.bLoadProportions = db_get_b(0, MODULE, "LoadProportions", 1) ? true : false;
opt.iEnableColoring = db_get_dw(0, MODULE, "EnableColoring", 0);
opt.szSkinName[0] = 0;
- if (opt.skinMode == SM_OBSOLOTE)
- {
+ if (opt.skinMode == SM_OBSOLOTE) {
LoadObsoleteSkinSetting();
}
- else if (opt.skinMode == SM_IMAGE)
- {
- if (!db_get_ts(NULL, MODULE, "SkinName", &dbv))
- {
- _tcsncpy(opt.szSkinName, dbv.ptszVal,SIZEOF(opt.szSkinName)-1);
+ else if (opt.skinMode == SM_IMAGE) {
+ if (!db_get_ts(NULL, MODULE, "SkinName", &dbv)) {
+ _tcsncpy(opt.szSkinName, dbv.ptszVal, SIZEOF(opt.szSkinName) - 1);
db_free(&dbv);
}
}
- if (opt.iDsCount == 0 && opt.iDiCount == 0)
- {
+ if (opt.iDsCount == 0 && opt.iDiCount == 0) {
// set up some reasonable defaults
CreateDefaultItems();
SaveOptions();
@@ -566,19 +533,17 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
DISPLAYITEM *di = (DISPLAYITEM *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
di = (DISPLAYITEM *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)di);
SetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel);
SetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue);
- for (int i = 0; i < SIZEOF(displayItemTypes); i++)
- {
+ for (int i = 0; i < SIZEOF(displayItemTypes); i++) {
int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateTS(displayItemTypes[i].title));
SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETITEMDATA, index, (LPARAM)displayItemTypes[i].type);
if (displayItemTypes[i].type == di->type)
@@ -597,21 +562,18 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SetFocus(GetDlgItem(hwndDlg, IDC_ED_LABEL));
return TRUE;
}
- case WM_COMMAND:
+ case WM_COMMAND:
{
- if (HIWORD(wParam) == BN_CLICKED)
- {
- switch(LOWORD(wParam))
- {
- case IDOK:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
+ case IDOK:
{
GetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel, LABEL_LEN);
GetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue, VALUE_LEN);
int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETCURSEL, 0, 0);
int type = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETITEMDATA, sel, 0);
- for (int i = 0; i < SIZEOF(displayItemTypes); i++)
- {
+ for (int i = 0; i < SIZEOF(displayItemTypes); i++) {
if (displayItemTypes[i].type == type)
di->type = displayItemTypes[i].type;
}
@@ -621,14 +583,11 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
di->bParseTipperVarsFirst = (IsDlgButtonChecked(hwndDlg, IDC_CHK_PARSETIPPERFIRST) ? true : false);
sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0);
- if (sel != CB_ERR)
- {
+ if (sel != CB_ERR) {
TCHAR buff[256];
SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETLBTEXT, sel, (LPARAM)buff);
- for (int i = 0; presetItems[i].szID; i++)
- {
- if (_tcscmp(buff, TranslateTS(presetItems[i].swzName)) == 0)
- {
+ for (int i = 0; presetItems[i].szID; i++) {
+ if (_tcscmp(buff, TranslateTS(presetItems[i].swzName)) == 0) {
if (presetItems[i].szNeededSubst[0])
EndDialog(hwndDlg, IDPRESETITEM + i);
else
@@ -642,12 +601,12 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return TRUE;
}
- case IDCANCEL:
+ case IDCANCEL:
{
EndDialog(hwndDlg, IDCANCEL);
return TRUE;
}
- case IDC_BTN_VARIABLE:
+ case IDC_BTN_VARIABLE:
{
if (GetFocus() == GetDlgItem(hwndDlg, IDC_ED_LABEL))
variables_showhelp(hwndDlg, IDC_ED_LABEL, VHF_FULLDLG, NULL, NULL);
@@ -657,19 +616,14 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
}
}
- else if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- if (LOWORD(wParam) == IDC_CMB_PRESETITEMS)
- {
+ else if (HIWORD(wParam) == CBN_SELCHANGE) {
+ if (LOWORD(wParam) == IDC_CMB_PRESETITEMS) {
int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0);
- if (sel != CB_ERR)
- {
+ if (sel != CB_ERR) {
TCHAR buff[256];
SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETLBTEXT, sel, (LPARAM)buff);
- for (int i = 0; presetItems[i].szID; i++)
- {
- if (_tcscmp(buff, TranslateTS(presetItems[i].swzName)) == 0)
- {
+ for (int i = 0; presetItems[i].szID; i++) {
+ if (_tcscmp(buff, TranslateTS(presetItems[i].swzName)) == 0) {
SetDlgItemText(hwndDlg, IDC_ED_LABEL, TranslateTS(presetItems[i].swzLabel));
SetDlgItemText(hwndDlg, IDC_ED_VALUE, presetItems[i].swzValue);
break;
@@ -689,36 +643,32 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
DISPLAYSUBST *ds = (DISPLAYSUBST *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
ds = (DISPLAYSUBST *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)ds);
SetDlgItemText(hwndDlg, IDC_ED_LABEL, ds->swzName);
- switch (ds->type)
- {
- case DVT_PROTODB:
- CheckDlgButton(hwndDlg, IDC_CHK_PROTOMOD, BST_CHECKED);
- SetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName);
- break;
- case DVT_DB:
- SetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName);
- SetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName);
- break;
+ switch (ds->type) {
+ case DVT_PROTODB:
+ CheckDlgButton(hwndDlg, IDC_CHK_PROTOMOD, BST_CHECKED);
+ SetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName);
+ break;
+ case DVT_DB:
+ SetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName);
+ SetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName);
+ break;
}
- for (int i = 0; i < iTransFuncsCount; i++)
- {
+ for (int i = 0; i < iTransFuncsCount; i++) {
int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateTS(translations[i].swzName));
SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_SETITEMDATA, index, (LPARAM)translations[i].id);
}
- for (int i = 0; i < iTransFuncsCount; i++)
- {
+ for (int i = 0; i < iTransFuncsCount; i++) {
int id = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETITEMDATA, i, 0);
if (id == ds->iTranslateFuncId)
SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_SETCURSEL, i, 0);
@@ -728,7 +678,7 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
SetFocus(GetDlgItem(hwndDlg, IDC_ED_LABEL));
return TRUE;
}
- case WMU_ENABLE_MODULE_ENTRY:
+ case WMU_ENABLE_MODULE_ENTRY:
{
HWND hw = GetDlgItem(hwndDlg, IDC_CHK_PROTOMOD);
EnableWindow(hw, TRUE);
@@ -738,30 +688,26 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
EnableWindow(hw, TRUE);
return TRUE;
}
- case WM_COMMAND:
+ case WM_COMMAND:
{
- if (HIWORD(wParam) == BN_CLICKED)
- {
- switch (LOWORD(wParam))
- {
- case IDC_CHK_PROTOMOD:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
+ case IDC_CHK_PROTOMOD:
{
SendMessage(hwndDlg, WMU_ENABLE_MODULE_ENTRY, 0, 0);
break;
}
- case IDOK:
+ case IDOK:
{
GetDlgItemText(hwndDlg, IDC_ED_LABEL, ds->swzName, LABEL_LEN);
- if (ds->swzName[0] == 0)
- {
+ if (ds->swzName[0] == 0) {
MessageBox(hwndDlg, TranslateT("You must enter a label"), TranslateT("Invalid Substitution"), MB_OK | MB_ICONWARNING);
return TRUE;
}
if (IsDlgButtonChecked(hwndDlg, IDC_CHK_PROTOMOD))
ds->type = DVT_PROTODB;
- else
- {
+ else {
ds->type = DVT_DB;
GetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName, SIZEOF(ds->szModuleName));
}
@@ -774,7 +720,7 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
EndDialog(hwndDlg, IDOK);
return TRUE;
}
- case IDCANCEL:
+ case IDCANCEL:
{
EndDialog(hwndDlg, IDCANCEL);
return TRUE;
@@ -793,8 +739,7 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
static void SetTreeItemText(DIListNode *node, TCHAR **pszText)
{
- if (node->di.swzLabel[0] == 0)
- {
+ if (node->di.swzLabel[0] == 0) {
if (node->di.swzValue[0] == 0 && node->di.bLineAbove)
*pszText = _T("--------------------------------------");
else
@@ -805,49 +750,45 @@ static void SetTreeItemText(DIListNode *node, TCHAR **pszText)
}
static OPTBUTTON btns[9] = {
- IDC_BTN_ADD, SKINICON_OTHER_ADDCONTACT, 0, LPGENT("Add item"),
- IDC_BTN_SEPARATOR, 0, IDI_SEPARATOR, LPGENT("Add separator"),
- IDC_BTN_EDIT, SKINICON_OTHER_RENAME, 0, LPGENT("Edit"),
- IDC_BTN_REMOVE, SKINICON_OTHER_DELETE, 0, LPGENT("Remove"),
- IDC_BTN_UP, 0, IDI_UP, LPGENT("Move up"),
- IDC_BTN_DOWN, 0, IDI_DOWN, LPGENT("Move down"),
- IDC_BTN_ADD2, SKINICON_OTHER_ADDCONTACT, 0, LPGENT("Add"),
- IDC_BTN_REMOVE2, SKINICON_OTHER_DELETE, 0, LPGENT("Remove"),
- IDC_BTN_EDIT2, SKINICON_OTHER_RENAME, 0, LPGENT("Edit")
+ IDC_BTN_ADD, SKINICON_OTHER_ADDCONTACT, 0, LPGENT("Add item"),
+ IDC_BTN_SEPARATOR, 0, IDI_SEPARATOR, LPGENT("Add separator"),
+ IDC_BTN_EDIT, SKINICON_OTHER_RENAME, 0, LPGENT("Edit"),
+ IDC_BTN_REMOVE, SKINICON_OTHER_DELETE, 0, LPGENT("Remove"),
+ IDC_BTN_UP, 0, IDI_UP, LPGENT("Move up"),
+ IDC_BTN_DOWN, 0, IDI_DOWN, LPGENT("Move down"),
+ IDC_BTN_ADD2, SKINICON_OTHER_ADDCONTACT, 0, LPGENT("Add"),
+ IDC_BTN_REMOVE2, SKINICON_OTHER_DELETE, 0, LPGENT("Remove"),
+ IDC_BTN_EDIT2, SKINICON_OTHER_RENAME, 0, LPGENT("Edit")
};
INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
- for (int i = 0; i < SIZEOF(btns); i++)
- {
- SendDlgItemMessage(hwndDlg, btns[i].id, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, btns[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(btns[i].swzTooltip), BATF_TCHAR);
- if (btns[i].uintCoreIconId)
- SendDlgItemMessage(hwndDlg, btns[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(btns[i].uintCoreIconId));
- else
- {
- HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(btns[i].uintResIconId));
- SendDlgItemMessage(hwndDlg, btns[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
- DestroyIcon(hIcon);
- }
+ for (int i = 0; i < SIZEOF(btns); i++) {
+ SendDlgItemMessage(hwndDlg, btns[i].id, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, btns[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(btns[i].swzTooltip), BATF_TCHAR);
+ if (btns[i].uintCoreIconId)
+ SendDlgItemMessage(hwndDlg, btns[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(btns[i].uintCoreIconId));
+ else {
+ HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(btns[i].uintResIconId));
+ SendDlgItemMessage(hwndDlg, btns[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
+ DestroyIcon(hIcon);
}
+ }
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE) | TVS_CHECKBOXES);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE) | TVS_CHECKBOXES);
+ {
- TVINSERTSTRUCT tvi = {0};
+ TVINSERTSTRUCT tvi = { 0 };
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
DIListNode *di_node = opt.diList, *di_value;
- while (di_node)
- {
+ while (di_node) {
di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
*di_value = *di_node;
tvi.item.lParam = (LPARAM)di_value;
@@ -858,8 +799,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
DSListNode *ds_node = opt.dsList, *ds_value;
- while (ds_node)
- {
+ while (ds_node) {
ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
*ds_value = *ds_node;
int index = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
@@ -870,18 +810,17 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
return FALSE;
}
- case WMU_ENABLE_LIST_BUTTONS:
+
+ case WMU_ENABLE_LIST_BUTTONS:
{
HTREEITEM hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
- if (hItem)
- {
+ if (hItem) {
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_REMOVE), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UP), TreeView_GetPrevSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem) ? TRUE : FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem) ? TRUE : FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_EDIT), TRUE);
}
- else
- {
+ else {
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_REMOVE), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UP), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), FALSE);
@@ -889,135 +828,60 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
int sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCURSEL, 0, 0);
- if (sel == -1)
- {
+ if (sel == -1) {
HWND hw = GetDlgItem(hwndDlg, IDC_BTN_REMOVE2);
EnableWindow(hw, FALSE);
hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT2);
EnableWindow(hw, FALSE);
}
- else
- {
+ else {
HWND hw = GetDlgItem(hwndDlg, IDC_BTN_REMOVE2);
EnableWindow(hw, TRUE);
hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT2);
EnableWindow(hw, TRUE);
}
- return TRUE;
}
- case WM_COMMAND:
- {
- if (HIWORD(wParam) == LBN_SELCHANGE && LOWORD(wParam) == IDC_LST_SUBST)
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- else if (HIWORD(wParam) == CBN_SELCHANGE)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- else if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- else if (HIWORD(wParam) == LBN_DBLCLK && LOWORD(wParam) == IDC_LST_SUBST)
- {
- int sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCURSEL, 0, 0);
- if (sel != CB_ERR)
- {
- DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, sel, 0);
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK)
- {
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_DELETESTRING, (WPARAM)sel, 0);
+ return TRUE;
- sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, sel, (LPARAM)ds_value);
+ case WM_COMMAND:
+ if (HIWORD(wParam) == LBN_SELCHANGE && LOWORD(wParam) == IDC_LST_SUBST)
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
+ else if (HIWORD(wParam) == CBN_SELCHANGE)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ else if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ else if (HIWORD(wParam) == LBN_DBLCLK && LOWORD(wParam) == IDC_LST_SUBST) {
+ int sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCURSEL, 0, 0);
+ if (sel != CB_ERR) {
+ DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, sel, 0);
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_DELETESTRING, (WPARAM)sel, 0);
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETCURSEL, sel, 0);
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
+ sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, sel, (LPARAM)ds_value);
+
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETCURSEL, sel, 0);
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
- else if (HIWORD(wParam) == BN_CLICKED)
- {
- switch (LOWORD(wParam))
+ }
+ else if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
+ case IDC_BTN_ADD:
{
- case IDC_BTN_ADD:
- {
- DIListNode *di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
- memset(di_value, 0, sizeof(DIListNode));
- di_value->di.bIsVisible = true;
-
- int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di);
- if (result == IDOK || (result >= IDPRESETITEM && result < (IDPRESETITEM + 100)))
- {
- TVINSERTSTRUCT tvi = {0};
- tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
- tvi.item.stateMask = TVIS_STATEIMAGEMASK;
- tvi.item.lParam = (LPARAM)di_value;
- tvi.item.state = INDEXTOSTATEIMAGEMASK(2);
- SetTreeItemText(di_value, &tvi.item.pszText);
-
- HTREEITEM hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
- if (hItem)
- tvi.hInsertAfter = hItem;
- else
- tvi.hInsertAfter = TVI_LAST;
- TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi);
-
- if (hItem)
- {
- HTREEITEM hNewItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem);
- if (hNewItem)
- TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hNewItem);
- }
+ DIListNode *di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ memset(di_value, 0, sizeof(DIListNode));
+ di_value->di.bIsVisible = true;
- if (result >= IDPRESETITEM)
- {
- for (int i = 0; i < MAX_PRESET_SUBST_COUNT; i++)
- {
-
- PRESETSUBST *subst = GetPresetSubstByName(presetItems[result - IDPRESETITEM].szNeededSubst[i]);
- if (subst == NULL)
- break;
- if (SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_FINDSTRING, -1, (LPARAM)subst->swzName) == LB_ERR)
- {
- DSListNode *ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
- memset(ds_value, 0, sizeof(DSListNode));
- ds_value->next = NULL;
- ds_value->ds.type = subst->type;
- _tcsncpy(ds_value->ds.swzName, subst->swzName, LABEL_LEN-1);
-
- if (ds_value->ds.type == DVT_DB && subst->szModuleName)
- strncpy(ds_value->ds.szModuleName, subst->szModuleName, MODULE_NAME_LEN-1);
-
- if (subst->szSettingName)
- strncpy(ds_value->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN-1);
-
- ds_value->ds.iTranslateFuncId = subst->iTranslateFuncId;
-
- int index = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, index, (LPARAM)ds_value);
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETCURSEL, index, 0);
- }
- }
- }
-
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- else
- mir_free(di_value);
-
- return TRUE;
- }
- case IDC_BTN_SEPARATOR:
- {
- DIListNode *di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
- memset(di_value, 0, sizeof(DIListNode));
- di_value->di.bIsVisible = true;
- di_value->di.bLineAbove = true;
-
- TVINSERTSTRUCT tvi = {0};
+ int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di);
+ if (result == IDOK || (result >= IDPRESETITEM && result < (IDPRESETITEM + 100))) {
+ TVINSERTSTRUCT tvi = { 0 };
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
tvi.item.lParam = (LPARAM)di_value;
tvi.item.state = INDEXTOSTATEIMAGEMASK(2);
- tvi.item.pszText = _T("---------------------------------");
+ SetTreeItemText(di_value, &tvi.item.pszText);
HTREEITEM hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
if (hItem)
@@ -1026,230 +890,144 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
tvi.hInsertAfter = TVI_LAST;
TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi);
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- return TRUE;
- }
- case IDC_BTN_REMOVE:
- {
- TVITEM item = {0};
- item.mask = TVIF_PARAM;
- item.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
- if (item.hItem)
- {
- if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item))
- {
- DIListNode *di_value = (DIListNode *)item.lParam;
- mir_free(di_value);
- TreeView_DeleteItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), item.hItem);
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- return TRUE;
- }
- case IDC_BTN_UP:
- case IDC_BTN_DOWN:
- {
- HTREEITEM hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
- if (hItem)
- {
- HTREEITEM hNewItem;
- if (LOWORD(wParam) == IDC_BTN_UP)
- hNewItem = TreeView_GetPrevSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem);
- else
- hNewItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem);
-
+ if (hItem) {
+ HTREEITEM hNewItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem);
if (hNewItem)
- {
- TCHAR buff[512], buff2[512];
- LPARAM tmpParam;
- UINT tmpState;
-
- TVITEM item = {0};
- item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
- item.stateMask = TVIS_STATEIMAGEMASK;
- item.hItem = hItem;
- item.pszText = buff;
- item.cchTextMax = SIZEOF(buff);
- if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item))
- {
- tmpParam = item.lParam;
- tmpState = item.state;
- item.hItem = hNewItem;
- item.pszText = buff2;
- if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item))
- {
- item.hItem = hItem;
- TreeView_SetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
-
- item.hItem = hNewItem;
- item.pszText = buff;
- item.lParam = tmpParam;
- item.state = tmpState;
- TreeView_SetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
- TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hNewItem);
- }
- }
- }
+ TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hNewItem);
}
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- return TRUE;
- }
- case IDC_BTN_EDIT:
- {
- TVITEM item = {0};
- item.mask = TVIF_PARAM;
- item.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
- if (item.hItem )
- {
- if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item))
- {
- DIListNode *di_value = (DIListNode *)item.lParam;
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di) == IDOK)
- {
- item.mask = TVIF_TEXT;
- SetTreeItemText(di_value, &item.pszText);
- TreeView_SetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- }
-
- return TRUE;
- }
- case IDC_BTN_ADD2:
- {
- DSListNode *ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
- memset(ds_value, 0, sizeof(DSListNode));
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK)
- {
- int index = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, index, (LPARAM)ds_value);
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETCURSEL, index, 0);
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- else
- mir_free(ds_value);
+ if (result >= IDPRESETITEM) {
+ for (int i = 0; i < MAX_PRESET_SUBST_COUNT; i++) {
- return TRUE;
- }
- case IDC_BTN_REMOVE2:
- {
- int sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCURSEL, 0, 0);
- if (sel != LB_ERR)
- {
- DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, sel, 0);
- mir_free(ds_value);
+ PRESETSUBST *subst = GetPresetSubstByName(presetItems[result - IDPRESETITEM].szNeededSubst[i]);
+ if (subst == NULL)
+ break;
+ if (SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_FINDSTRING, -1, (LPARAM)subst->swzName) == LB_ERR) {
+ DSListNode *ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
+ memset(ds_value, 0, sizeof(DSListNode));
+ ds_value->next = NULL;
+ ds_value->ds.type = subst->type;
+ _tcsncpy(ds_value->ds.swzName, subst->swzName, LABEL_LEN - 1);
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_DELETESTRING, (WPARAM)sel, 0);
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
+ if (ds_value->ds.type == DVT_DB && subst->szModuleName)
+ strncpy(ds_value->ds.szModuleName, subst->szModuleName, MODULE_NAME_LEN - 1);
- return TRUE;
- }
- case IDC_BTN_EDIT2:
- {
- int sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCURSEL, 0, 0);
- if (sel != LB_ERR)
- {
- DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, sel, 0);
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK)
- {
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_DELETESTRING, (WPARAM)sel, 0);
+ if (subst->szSettingName)
+ strncpy(ds_value->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN - 1);
- sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, sel, (LPARAM)ds_value);
+ ds_value->ds.iTranslateFuncId = subst->iTranslateFuncId;
- SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETCURSEL, sel, 0);
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ int index = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, index, (LPARAM)ds_value);
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETCURSEL, index, 0);
+ }
}
}
- return TRUE;
- }
- default:
- {
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- return TRUE;
}
+ else
+ mir_free(di_value);
+
+ return TRUE;
}
- }
- break;
- }
- case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
+ case IDC_BTN_SEPARATOR:
{
- DIListNode *di_node;
- while (opt.diList)
- {
- di_node = opt.diList;
- opt.diList = opt.diList->next;
- mir_free(di_node);
- }
+ DIListNode *di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ memset(di_value, 0, sizeof(DIListNode));
+ di_value->di.bIsVisible = true;
+ di_value->di.bLineAbove = true;
- DIListNode *di_value;
- opt.iDiCount = TreeView_GetCount(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
+ TVINSERTSTRUCT tvi = { 0 };
+ tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
+ tvi.item.stateMask = TVIS_STATEIMAGEMASK;
+ tvi.item.lParam = (LPARAM)di_value;
+ tvi.item.state = INDEXTOSTATEIMAGEMASK(2);
+ tvi.item.pszText = _T("---------------------------------");
+
+ HTREEITEM hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
+ if (hItem)
+ tvi.hInsertAfter = hItem;
+ else
+ tvi.hInsertAfter = TVI_LAST;
+ TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi);
- TVITEM item = {0};
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ }
+ case IDC_BTN_REMOVE:
+ {
+ TVITEM item = { 0 };
item.mask = TVIF_PARAM;
- item.hItem = TreeView_GetLastVisible(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
- while (item.hItem != NULL)
- {
- if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item))
- {
- di_node = (DIListNode *)item.lParam;
- di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
- *di_value = *di_node;
- di_value->next = opt.diList;
- opt.diList = di_value;
+ item.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
+ if (item.hItem) {
+ if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
+ DIListNode *di_value = (DIListNode *)item.lParam;
+ mir_free(di_value);
+ TreeView_DeleteItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), item.hItem);
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- item.hItem = TreeView_GetPrevSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), item.hItem);
}
+ return TRUE;
+ }
+ case IDC_BTN_UP:
+ case IDC_BTN_DOWN:
+ {
+ HTREEITEM hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
+ if (hItem) {
+ HTREEITEM hNewItem;
+ if (LOWORD(wParam) == IDC_BTN_UP)
+ hNewItem = TreeView_GetPrevSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem);
+ else
+ hNewItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem);
- DSListNode *ds_node;
- while (opt.dsList)
- {
- ds_node = opt.dsList;
- opt.dsList = opt.dsList->next;
- mir_free(ds_node);
- }
+ if (hNewItem) {
+ TCHAR buff[512], buff2[512];
+ LPARAM tmpParam;
+ UINT tmpState;
- DSListNode *ds_value;
- opt.iDsCount = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCOUNT, 0, 0);
- for (int i = opt.iDsCount - 1; i >= 0; i--)
- {
- ds_node = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, i, 0);
- ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
- *ds_value = *ds_node;
- ds_value->next = opt.dsList;
- opt.dsList = ds_value;
+ TVITEM item = { 0 };
+ item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
+ item.stateMask = TVIS_STATEIMAGEMASK;
+ item.hItem = hItem;
+ item.pszText = buff;
+ item.cchTextMax = SIZEOF(buff);
+ if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
+ tmpParam = item.lParam;
+ tmpState = item.state;
+ item.hItem = hNewItem;
+ item.pszText = buff2;
+ if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
+ item.hItem = hItem;
+ TreeView_SetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
+
+ item.hItem = hNewItem;
+ item.pszText = buff;
+ item.lParam = tmpParam;
+ item.state = tmpState;
+ TreeView_SetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
+ TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hNewItem);
+ }
+ }
+ }
}
- SaveItems();
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
return TRUE;
}
- case NM_DBLCLK:
+ case IDC_BTN_EDIT:
{
- TVITEM item = {0};
+ TVITEM item = { 0 };
item.mask = TVIF_PARAM;
item.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
- if (item.hItem)
- {
- if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item))
- {
+ if (item.hItem) {
+ if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
DIListNode *di_value = (DIListNode *)item.lParam;
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di) == IDOK)
- {
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di) == IDOK) {
item.mask = TVIF_TEXT;
SetTreeItemText(di_value, &item.pszText);
TreeView_SetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
@@ -1258,69 +1036,182 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
}
}
- break;
+
+ return TRUE;
}
- case NM_CLICK:
+ case IDC_BTN_ADD2:
{
- 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))
- {
- if (hti.flags & TVHT_ONITEMSTATEICON)
- {
- TVITEMA item = {0};
- item.hItem = hti.hItem;
- item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
- item.stateMask = TVIS_STATEIMAGEMASK;
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &item);
+ DSListNode *ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
+ memset(ds_value, 0, sizeof(DSListNode));
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
+ int index = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, index, (LPARAM)ds_value);
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETCURSEL, index, 0);
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ else
+ mir_free(ds_value);
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 1)
- ((DIListNode *)item.lParam)->di.bIsVisible = true;
- else
- ((DIListNode *)item.lParam)->di.bIsVisible = false;
+ return TRUE;
+ }
+ case IDC_BTN_REMOVE2:
+ {
+ int sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCURSEL, 0, 0);
+ if (sel != LB_ERR) {
+ DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, sel, 0);
+ mir_free(ds_value);
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &item);
- SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0);
- }
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_DELETESTRING, (WPARAM)sel, 0);
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- break;
+
+ return TRUE;
}
- case TVN_SELCHANGEDA:
- case TVN_SELCHANGEDW:
+ case IDC_BTN_EDIT2:
{
- SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
- break;
+ int sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCURSEL, 0, 0);
+ if (sel != LB_ERR) {
+ DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, sel, 0);
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_DELETESTRING, (WPARAM)sel, 0);
+
+ sel = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, sel, (LPARAM)ds_value);
+
+ SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETCURSEL, sel, 0);
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ }
+
+ return TRUE;
}
+ default:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
}
- break;
}
- case WM_DESTROY:
- {
- TVITEM tvi = {0};
- tvi.mask = TVIF_PARAM;
-
- for (HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));hItem != NULL;
- hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem))
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
{
- tvi.hItem = hItem;
- if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi))
- {
- DIListNode *di_value = (DIListNode *)tvi.lParam;
- mir_free(di_value);
+ DIListNode *di_node;
+ while (opt.diList) {
+ di_node = opt.diList;
+ opt.diList = opt.diList->next;
+ mir_free(di_node);
+ }
+
+ DIListNode *di_value;
+ opt.iDiCount = TreeView_GetCount(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
+
+ TVITEM item = { 0 };
+ item.mask = TVIF_PARAM;
+ item.hItem = TreeView_GetLastVisible(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
+ while (item.hItem != NULL) {
+ if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
+ di_node = (DIListNode *)item.lParam;
+ di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ *di_value = *di_node;
+ di_value->next = opt.diList;
+ opt.diList = di_value;
+ }
+ item.hItem = TreeView_GetPrevSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), item.hItem);
+ }
+
+ DSListNode *ds_node;
+ while (opt.dsList) {
+ ds_node = opt.dsList;
+ opt.dsList = opt.dsList->next;
+ mir_free(ds_node);
+ }
+
+ DSListNode *ds_value;
+ opt.iDsCount = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCOUNT, 0, 0);
+ for (int i = opt.iDsCount - 1; i >= 0; i--) {
+ ds_node = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, i, 0);
+ ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
+ *ds_value = *ds_node;
+ ds_value->next = opt.dsList;
+ opt.dsList = ds_value;
}
- }
- int count = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCOUNT, 0, 0);
- for (int i = 0; i < count; i++)
+ SaveItems();
+ return TRUE;
+ }
+ case NM_DBLCLK:
{
- DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, i, 0);
- mir_free(ds_value);
+ TVITEM item = { 0 };
+ item.mask = TVIF_PARAM;
+ item.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
+ if (item.hItem) {
+ if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
+ DIListNode *di_value = (DIListNode *)item.lParam;
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ITEM), hwndDlg, DlgProcAddItem, (LPARAM)&di_value->di) == IDOK) {
+ item.mask = TVIF_TEXT;
+ SetTreeItemText(di_value, &item.pszText);
+ TreeView_SetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ }
+ }
+ break;
+ }
+ case NM_CLICK:
+ 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)) {
+ if (hti.flags & TVHT_ONITEMSTATEICON) {
+ TVITEMA item = { 0 };
+ item.hItem = hti.hItem;
+ item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
+ item.stateMask = TVIS_STATEIMAGEMASK;
+ TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &item);
+
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 1)
+ ((DIListNode *)item.lParam)->di.bIsVisible = true;
+ else
+ ((DIListNode *)item.lParam)->di.bIsVisible = false;
+
+ TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &item);
+ SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0);
+ }
}
+ break;
+ case TVN_SELCHANGED:
+ SendMessage(hwndDlg, WMU_ENABLE_LIST_BUTTONS, 0, 0);
break;
}
+ break;
+
+ case WM_DESTROY:
+ TVITEM tvi = { 0 };
+ tvi.mask = TVIF_PARAM;
+
+ for (HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS)); hItem != NULL;
+ hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), hItem)) {
+ tvi.hItem = hItem;
+ if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi)) {
+ DIListNode *di_value = (DIListNode *)tvi.lParam;
+ mir_free(di_value);
+ }
+ }
+
+ int count = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCOUNT, 0, 0);
+ for (int i = 0; i < count; i++) {
+ DSListNode *ds_value = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, i, 0);
+ mir_free(ds_value);
+ }
+
+ break;
}
return 0;
@@ -1328,11 +1219,10 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
INT_PTR CALLBACK DlgProcOptsAppearance(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_CHK_SHOWTITLE, opt.bShowTitle ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHK_NOFOCUS, opt.bShowNoFocus ? BST_CHECKED : BST_UNCHECKED);
@@ -1352,47 +1242,41 @@ INT_PTR CALLBACK DlgProcOptsAppearance(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top"));
SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Center"));
SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
- switch (opt.iLabelValign)
- {
- case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 0, 0); break;
- case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 1, 0); break;
- case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 2, 0); break;
+ switch (opt.iLabelValign) {
+ case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 0, 0); break;
+ case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 1, 0); break;
+ case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_SETCURSEL, 2, 0); break;
}
SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top"));
SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Center"));
SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom"));
- switch (opt.iValueValign)
- {
- case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 0, 0); break;
- case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 1, 0); break;
- case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 2, 0); break;
+ switch (opt.iValueValign) {
+ case DT_TOP: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 0, 0); break;
+ case DT_VCENTER: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 1, 0); break;
+ case DT_BOTTOM: SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_SETCURSEL, 2, 0); break;
}
SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right"));
- switch (opt.iLabelHalign)
- {
- case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 0, 0); break;
- case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 1, 0); break;
+ switch (opt.iLabelHalign) {
+ case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 0, 0); break;
+ case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_SETCURSEL, 1, 0); break;
}
SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right"));
- switch (opt.iValueHalign)
- {
- case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 0, 0); break;
- case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 1, 0); break;
+ switch (opt.iValueHalign) {
+ case DT_LEFT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 0, 0); break;
+ case DT_RIGHT: SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_SETCURSEL, 1, 0); break;
}
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("No avatar"));
- if (ServiceExists(MS_AV_DRAWAVATAR))
- {
+ if (ServiceExists(MS_AV_DRAWAVATAR)) {
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left avatar"));
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right avatar"));
}
- else
- {
+ else {
HWND hw = GetDlgItem(hwndDlg, IDC_CMB_AV);
EnableWindow(hw, FALSE);
hw = GetDlgItem(hwndDlg, IDC_SPIN_AVSIZE);
@@ -1441,7 +1325,7 @@ INT_PTR CALLBACK DlgProcOptsAppearance(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return FALSE;
}
- case WM_COMMAND:
+ case WM_COMMAND:
{
if (LOWORD(wParam) == IDC_CHK_ORIGINALAVSIZE)
SetDlgItemText(hwndDlg, IDC_STATIC_AVATARSIZE, IsDlgButtonChecked(hwndDlg, IDC_CHK_ORIGINALAVSIZE) ? TranslateT("Max avatar size:") : TranslateT("Avatar size:"));
@@ -1455,10 +1339,9 @@ INT_PTR CALLBACK DlgProcOptsAppearance(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
}
- case WM_NOTIFY:
+ case WM_NOTIFY:
{
- if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY)
- {
+ if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
BOOL trans;
int new_val = GetDlgItemInt(hwndDlg, IDC_ED_WIDTH, &trans, FALSE);
if (trans) opt.iWinWidth = new_val;
@@ -1494,37 +1377,33 @@ INT_PTR CALLBACK DlgProcOptsAppearance(HWND hwndDlg, UINT msg, WPARAM wParam, LP
opt.pos = (PopupPosition)SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_GETCURSEL, 0, 0);
opt.bAvatarBorder = IsDlgButtonChecked(hwndDlg, IDC_CHK_AVBORDER) ? true : false;
- opt.bAvatarRound = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERSAV) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERSAV)) ? true : false;
+ opt.bAvatarRound = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERSAV) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERSAV)) ? true : false;
opt.bOriginalAvatarSize = IsDlgButtonChecked(hwndDlg, IDC_CHK_ORIGINALAVSIZE) ? true : false;
opt.bShowTitle = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWTITLE) ? true : false;
opt.bShowNoFocus = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOFOCUS) ? true : false;
opt.bStatusBarTips = IsDlgButtonChecked(hwndDlg, IDC_CHK_SBAR) ? true : false;
- switch (SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_GETCURSEL, 0, 0))
- {
- case 0: opt.iLabelValign = DT_TOP; break;
- case 1: opt.iLabelValign = DT_VCENTER; break;
- case 2: opt.iLabelValign = DT_BOTTOM; break;
+ switch (SendDlgItemMessage(hwndDlg, IDC_CMB_LV, CB_GETCURSEL, 0, 0)) {
+ case 0: opt.iLabelValign = DT_TOP; break;
+ case 1: opt.iLabelValign = DT_VCENTER; break;
+ case 2: opt.iLabelValign = DT_BOTTOM; break;
}
- switch (SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_GETCURSEL, 0, 0))
- {
- case 0: opt.iValueValign = DT_TOP; break;
- case 1: opt.iValueValign = DT_VCENTER; break;
- case 2: opt.iValueValign = DT_BOTTOM; break;
+ switch (SendDlgItemMessage(hwndDlg, IDC_CMB_VV, CB_GETCURSEL, 0, 0)) {
+ case 0: opt.iValueValign = DT_TOP; break;
+ case 1: opt.iValueValign = DT_VCENTER; break;
+ case 2: opt.iValueValign = DT_BOTTOM; break;
}
- switch (SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_GETCURSEL, 0, 0))
- {
- case 0: opt.iLabelHalign = DT_LEFT; break;
- case 1: opt.iLabelHalign = DT_RIGHT; break;
+ switch (SendDlgItemMessage(hwndDlg, IDC_CMB_LH, CB_GETCURSEL, 0, 0)) {
+ case 0: opt.iLabelHalign = DT_LEFT; break;
+ case 1: opt.iLabelHalign = DT_RIGHT; break;
}
- switch (SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_GETCURSEL, 0, 0))
- {
- case 0: opt.iValueHalign = DT_LEFT; break;
- case 1: opt.iValueHalign = DT_RIGHT; break;
+ switch (SendDlgItemMessage(hwndDlg, IDC_CMB_VH, CB_GETCURSEL, 0, 0)) {
+ case 0: opt.iValueHalign = DT_LEFT; break;
+ case 1: opt.iValueHalign = DT_RIGHT; break;
}
SaveOptions();
@@ -1541,9 +1420,8 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
{
EXTRAICONDATA *dat = (EXTRAICONDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
@@ -1568,8 +1446,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SetDlgItemInt(hwndDlg, IDC_ED_CHARCOUNT, opt.iLimitCharCount, FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_CHARCOUNT), opt.bLimitMsg);
- for (int i = 0; i < EXICONS_COUNT; i++)
- {
+ for (int i = 0; i < EXICONS_COUNT; i++) {
exIcons[i].order = opt.exIconsOrder[i];
exIcons[i].vis = opt.exIconsVis[i];
}
@@ -1579,13 +1456,12 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- TVINSERTSTRUCT tvi = {0};
+ TVINSERTSTRUCT tvi = { 0 };
tvi.hParent = 0;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
- for (int i = 0; i < SIZEOF(extraIconName); i++)
- {
+ for (int i = 0; i < SIZEOF(extraIconName); i++) {
tvi.item.lParam = (LPARAM)&exIcons[i];
tvi.item.pszText = TranslateTS(extraIconName[exIcons[i].order]);
tvi.item.state = INDEXTOSTATEIMAGEMASK(exIcons[i].vis ? 2 : 1);
@@ -1594,11 +1470,10 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
return TRUE;
}
- case WM_COMMAND:
+ case WM_COMMAND:
{
- switch (LOWORD(wParam))
- {
- case IDC_CHK_ENABLESMILEYS:
+ switch (LOWORD(wParam)) {
+ case IDC_CHK_ENABLESMILEYS:
{
BOOL bEnable = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLESMILEYS);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_RESIZESMILEYS), bEnable);
@@ -1607,12 +1482,12 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_RESIZESMILEYS), bEnable);
break;
}
- case IDC_CHK_LIMITMSG:
+ case IDC_CHK_LIMITMSG:
{
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_CHARCOUNT), IsDlgButtonChecked(hwndDlg, IDC_CHK_LIMITMSG));
break;
}
- case IDC_CHK_GETSTATUSMSG:
+ case IDC_CHK_GETSTATUSMSG:
{
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DISABLEINVISIBLE), IsDlgButtonChecked(hwndDlg, IDC_CHK_GETSTATUSMSG));
break;
@@ -1621,23 +1496,20 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
+
break;
}
- case WM_NOTIFY:
+ case WM_NOTIFY:
{
- switch (((LPNMHDR)lParam)->idFrom)
- {
- case 0:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
{
- if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY)
- {
- TVITEM item = {0};
+ if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
+ TVITEM item = { 0 };
item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS));
int i = 0;
- while (item.hItem != NULL)
- {
+ while (item.hItem != NULL) {
item.mask = TVIF_HANDLE | TVIF_PARAM;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &item);
opt.exIconsOrder[i] = ((ICONSTATE *)item.lParam)->order;
@@ -1673,29 +1545,24 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
break;
}
- case IDC_TREE_EXTRAICONS:
+ case IDC_TREE_EXTRAICONS:
{
- switch (((LPNMHDR)lParam)->code)
- {
- case TVN_BEGINDRAGA:
- case TVN_BEGINDRAGW:
- {
- SetCapture(hwndDlg);
- dat->bDragging = true;
- dat->hDragItem = ((LPNMTREEVIEW)lParam)->itemNew.hItem;
- TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), dat->hDragItem);
- break;
- }
- case NM_CLICK:
+ switch (((LPNMHDR)lParam)->code) {
+ case TVN_BEGINDRAG:
+ SetCapture(hwndDlg);
+ dat->bDragging = true;
+ dat->hDragItem = ((LPNMTREEVIEW)lParam)->itemNew.hItem;
+ TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), dat->hDragItem);
+ break;
+
+ case NM_CLICK:
{
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))
- {
- if (hti.flags & TVHT_ONITEMSTATEICON)
- {
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
+ if (hti.flags & TVHT_ONITEMSTATEICON) {
TVITEMA item;
item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
item.stateMask = TVIS_STATEIMAGEMASK;
@@ -1718,7 +1585,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
break;
}
- case WM_MOUSEMOVE:
+ case WM_MOUSEMOVE:
{
if (!dat->bDragging)
break;
@@ -1729,8 +1596,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ClientToScreen(hwndDlg, &hti.pt);
ScreenToClient(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &hti.pt);
TreeView_HitTest(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &hti);
- if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT))
- {
+ if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
HTREEITEM hItem = hti.hItem;
hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS)) / 2;
TreeView_HitTest(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &hti);
@@ -1739,8 +1605,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
else
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), hItem, 0);
}
- else
- {
+ else {
if (hti.flags & TVHT_ABOVE)
SendDlgItemMessage(hwndDlg, IDC_TREE_EXTRAICONS, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
if (hti.flags & TVHT_BELOW)
@@ -1750,7 +1615,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
break;
}
- case WM_LBUTTONUP:
+ case WM_LBUTTONUP:
{
if (!dat->bDragging)
break;
@@ -1776,8 +1641,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
item.mask = TVIF_HANDLE | TVIF_PARAM;
item.hItem = dat->hDragItem;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &item);
- if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST))
- {
+ if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) {
TVINSERTSTRUCT tvis;
TCHAR swzName[256];
tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
@@ -1796,7 +1660,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
break;
}
- case WM_DESTROY:
+ case WM_DESTROY:
{
mir_free(dat);
break;
@@ -1815,18 +1679,15 @@ void EnableControls(HWND hwndDlg, bool bEnableSkin)
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOADFONTS), bEnableSkin);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOADPROPORTIONS), bEnableSkin);
- if(!bEnableSkin)
- {
+ if (!bEnableSkin) {
CheckDlgButton(hwndDlg, IDC_CHK_ENABLECOLORING, BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_ENABLECOLORING), FALSE);
}
- else if (opt.iEnableColoring == -1)
- {
+ else if (opt.iEnableColoring == -1) {
CheckDlgButton(hwndDlg, IDC_CHK_ENABLECOLORING, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_ENABLECOLORING), FALSE);
}
- else
- {
+ else {
CheckDlgButton(hwndDlg, IDC_CHK_ENABLECOLORING, opt.iEnableColoring ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_ENABLECOLORING), TRUE);
}
@@ -1835,9 +1696,8 @@ void EnableControls(HWND hwndDlg, bool bEnableSkin)
int iLastSel;
INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
iLastSel = RefreshSkinList(hwndDlg);
@@ -1882,32 +1742,28 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
EnableControls(hwndDlg, opt.skinMode == SM_IMAGE);
return TRUE;
}
- case WM_DRAWITEM:
+ case WM_DRAWITEM:
{
- if (wParam == IDC_PIC_PREVIEW)
- {
+ if (wParam == IDC_PIC_PREVIEW) {
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
HBRUSH hbr = GetSysColorBrush(COLOR_BTNFACE);
FillRect(dis->hDC, &dis->rcItem, hbr);
- if (opt.szPreviewFile[0])
- {
+ if (opt.szPreviewFile[0]) {
HDC hdcMem = CreateCompatibleDC(dis->hDC);
HBITMAP hbmpPreview = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)opt.szPreviewFile, IMGL_TCHAR);
- if (hbmpPreview)
- {
+ if (hbmpPreview) {
int iWidth = dis->rcItem.right - dis->rcItem.left;
int iHeight = dis->rcItem.bottom - dis->rcItem.top;
- ResizeBitmap rb = {0};
+ ResizeBitmap rb = { 0 };
rb.size = sizeof(rb);
rb.hBmp = hbmpPreview;
rb.max_width = iWidth;
rb.max_height = iHeight;
rb.fit = RESIZEBITMAP_KEEP_PROPORTIONS;
HBITMAP hbmpRes = (HBITMAP)CallService(MS_IMG_RESIZE, (WPARAM)&rb, 0);
- if (hbmpRes)
- {
+ if (hbmpRes) {
BITMAP bmp;
GetObject(hbmpRes, sizeof(bmp), &bmp);
SelectObject(hdcMem, hbmpRes);
@@ -1924,25 +1780,20 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
}
break;
}
- case WM_COMMAND:
+ case WM_COMMAND:
{
- switch (HIWORD(wParam))
- {
- case LBN_SELCHANGE:
+ switch (HIWORD(wParam)) {
+ case LBN_SELCHANGE:
{
- if (LOWORD(wParam) == IDC_LB_SKINS)
- {
+ if (LOWORD(wParam) == IDC_LB_SKINS) {
HWND hwndList = GetDlgItem(hwndDlg, IDC_LB_SKINS);
int iSel = ListBox_GetCurSel(hwndList);
- if (iSel != iLastSel)
- {
- if (iSel == 0)
- {
+ if (iSel != iLastSel) {
+ if (iSel == 0) {
opt.szPreviewFile[0] = 0;
EnableControls(hwndDlg, false);
}
- else if (iSel != LB_ERR)
- {
+ else if (iSel != LB_ERR) {
TCHAR swzSkinName[256];
if (ListBox_GetText(hwndList, iSel, swzSkinName) > 0)
ParseSkinFile(swzSkinName, false, true);
@@ -1953,27 +1804,22 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
iLastSel = iSel;
}
}
- else if (LOWORD(wParam) == IDC_CMB_EFFECT)
- {
+ else if (LOWORD(wParam) == IDC_CMB_EFFECT) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
}
- case BN_CLICKED:
+ case BN_CLICKED:
{
- if (LOWORD(wParam) == IDC_BTN_APPLYSKIN)
- {
+ if (LOWORD(wParam) == IDC_BTN_APPLYSKIN) {
int iSel = ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_LB_SKINS));
- if (iSel == 0)
- {
+ if (iSel == 0) {
opt.skinMode = SM_COLORFILL;
opt.szSkinName[0] = 0;
}
- else if (iSel != LB_ERR)
- {
- if (ListBox_GetText(GetDlgItem(hwndDlg, IDC_LB_SKINS), iSel, opt.szSkinName) > 0)
- {
+ else if (iSel != LB_ERR) {
+ if (ListBox_GetText(GetDlgItem(hwndDlg, IDC_LB_SKINS), iSel, opt.szSkinName) > 0) {
opt.skinMode = SM_IMAGE;
ParseSkinFile(opt.szSkinName, false, false);
ReloadFont(0, 0);
@@ -1983,7 +1829,7 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
db_set_b(0, MODULE, "SkinEngine", opt.skinMode);
db_set_ts(0, MODULE, "SkinName", opt.szSkinName);
-
+
DestroySkinBitmap();
SetDlgItemInt(hwndDlg, IDC_ED_TRANS, opt.iOpacity, FALSE);
}
@@ -2005,10 +1851,9 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
break;
}
- case WM_NOTIFY:
+ case WM_NOTIFY:
{
- if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY )
- {
+ if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
opt.iOpacity = GetDlgItemInt(hwndDlg, IDC_ED_TRANS, 0, 0);
opt.bDropShadow = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHADOW) ? true : false;
opt.bBorder = IsDlgButtonChecked(hwndDlg, IDC_CHK_BORDER) ? true : false;
@@ -2057,7 +1902,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam,
return TRUE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_BTN_OK:
{
BYTE isChecked;
@@ -2096,9 +1941,8 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam,
INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
@@ -2115,7 +1959,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- TVINSERTSTRUCT tvi = {0};
+ TVINSERTSTRUCT tvi = { 0 };
tvi.hParent = 0;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
@@ -2124,10 +1968,8 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
PROTOACCOUNT **accs;
ProtoEnumAccounts(&count, &accs);
- for (i = 0; i < count; i++)
- {
- if (CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) != 0)
- {
+ for (i = 0; i < count; i++) {
+ if (CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) != 0) {
tvi.item.pszText = accs[i]->tszAccountName;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
tvi.item.state = INDEXTOSTATEIMAGEMASK(IsTrayProto(accs[i]->tszAccountName, false) ? 2 : 1);
@@ -2137,8 +1979,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
}
- for (i = 0; i < SIZEOF(trayTipItems); i++)
- {
+ for (i = 0; i < SIZEOF(trayTipItems); i++) {
tvi.item.pszText = TranslateTS(trayTipItems[i]);
tvi.item.state = INDEXTOSTATEIMAGEMASK(opt.iFirstItems & (1 << i) ? 2 : 1);
TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi);
@@ -2148,161 +1989,142 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return TRUE;
}
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- UINT state;
- case IDC_CHK_ENABLETRAYTIP:
- {
- state = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLETRAYTIP);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_HANDLEBYTIPPER), state);
- } // fall through
- case IDC_CHK_HANDLEBYTIPPER:
- {
- state = IsDlgButtonChecked(hwndDlg, IDC_CHK_HANDLEBYTIPPER) & IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLETRAYTIP);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_HIDEOFFLINE), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_FAVCONTACTS), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_EXPAND), state);
- } // fall through
- case IDC_CHK_EXPAND:
- {
- state = IsDlgButtonChecked(hwndDlg, IDC_CHK_HANDLEBYTIPPER)
- & IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLETRAYTIP)
- & IsDlgButtonChecked(hwndDlg, IDC_CHK_EXPAND);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ED_EXPANDTIME), state);
- break;
- }
- case IDC_BTN_FAVCONTACTS:
- {
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FAVCONTACTS), 0, DlgProcFavouriteContacts);
- break;
- }
- }
-
- if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ UINT state;
+ case IDC_CHK_ENABLETRAYTIP:
+ state = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLETRAYTIP);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_HANDLEBYTIPPER), state);
+ // fall through
+
+ case IDC_CHK_HANDLEBYTIPPER:
+ state = IsDlgButtonChecked(hwndDlg, IDC_CHK_HANDLEBYTIPPER) & IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLETRAYTIP);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_HIDEOFFLINE), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_FAVCONTACTS), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_EXPAND), state);
+ // fall through
+
+ case IDC_CHK_EXPAND:
+ state = IsDlgButtonChecked(hwndDlg, IDC_CHK_HANDLEBYTIPPER)
+ & IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLETRAYTIP)
+ & IsDlgButtonChecked(hwndDlg, IDC_CHK_EXPAND);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_EXPANDTIME), state);
+ break;
+ case IDC_BTN_FAVCONTACTS:
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_FAVCONTACTS), 0, DlgProcFavouriteContacts);
break;
}
- case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- {
- if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY)
- {
- TCHAR buff[256];
- TCHAR swzProtos[1024] = {0};
-
- TVITEM item;
- item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS));
- item.pszText = buff;
- item.cchTextMax = SIZEOF(buff);
- item.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE;
- item.stateMask = TVIS_STATEIMAGEMASK;
- while (item.hItem != NULL)
- {
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), &item);
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2)
- {
- _tcscat(swzProtos, buff);
- _tcscat(swzProtos, _T(" "));
- }
-
- item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), item.hItem);
- }
- db_set_ts(0, MODULE, "TrayProtocols", swzProtos);
+ if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
+ TCHAR buff[256];
+ TCHAR swzProtos[1024] = { 0 };
+
+ TVITEM item;
+ item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS));
+ item.pszText = buff;
+ item.cchTextMax = SIZEOF(buff);
+ item.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE;
+ item.stateMask = TVIS_STATEIMAGEMASK;
+ while (item.hItem != NULL) {
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), &item);
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2) {
+ _tcscat(swzProtos, buff);
+ _tcscat(swzProtos, _T(" "));
+ }
- swzProtos[0] = 0;
- item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS));
- item.pszText = buff;
- while (item.hItem != NULL)
- {
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), &item);
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2)
- {
- _tcscat(swzProtos, buff);
- _tcscat(swzProtos, _T(" "));
- }
+ item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), item.hItem);
+ }
- item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), item.hItem);
- }
+ db_set_ts(0, MODULE, "TrayProtocols", swzProtos);
- db_set_ts(0, MODULE, "TrayProtocolsEx", swzProtos);
+ swzProtos[0] = 0;
+ item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS));
+ item.pszText = buff;
+ while (item.hItem != NULL) {
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), &item);
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2) {
+ _tcscat(swzProtos, buff);
+ _tcscat(swzProtos, _T(" "));
+ }
- int count = 0;
- opt.iFirstItems = 0;
- item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
- item.mask = TVIF_HANDLE | TVIF_STATE;
- item.stateMask = TVIS_STATEIMAGEMASK;
- while (item.hItem != NULL)
- {
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2)
- opt.iFirstItems |= (1 << count);
+ item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), item.hItem);
+ }
- item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), item.hItem);
- count++;
- }
+ db_set_ts(0, MODULE, "TrayProtocolsEx", swzProtos);
- count = 0;
- opt.iSecondItems = 0;
- item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS));
- while (item.hItem != NULL)
- {
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), &item);
- if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2)
- opt.iSecondItems |= (1 << count);
+ int count = 0;
+ opt.iFirstItems = 0;
+ item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS));
+ item.mask = TVIF_HANDLE | TVIF_STATE;
+ item.stateMask = TVIS_STATEIMAGEMASK;
+ while (item.hItem != NULL) {
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item);
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2)
+ opt.iFirstItems |= (1 << count);
+
+ item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), item.hItem);
+ count++;
+ }
- item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), item.hItem);
- count++;
- }
+ count = 0;
+ opt.iSecondItems = 0;
+ item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS));
+ while (item.hItem != NULL) {
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), &item);
+ if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 2)
+ opt.iSecondItems |= (1 << count);
- opt.bTraytip = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLETRAYTIP) ? true : false;
- opt.bHandleByTipper = IsDlgButtonChecked(hwndDlg, IDC_CHK_HANDLEBYTIPPER) ? true : false;
- opt.bExpandTraytip = IsDlgButtonChecked(hwndDlg, IDC_CHK_EXPAND) ? true : false;
- opt.bHideOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEOFFLINE) ? true : false;
- opt.iExpandTime = max(min(GetDlgItemInt(hwndDlg, IDC_ED_EXPANDTIME, 0, FALSE), 5000), 10);
-
- db_set_b(0, MODULE, "TrayTip", (opt.bTraytip ? 1 : 0));
- db_set_b(0, MODULE, "ExtendedTrayTip", (opt.bHandleByTipper ? 1 : 0));
- db_set_b(0, MODULE, "ExpandTrayTip", (opt.bExpandTraytip ? 1 : 0));
- db_set_b(0, MODULE, "HideOffline", (opt.bHideOffline ? 1 : 0));
- db_set_dw(0, MODULE, "ExpandTime", opt.iExpandTime);
- db_set_dw(0, MODULE, "TrayTipItems", opt.iFirstItems);
- db_set_dw(0, MODULE, "TrayTipItemsEx", opt.iSecondItems);
- return TRUE;
- }
- break;
- }
- case IDC_TREE_FIRST_PROTOS:
- case IDC_TREE_SECOND_PROTOS:
- case IDC_TREE_FIRST_ITEMS:
- case IDC_TREE_SECOND_ITEMS:
- {
- if (((LPNMHDR)lParam)->code == NM_CLICK)
- {
- 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))
- if (hti.flags & TVHT_ONITEMSTATEICON)
- SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0);
- }
- break;
+ item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_SECOND_ITEMS), item.hItem);
+ count++;
}
+
+ opt.bTraytip = IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLETRAYTIP) ? true : false;
+ opt.bHandleByTipper = IsDlgButtonChecked(hwndDlg, IDC_CHK_HANDLEBYTIPPER) ? true : false;
+ opt.bExpandTraytip = IsDlgButtonChecked(hwndDlg, IDC_CHK_EXPAND) ? true : false;
+ opt.bHideOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEOFFLINE) ? true : false;
+ opt.iExpandTime = max(min(GetDlgItemInt(hwndDlg, IDC_ED_EXPANDTIME, 0, FALSE), 5000), 10);
+
+ db_set_b(0, MODULE, "TrayTip", (opt.bTraytip ? 1 : 0));
+ db_set_b(0, MODULE, "ExtendedTrayTip", (opt.bHandleByTipper ? 1 : 0));
+ db_set_b(0, MODULE, "ExpandTrayTip", (opt.bExpandTraytip ? 1 : 0));
+ db_set_b(0, MODULE, "HideOffline", (opt.bHideOffline ? 1 : 0));
+ db_set_dw(0, MODULE, "ExpandTime", opt.iExpandTime);
+ db_set_dw(0, MODULE, "TrayTipItems", opt.iFirstItems);
+ db_set_dw(0, MODULE, "TrayTipItemsEx", opt.iSecondItems);
+ return TRUE;
+ }
+ break;
+
+ case IDC_TREE_FIRST_PROTOS:
+ case IDC_TREE_SECOND_PROTOS:
+ case IDC_TREE_FIRST_ITEMS:
+ case IDC_TREE_SECOND_ITEMS:
+ if (((LPNMHDR)lParam)->code == NM_CLICK) {
+ 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))
+ if (hti.flags & TVHT_ONITEMSTATEICON)
+ SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0);
}
break;
}
+ break;
}
return FALSE;
@@ -2316,7 +2138,7 @@ int OptInit(WPARAM wParam, LPARAM lParam)
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_APPEARANCE);
- odp.pszTab = LPGEN("Appearance");
+ odp.pszTab = LPGEN("Appearance");
odp.pszTitle = LPGEN("Tooltips");
odp.pszGroup = LPGEN("Customize");
odp.pfnDlgProc = DlgProcOptsAppearance;
@@ -2363,24 +2185,20 @@ void DeinitOptions()
UnhookEvent(hEventOptInit);
DIListNode *di_node = opt.diList;
- while (opt.diList)
- {
+ while (opt.diList) {
di_node = opt.diList;
opt.diList = opt.diList->next;
mir_free(di_node);
}
DSListNode *ds_node = opt.dsList;
- while (opt.dsList)
- {
+ while (opt.dsList) {
ds_node = opt.dsList;
opt.dsList = opt.dsList->next;
mir_free(ds_node);
}
for (int i = 0; i < SKIN_ITEMS_COUNT; i++)
- {
if (opt.szImgFile[i])
mir_free(opt.szImgFile[i]);
- }
}