diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index 4418fc26..b45b29db 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -21,6 +21,7 @@ #define MAKENSISW_CPP #include +#include #include #include "makensisw.h" #include "resource.h" @@ -819,6 +820,23 @@ void EnableSymbolSetButtons(HWND hwndDlg) } } +void EnableSymbolEditButtons(HWND hwndDlg) +{ + int n = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETSELCOUNT, 0, 0); + if(n == 0) { + EnableWindow(GetDlgItem(hwndDlg, IDLEFT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDDEL), FALSE); + } + else if(n == 1) { + EnableWindow(GetDlgItem(hwndDlg, IDLEFT), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDDEL), TRUE); + } + else if(n > 1) { + EnableWindow(GetDlgItem(hwndDlg, IDLEFT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDDEL), TRUE); + } +} + void SetSymbols(HWND hwndDlg, char **symbols) { int i = 0; @@ -943,7 +961,13 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) buf = buf3; GlobalFree(buf2); } - SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_ADDSTRING, 0, (LPARAM)buf); + int idx = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_ADDSTRING, 0, (LPARAM)buf); + if (idx >= 0) + { + SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_SETSEL, FALSE, -1); + SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_SETSEL, TRUE, idx); + } + EnableSymbolEditButtons(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_SYMBOL, WM_SETTEXT, 0, 0); SendDlgItemMessage(hwndDlg, IDC_VALUE, WM_SETTEXT, 0, 0); GlobalFree(buf); @@ -1005,6 +1029,7 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) for(i=n-1;i>=0;i--) { SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_DELETESTRING, (WPARAM)items[i], 0); } + EnableSymbolEditButtons(hwndDlg); EnableSymbolSetButtons(hwndDlg); } break; @@ -1023,19 +1048,7 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) case IDC_SYMBOLS: if (HIWORD(wParam) == LBN_SELCHANGE) { - int n = SendDlgItemMessage(hwndDlg, IDC_SYMBOLS, LB_GETSELCOUNT, 0, 0); - if(n == 0) { - EnableWindow(GetDlgItem(hwndDlg, IDLEFT), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDDEL), FALSE); - } - else if(n == 1) { - EnableWindow(GetDlgItem(hwndDlg, IDLEFT), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDDEL), TRUE); - } - else if(n > 1) { - EnableWindow(GetDlgItem(hwndDlg, IDLEFT), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDDEL), TRUE); - } + EnableSymbolEditButtons(hwndDlg); } else if (HIWORD(wParam) == LBN_DBLCLK) { diff --git a/Contrib/Makensisw/resource.rc b/Contrib/Makensisw/resource.rc index a16d914a..636814db 100644 --- a/Contrib/Makensisw/resource.rc +++ b/Contrib/Makensisw/resource.rc @@ -198,7 +198,7 @@ BEGIN EDITTEXT IDC_SYMBOL,18,96,68,12,ES_AUTOHSCROLL,WS_EX_CLIENTEDGE LTEXT "&Value (optional)",IDC_STATIC,18,120,50,8 EDITTEXT IDC_VALUE,18,132,66,12,ES_AUTOHSCROLL,WS_EX_CLIENTEDGE - PUSHBUTTON "&Update >>",IDRIGHT,96,84,49,14 + PUSHBUTTON "&Add >>",IDRIGHT,96,84,49,14 PUSHBUTTON "&Edit <<",IDLEFT,96,108,49,14 PUSHBUTTON "&Delete",IDDEL,96,132,49,14 LTEXT "Symbol List",IDC_STATIC,156,66,118,9