WineConsole: error reporting

Eric Pouech eric.pouech at wanadoo.fr
Sun Feb 23 03:27:22 CST 2003


this patch adds a better user feedback when setting bogus values in the 
configuration dialog box
this patch needs the propsheet patch from this batch to work properly

A+
-- 
Eric Pouech
-------------- next part --------------
Name:          wc_dlg
ChangeLog:     added checks when editing window and sb size so that they are kept consistent
License:       X11
GenDate:       2003/02/23 09:12:11 UTC
ModifiedFiles:  programs/wineconsole/dialog.c programs/wineconsole/wineconsole_De.rc programs/wineconsole/wineconsole_En.rc programs/wineconsole/wineconsole_Fr.rc programs/wineconsole/wineconsole_Hu.rc programs/wineconsole/wineconsole_Zh.rc programs/wineconsole/wineconsole_res.h
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/dialog.c,v
retrieving revision 1.14
diff -u -u -r1.14 dialog.c
--- programs/wineconsole/dialog.c	11 Jan 2003 21:00:20 -0000	1.14
+++ programs/wineconsole/dialog.c	22 Feb 2003 13:45:05 -0000
@@ -611,7 +611,6 @@
                                0, (LPARAM)s2);
             SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_SETCURSEL,
                                di->config.edition_mode, 0);
-            WINE_FIXME("edmo=%d\n", di->config.edition_mode);
     	}
 
 	break;
@@ -624,7 +623,7 @@
     case WM_NOTIFY:
     {
 	NMHDR*	        nmhdr = (NMHDR*)lParam;
-        int             x, y;
+        int             win_w, win_h, sb_w, sb_h;
         BOOL            st1, st2;
 
 	di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
@@ -634,21 +633,39 @@
             di->hDlg = hDlg;
             break;
 	case PSN_APPLY:
-            x = GetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH,  &st1, FALSE);
-            y = GetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, &st2, FALSE);
-            if (st1 && st2)
+            sb_w = GetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH,  &st1, FALSE);
+            sb_h = GetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, &st2, FALSE);
+            if (!st1 || ! st2)
             {
-                di->config.sb_width  = x;
-                di->config.sb_height = y;
+                SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID);        
+                return TRUE;
             }
-
-            x = GetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH,  &st1, FALSE);
-            y = GetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, &st2, FALSE);
-            if (st1 && st2)
+            win_w = GetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH,  &st1, FALSE);
+            win_h = GetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, &st2, FALSE);
+            if (!st1 || !st2)
             {
-                di->config.win_width  = x;
-                di->config.win_height = y;
+                SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID); 
+                return TRUE;
             }
+            if (win_w > sb_w || win_h > sb_h)
+            {
+                WCHAR   cap[256];
+                WCHAR   txt[256];
+
+                LoadString(GetModuleHandle(NULL), IDS_DLG_TIT_ERROR, 
+                           cap, sizeof(cap) / sizeof(WCHAR));
+                LoadString(GetModuleHandle(NULL), IDS_DLG_ERR_SBWINSIZE, 
+                           txt, sizeof(txt) / sizeof(WCHAR));
+                
+                MessageBox(hDlg, txt, cap, MB_OK);
+                SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID); 
+                return TRUE;
+            }
+            di->config.win_width  = win_w;
+            di->config.win_height = win_h;
+            di->config.sb_width  = sb_w;
+            di->config.sb_height = sb_h;
+
             di->config.exit_on_die = IsDlgButtonChecked(hDlg, IDC_CNF_CLOSE_EXIT) ? 1 : 0;
             di->config.edition_mode = SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_GETCURSEL,
                                                          0, 0);
Index: programs/wineconsole/wineconsole_De.rc
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole_De.rc,v
retrieving revision 1.4
diff -u -u -r1.4 wineconsole_De.rc
--- programs/wineconsole/wineconsole_De.rc	11 Jan 2003 21:00:20 -0000	1.4
+++ programs/wineconsole/wineconsole_De.rc	22 Feb 2003 13:47:37 -0000
@@ -32,8 +32,10 @@
 IDS_FNT_DISPLAY,	"Jeder Buchstabe ist %ld Pixel breit und %ld Pixel hoch"
 IDS_FNT_PREVIEW_1,	"Dies ist ein Test"
 IDS_FNT_PREVIEW_2,	""
-IDS_DLG_TIT_DEFAULT     "Setup - Standardeinstellungen"
-IDS_DLG_TIT_CURRENT     "Setup - aktuelle Einstellungen"
+IDS_DLG_TIT_DEFAULT,    "Setup - Standardeinstellungen"
+IDS_DLG_TIT_CURRENT,    "Setup - aktuelle Einstellungen"
+IDS_DLG_TIT_ERROR,      "Configuration error"
+IDS_DLG_ERR_SBWINSIZE,  "Screen buffer size must be greater or equal to the window's one"
 END
 
 IDD_OPTION DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105
Index: programs/wineconsole/wineconsole_En.rc
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole_En.rc,v
retrieving revision 1.10
diff -u -u -r1.10 wineconsole_En.rc
--- programs/wineconsole/wineconsole_En.rc	11 Jan 2003 21:00:20 -0000	1.10
+++ programs/wineconsole/wineconsole_En.rc	22 Feb 2003 13:47:52 -0000
@@ -32,8 +32,10 @@
 IDS_FNT_DISPLAY,	"Each character is %ld pixels wide on %ld pixels high"
 IDS_FNT_PREVIEW_1,	"This is a test"
 IDS_FNT_PREVIEW_2,	""
