diff options
author | George Hazan <george.hazan@gmail.com> | 2012-08-07 13:29:09 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-08-07 13:29:09 +0000 |
commit | f7a8c76bf3b75739f6a6aee374cf5a76fcfd86c9 (patch) | |
tree | 8ee22d5dcd319003b1fc1230c907662a74325604 /plugins/Folders/src/dlg_handlers.cpp | |
parent | 2671bc88f72cf0c76f3d0a8a301e3e78a3567a34 (diff) |
fix for langpacks & options
git-svn-id: http://svn.miranda-ng.org/main/trunk@1391 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Folders/src/dlg_handlers.cpp')
-rw-r--r-- | plugins/Folders/src/dlg_handlers.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
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<TCHAR> 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);
}
|