Module: wine
Branch: master
Commit: 0292135a92c4a19f0ac8e2143f3c92f854a8dd55
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0292135a92c4a19f0ac8e2143…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com>
Date: Wed Feb 25 15:15:22 2009 -0500
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.
---
programs/wordpad/En.rc | 3 ++-
programs/wordpad/wordpad.c | 7 +++++--
programs/wordpad/wordpad.h | 1 +
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/programs/wordpad/En.rc b/programs/wordpad/En.rc
index eecfef4..d1cfa5a 100644
--- a/programs/wordpad/En.rc
+++ b/programs/wordpad/En.rc
@@ -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
diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c
index 0120d4e..f2ec4c5 100644
--- a/programs/wordpad/wordpad.c
+++ b/programs/wordpad/wordpad.c
@@ -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);
}
diff --git a/programs/wordpad/wordpad.h b/programs/wordpad/wordpad.h
index 8126fdd..ece183f 100644
--- a/programs/wordpad/wordpad.h
+++ b/programs/wordpad/wordpad.h
@@ -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);