-IDS_DLG_TIT_DEFAULT     "Setup - Default settings"
-IDS_DLG_TIT_CURRENT     "Setup - Current settings"
+IDS_DLG_TIT_DEFAULT,    "Setup - Default settings"
+IDS_DLG_TIT_CURRENT,    "Setup - Current settings"
+IDS_DLG_TIT_ERROR,	"Configuration error"
+IDS_DLG_ERR_SBWINSIZE,	"Screen buffer size must be greater or equal to the window's one"
 END
 
 IDD_OPTION DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105
Index: programs/wineconsole/wineconsole_Fr.rc
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole_Fr.rc,v
retrieving revision 1.8
diff -u -u -r1.8 wineconsole_Fr.rc
--- programs/wineconsole/wineconsole_Fr.rc	11 Jan 2003 21:00:20 -0000	1.8
+++ programs/wineconsole/wineconsole_Fr.rc	22 Feb 2003 13:48:04 -0000
@@ -32,8 +32,10 @@
 IDS_FNT_DISPLAY,	"Chaque caractère a %ld points en largeur et %ld points en hauteur"
 IDS_FNT_PREVIEW_1,	"Ceci est un test"
 IDS_FNT_PREVIEW_2,	"éèàôë"
-IDS_DLG_TIT_DEFAULT     "Configuration par défault"
-IDS_DLG_TIT_CURRENT     "Configuration courante"
+IDS_DLG_TIT_DEFAULT,    "Configuration par défault"
+IDS_DLG_TIT_CURRENT,    "Configuration courante"
+IDS_DLG_TIT_ERROR,	"Erreur de configuration"
+IDS_DLG_ERR_SBWINSIZE,	"La taille du tampon écran doit être plus grande que celle de la fenêtre"
 END
 
 IDD_OPTION DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105
Index: programs/wineconsole/wineconsole_Hu.rc
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole_Hu.rc,v
retrieving revision 1.2
diff -u -u -r1.2 wineconsole_Hu.rc
--- programs/wineconsole/wineconsole_Hu.rc	11 Jan 2003 21:00:20 -0000	1.2
+++ programs/wineconsole/wineconsole_Hu.rc	22 Feb 2003 13:48:14 -0000
@@ -33,8 +33,10 @@
 IDS_FNT_DISPLAY,	"Minden karakter %ld pixel széles és %ld pixel magas"
 IDS_FNT_PREVIEW_1,	"Ez egy teszt"
 IDS_FNT_PREVIEW_2,	""
-IDS_DLG_TIT_DEFAULT     "Beállítás - alapértelmezett beállítások"
-IDS_DLG_TIT_CURRENT     "Beállítás - aktuális beállítások"
+IDS_DLG_TIT_DEFAULT,    "Beállítás - alapértelmezett beállítások"
+IDS_DLG_TIT_CURRENT,    "Beállítás - aktuális beállítások"
+IDS_DLG_TIT_ERROR,      "Configuration error"
+IDS_DLG_ERR_SBWINSIZE,  "Screen buffer size must be greater or equal to the window's one"
 END
 
 IDD_OPTION DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105
Index: programs/wineconsole/wineconsole_Zh.rc
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole_Zh.rc,v
retrieving revision 1.2
diff -u -u -r1.2 wineconsole_Zh.rc
--- programs/wineconsole/wineconsole_Zh.rc	11 Jan 2003 21:00:20 -0000	1.2
+++ programs/wineconsole/wineconsole_Zh.rc	22 Feb 2003 13:48:25 -0000
@@ -34,8 +34,10 @@
 IDS_FNT_DISPLAY,	"ÿ¸ö×Ö¶¼ÊÇ %ld ¸öÏñËØ¿í£¬%ld ¸öÏñËظß"
 IDS_FNT_PREVIEW_1,	"ÕâÊÇÒ»¶Î²âÊÔÓï¾ä"
 IDS_FNT_PREVIEW_2,	""
-IDS_DLG_TIT_DEFAULT     "ÅäÖà - ĬÈÏÉèÖÃ"
-IDS_DLG_TIT_CURRENT     "ÅäÖà - µ±Ç°ÉèÖÃ"
+IDS_DLG_TIT_DEFAULT,    "ÅäÖà - ĬÈÏÉèÖÃ"
+IDS_DLG_TIT_CURRENT,    "ÅäÖà - µ±Ç°ÉèÖÃ"
+IDS_DLG_TIT_ERROR,      "Configuration error"
+IDS_DLG_ERR_SBWINSIZE,  "Screen buffer size must be greater or equal to the window's one"
 END
 
 IDD_OPTION DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105
Index: programs/wineconsole/wineconsole_res.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole_res.h,v
retrieving revision 1.7
diff -u -u -r1.7 wineconsole_res.h
--- programs/wineconsole/wineconsole_res.h	11 Jan 2003 21:00:20 -0000	1.7
+++ programs/wineconsole/wineconsole_res.h	22 Feb 2003 13:41:15 -0000
@@ -32,6 +32,9 @@
 
 #define IDS_DLG_TIT_DEFAULT     0x120
 #define IDS_DLG_TIT_CURRENT     0x121
+#define IDS_DLG_TIT_ERROR       0x122
+
+#define IDS_DLG_ERR_SBWINSIZE   0x130
 
 #define IDS_FNT_DISPLAY		0x200
 #define IDS_FNT_PREVIEW_1	0x201


More information about the wine-patches mailing list