diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-05 21:55:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-05 21:55:21 +0000 |
commit | 2aabf6594cb0fb4f8db16771c988bf5a6eab2c4b (patch) | |
tree | 202865579328cc407dc249ca6ed3ea80f9f6f80a /plugins/Clist_modern | |
parent | 9de8f2a1584b810d0fc651704f7f732dc0943d86 (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/Clist_modern')
-rw-r--r-- | plugins/Clist_modern/src/modern_skinopt.cpp | 251 |
1 files changed, 122 insertions, 129 deletions
diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 7dd64c6a5e..2a9fe1b69e 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -79,25 +79,23 @@ int ModernSkinOptInit(WPARAM wParam, LPARAM) } INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) - { + switch (msg) { case WM_DESTROY: - { - if (hPreviewBitmap) ske_UnloadGlyphImage(hPreviewBitmap); + if (hPreviewBitmap) + ske_UnloadGlyphImage(hPreviewBitmap); break; - } case WM_INITDIALOG: - { TranslateDialogDefault(hwndDlg); SetDlgItemText(hwndDlg, IDC_SKINFOLDERLABEL, SkinsFolder); - HTREEITEM it = FillAvailableSkinList(hwndDlg); - HWND wnd = GetDlgItem(hwndDlg, IDC_TREE1); - TreeView_SelectItem(wnd, it); - } - return 0; + { + HTREEITEM it = FillAvailableSkinList(hwndDlg); + HWND wnd = GetDlgItem(hwndDlg, IDC_TREE1); + TreeView_SelectItem(wnd, it); + } + return 0; + case WM_COMMAND: - { switch (LOWORD(wParam)) { case IDC_COLOUR_MENUNORMAL: case IDC_COLOUR_MENUSELECTED: @@ -107,44 +105,42 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case IDC_BUTTON_INFO: - { - TCHAR Author[255], URL[MAX_PATH], Contact[255], Description[400], text[2000]; - SkinListData *sd = NULL; - HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); - if (hti == 0) return 0; { - TVITEM tvi = { 0 }; - tvi.hItem = hti; - tvi.mask = TVIF_HANDLE | TVIF_PARAM; - TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE1), &tvi); - sd = (SkinListData*)(tvi.lParam); - } - if (!sd) return 0; - if (sd->File && !_tcschr(sd->File, _T('%'))) - { - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, SIZEOF(Author), sd->File); - GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, SIZEOF(URL), sd->File); - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, SIZEOF(Contact), sd->File); - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, SIZEOF(Description), sd->File); - mir_sntprintf(text, SIZEOF(text), TranslateT("%s\n\n%s\n\nAuthor(s):\t %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"), - sd->Name, Description, Author, Contact, URL, sd->File); - } - else - { - mir_sntprintf(text, SIZEOF(text), TranslateT("%s\n\n%s\n\nAuthor(s): %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"), - TranslateT("reVista for Modern v0.5"), - TranslateT("This is second default Modern Contact list skin in Vista Aero style"), - TranslateT("Angeli-Ka (graphics), FYR (template)"), - _T("JID: fyr@jabber.ru"), - _T("fyr.mirandaim.ru"), - TranslateT("Inside library")); + TCHAR Author[255], URL[MAX_PATH], Contact[255], Description[400], text[2000]; + SkinListData *sd = NULL; + HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); + if (hti == 0) return 0; + { + TVITEM tvi = { 0 }; + tvi.hItem = hti; + tvi.mask = TVIF_HANDLE | TVIF_PARAM; + TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE1), &tvi); + sd = (SkinListData*)(tvi.lParam); + } + if (!sd) return 0; + if (sd->File && !_tcschr(sd->File, _T('%'))) { + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, SIZEOF(Author), sd->File); + GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, SIZEOF(URL), sd->File); + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, SIZEOF(Contact), sd->File); + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, SIZEOF(Description), sd->File); + mir_sntprintf(text, SIZEOF(text), TranslateT("%s\n\n%s\n\nAuthor(s):\t %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"), + sd->Name, Description, Author, Contact, URL, sd->File); + } + else { + mir_sntprintf(text, SIZEOF(text), TranslateT("%s\n\n%s\n\nAuthor(s): %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"), + TranslateT("reVista for Modern v0.5"), + TranslateT("This is second default Modern Contact list skin in Vista Aero style"), + TranslateT("Angeli-Ka (graphics), FYR (template)"), + _T("JID: fyr@jabber.ru"), + _T("fyr.mirandaim.ru"), + TranslateT("Inside library")); + } + MessageBox(hwndDlg, text, TranslateT("Skin information"), MB_OK | MB_ICONINFORMATION); } - MessageBox(hwndDlg, text, TranslateT("Skin information"), MB_OK | MB_ICONINFORMATION); - } - break; + break; + case IDC_BUTTON_APPLY_SKIN: - if (HIWORD(wParam) == BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { SkinListData *sd = NULL; HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); if (hti == 0) return 0; @@ -168,8 +164,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara GetWindowRect(hwnd, &rc); Sync(CLUIFrames_OnMoving, hwnd, &rc); } - if (g_hCLUIOptionsWnd) - { + if (g_hCLUIOptionsWnd) { SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT)); SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT)); SendDlgItemMessage(g_hCLUIOptionsWnd, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT)); @@ -177,16 +172,16 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara } } break; + case IDC_BUTTON_RESCAN: - if (HIWORD(wParam) == BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { HTREEITEM it = FillAvailableSkinList(hwndDlg); HWND wnd = GetDlgItem(hwndDlg, IDC_TREE1); TreeView_SelectItem(wnd, it); } } break; - } + case WM_DRAWITEM: if (wParam == IDC_PREVIEW) { @@ -235,90 +230,88 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case IDC_TREE1: - { - NMTREEVIEW * nmtv = (NMTREEVIEW *)lParam; - if (nmtv == NULL) - return 0; - - if (nmtv->hdr.code == TVN_SELCHANGEDA || nmtv->hdr.code == TVN_SELCHANGEDW) { - SkinListData * sd = NULL; - if (hPreviewBitmap) { - ske_UnloadGlyphImage(hPreviewBitmap); - hPreviewBitmap = NULL; - } + { + NMTREEVIEW * nmtv = (NMTREEVIEW *)lParam; + if (nmtv == NULL) + return 0; + + if (nmtv->hdr.code == TVN_SELCHANGED) { + SkinListData * sd = NULL; + if (hPreviewBitmap) { + ske_UnloadGlyphImage(hPreviewBitmap); + hPreviewBitmap = NULL; + } - if (nmtv->itemNew.lParam) { - sd = (SkinListData*)nmtv->itemNew.lParam; - - TCHAR buf[MAX_PATH]; - PathToRelativeT(sd->File, buf); - SetDlgItemText(hwndDlg, IDC_EDIT_SKIN_FILENAME, buf); - - TCHAR prfn[MAX_PATH] = { 0 }, imfn[MAX_PATH] = { 0 }, skinfolder[MAX_PATH] = { 0 }; - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Preview"), _T(""), imfn, SIZEOF(imfn), sd->File); - IniParser::GetSkinFolder(sd->File, skinfolder); - mir_sntprintf(prfn, SIZEOF(prfn), _T("%s\\%s"), skinfolder, imfn); - PathToAbsoluteT(prfn, imfn); - hPreviewBitmap = ske_LoadGlyphImage(imfn); - - EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_APPLY_SKIN), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_INFO), TRUE); - if (hPreviewBitmap) - InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEW), NULL, TRUE); - else { //prepare text - TCHAR Author[255], URL[MAX_PATH], Contact[255], Description[400], text[2000]; - SkinListData* sd = NULL; - HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); - if (hti == 0) return 0; - { - TVITEM tvi = { 0 }; - tvi.hItem = hti; - tvi.mask = TVIF_HANDLE | TVIF_PARAM; - TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE1), &tvi); - sd = (SkinListData*)(tvi.lParam); - } - if (!sd) return 0; - - if (sd->File && !_tcschr(sd->File, _T('%'))) - { - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, SIZEOF(Author), sd->File); - GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, SIZEOF(URL), sd->File); - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, SIZEOF(Contact), sd->File); - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, SIZEOF(Description), sd->File); - mir_sntprintf(text, SIZEOF(text), TranslateT("Preview is not available\n\n%s\n----------------------\n\n%s\n\nAUTHOR(S):\n%s\n\nCONTACT:\n%s\n\nHOMEPAGE:\n%s"), - sd->Name, Description, Author, Contact, URL); - } - else - { - mir_sntprintf(text, SIZEOF(text), TranslateT("%s\n\n%s\n\nAUTHORS:\n%s\n\nCONTACT:\n%s\n\nWEB:\n%s\n\n\n"), - TranslateT("reVista for Modern v0.5"), - TranslateT("This is second default Modern Contact list skin in Vista Aero style"), - TranslateT("graphics by Angeli-Ka\ntemplate by FYR"), - _T("JID: fyr@jabber.ru"), - _T("fyr.mirandaim.ru")); + if (nmtv->itemNew.lParam) { + sd = (SkinListData*)nmtv->itemNew.lParam; + + TCHAR buf[MAX_PATH]; + PathToRelativeT(sd->File, buf); + SetDlgItemText(hwndDlg, IDC_EDIT_SKIN_FILENAME, buf); + + TCHAR prfn[MAX_PATH] = { 0 }, imfn[MAX_PATH] = { 0 }, skinfolder[MAX_PATH] = { 0 }; + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Preview"), _T(""), imfn, SIZEOF(imfn), sd->File); + IniParser::GetSkinFolder(sd->File, skinfolder); + mir_sntprintf(prfn, SIZEOF(prfn), _T("%s\\%s"), skinfolder, imfn); + PathToAbsoluteT(prfn, imfn); + hPreviewBitmap = ske_LoadGlyphImage(imfn); + + EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_APPLY_SKIN), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_INFO), TRUE); + if (hPreviewBitmap) + InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEW), NULL, TRUE); + else { //prepare text + TCHAR Author[255], URL[MAX_PATH], Contact[255], Description[400], text[2000]; + SkinListData* sd = NULL; + HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); + if (hti == 0) return 0; + { + TVITEM tvi = { 0 }; + tvi.hItem = hti; + tvi.mask = TVIF_HANDLE | TVIF_PARAM; + TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE1), &tvi); + sd = (SkinListData*)(tvi.lParam); + } + if (!sd) return 0; + + if (sd->File && !_tcschr(sd->File, _T('%'))) { + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, SIZEOF(Author), sd->File); + GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, SIZEOF(URL), sd->File); + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, SIZEOF(Contact), sd->File); + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, SIZEOF(Description), sd->File); + mir_sntprintf(text, SIZEOF(text), TranslateT("Preview is not available\n\n%s\n----------------------\n\n%s\n\nAUTHOR(S):\n%s\n\nCONTACT:\n%s\n\nHOMEPAGE:\n%s"), + sd->Name, Description, Author, Contact, URL); + } + else { + mir_sntprintf(text, SIZEOF(text), TranslateT("%s\n\n%s\n\nAUTHORS:\n%s\n\nCONTACT:\n%s\n\nWEB:\n%s\n\n\n"), + TranslateT("reVista for Modern v0.5"), + TranslateT("This is second default Modern Contact list skin in Vista Aero style"), + TranslateT("graphics by Angeli-Ka\ntemplate by FYR"), + _T("JID: fyr@jabber.ru"), + _T("fyr.mirandaim.ru")); + } + ShowWindow(GetDlgItem(hwndDlg, IDC_PREVIEW), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC_INFO), SW_SHOW); + SetDlgItemText(hwndDlg, IDC_STATIC_INFO, text); } + } + else { + //no selected + SetDlgItemText(hwndDlg, IDC_EDIT_SKIN_FILENAME, TranslateT("Select skin from list")); + EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_APPLY_SKIN), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_INFO), FALSE); + SetDlgItemText(hwndDlg, IDC_STATIC_INFO, TranslateT("Please select skin to apply")); ShowWindow(GetDlgItem(hwndDlg, IDC_PREVIEW), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC_INFO), SW_SHOW); - SetDlgItemText(hwndDlg, IDC_STATIC_INFO, text); } + ShowWindow(GetDlgItem(hwndDlg, IDC_PREVIEW), hPreviewBitmap ? SW_SHOW : SW_HIDE); + return 0; } - else { - //no selected - SetDlgItemText(hwndDlg, IDC_EDIT_SKIN_FILENAME, TranslateT("Select skin from list")); - EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_APPLY_SKIN), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_INFO), FALSE); - SetDlgItemText(hwndDlg, IDC_STATIC_INFO, TranslateT("Please select skin to apply")); - ShowWindow(GetDlgItem(hwndDlg, IDC_PREVIEW), SW_HIDE); + else if (nmtv->hdr.code == TVN_DELETEITEM) { + mir_free_and_nil(nmtv->itemOld.lParam); + return 0; } - ShowWindow(GetDlgItem(hwndDlg, IDC_PREVIEW), hPreviewBitmap ? SW_SHOW : SW_HIDE); - return 0; - } - else if (nmtv->hdr.code == TVN_DELETEITEMA || nmtv->hdr.code == TVN_DELETEITEMW) { - mir_free_and_nil(nmtv->itemOld.lParam); - return 0; } - } - break; + break; case 0: switch (((LPNMHDR)lParam)->code) { |