From f7a8c76bf3b75739f6a6aee374cf5a76fcfd86c9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 7 Aug 2012 13:29:09 +0000 Subject: fix for langpacks & options git-svn-id: http://svn.miranda-ng.org/main/trunk@1391 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Folders/src/dlg_handlers.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'plugins') diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index ac2e06bff3..29284caead 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -37,13 +37,11 @@ int GetCurrentItemText(HWND hWnd, char *buffer, int count) int GetCurrentSectionText(HWND hWnd, char *buffer, int count) { int index = GetCurrentSectionSelection(hWnd); - if (index != LB_ERR) { + if (index != LB_ERR) SendDlgItemMessageA(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETTEXT, index, (LPARAM) buffer); - return 1; - } - - buffer[0] = L'0'; - return 0; + else + buffer[0] = L'0'; + return index; } static void GetEditText(HWND hWnd, TCHAR *buffer, int size) @@ -66,11 +64,15 @@ int ContainsSection(HWND hWnd, const WCHAR *section) void LoadRegisteredFolderSections(HWND hWnd) { + HWND hwndList = GetDlgItem(hWnd, IDC_FOLDERS_SECTIONS_LIST); + for (int i = 0; i < lstRegisteredFolders.Count(); i++) { PFolderItem tmp = lstRegisteredFolders.Get(i + 1); TCHAR *translated = mir_a2t( tmp->GetSection()); - if (!ContainsSection(hWnd, translated)) - SendDlgItemMessage(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_ADDSTRING, 0, (LPARAM)TranslateTS(translated)); + if ( !ContainsSection(hWnd, TranslateTS(translated))) { + int idx = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)TranslateTS(translated)); + SendMessage(hwndList, LB_SETITEMDATA, idx, (LPARAM)tmp->GetSection()); + } mir_free(translated); } @@ -78,12 +80,14 @@ void LoadRegisteredFolderSections(HWND hWnd) void LoadRegisteredFolderItems(HWND hWnd) { - char buffer[MAX_FOLDER_SIZE]; - GetCurrentSectionText(hWnd, buffer, MAX_FOLDER_SIZE); + int idx = GetCurrentSectionSelection(hWnd); + char* szSection = (char*)SendDlgItemMessage(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_GETITEMDATA, idx, 0); + SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_RESETCONTENT, 0, 0); + for (int i = 0; i < lstRegisteredFolders.Count(); i++) { PFolderItem item = lstRegisteredFolders.Get(i + 1); - if ( !strcmp(buffer, item->GetSection())) { + if ( !strcmp(szSection, item->GetSection())) { mir_ptr wide( mir_a2t( item->GetName())); SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_ADDSTRING, 0, (LPARAM)TranslateTS(wide)); } @@ -195,8 +199,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case LBN_SELCHANGE: { PFolderItem item = GetSelectedItem(hWnd); - if (item != NULL) - { + if (item != NULL) { CheckForChanges(hWnd); LoadItem(hWnd, item); } -- cgit v1.2.3