wordpad: Show error when user tries to add more than max tab stops.

Previously there was no such error, and if more than MAX_TAB_STOPS were
added, then some of the tab stops would be silently discarded.
oldstable
Dylan Smith 2009-02-25 15:15:22 -05:00 committed by Alexandre Julliard
parent b4ea7d3221
commit 0292135a92
3 changed files with 8 additions and 3 deletions

View File

@ -239,5 +239,6 @@ BEGIN
STRING_WRITE_ACCESS_DENIED, "You do not have access to save the file."
STRING_OPEN_FAILED, "Could not open the file."
STRING_OPEN_ACCESS_DENIED, "You do not have access to open the file."
STRING_PRINTING_NOT_IMPLEMENTED, "Printing not implemented"
STRING_PRINTING_NOT_IMPLEMENTED, "Printing not implemented"
STRING_MAX_TAB_STOPS, "Cannot add more than 32 tab stops."
END

View File

@ -1636,13 +1636,16 @@ static INT_PTR CALLBACK tabstops_proc(HWND hWnd, UINT message, WPARAM wParam, LP
if(SendMessageW(hTabWnd, CB_FINDSTRINGEXACT, -1, (LPARAM)&buffer) == CB_ERR)
{
float number = 0;
int item_count = SendMessage(hTabWnd, CB_GETCOUNT, 0, 0);
if(!number_from_string(buffer, &number, TRUE))
{
MessageBoxWithResStringW(hWnd, MAKEINTRESOURCEW(STRING_INVALID_NUMBER),
wszAppTitle, MB_OK | MB_ICONINFORMATION);
} else
{
} else if (item_count >= MAX_TAB_STOPS) {
MessageBoxWithResStringW(hWnd, MAKEINTRESOURCEW(STRING_MAX_TAB_STOPS),
wszAppTitle, MB_OK | MB_ICONINFORMATION);
} else {
SendMessageW(hTabWnd, CB_ADDSTRING, 0, (LPARAM)&buffer);
SetWindowTextW(hTabWnd, 0);
}

View File

@ -200,6 +200,7 @@
#define STRING_OPEN_FAILED 1709
#define STRING_OPEN_ACCESS_DENIED 1710
#define STRING_PRINTING_NOT_IMPLEMENTED 1711
#define STRING_MAX_TAB_STOPS 1712
LPWSTR file_basename(LPWSTR);