This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] windres: (1) default dialog styles
- From: Gunnar Degnbol <degnbol at danbbs dot dk>
- To: binutils at sources dot redhat dot com
- Date: Tue, 19 Mar 2002 21:49:33 +0100
- Subject: [PATCH] windres: (1) default dialog styles
windres adds WS_POPUP | WS_SYSMENU | WS_BORDER to all
dialogs. MS rc.exe sets these styles only if no STYLE
statement is present.
This is a problem because dialogs used as controls in other
dialogs (e.g. open/save dialog extensions) should not have
the WS_POPUP style. It can be worked around by adding the
style NOT WS_POPUP.
The patch initializes style to 0 when initializing dialog,
instead of setting it to dialog.style when the STYLE
statement is parsed. It is still assigned to dialog.style
when a STYLE statement is present. If a FONT statement is
present it sets the DS_SETFONT style of both style and
dialog.style, so it is independent of the order.
Incomplete fixes for this was posted by Bernd Herd:
http://sources.redhat.com/ml/binutils/2002-02/msg00021.html
and Eric Kohl:
http://sources.redhat.com/ml/binutils/2002-01/msg00130.html
They were combined with fixes for other bugs.
I will post 4 simple fixes from Bernd's patch, one at a time,
and also fixes for the 7 other bugs I found while
investigating this one. I will look some more at Bernd's last
fix (for CONTROL initialization parameters) and at Eric's
other fix (for the FONT statement).
There are no dependencies between these patches.
ChangeLog:
2002-03-19 Gunnar Degnbol <degnbol@danbbs.dk>
* rcparse.y: Don't add default dialog style when
explicit style specified
defstyle.rc:
101 DIALOG 0, 0, 186, 95
STYLE 0
BEGIN
DEFPUSHBUTTON "OK",1,129,7,50,14
END
before patch (I have removed the generated comments):
$ /bin/windres.exe -i defstyle.rc
LANGUAGE 0, 0
101 DIALOG MOVEABLE DISCARDABLE 0, 0, 186, 95
STYLE 0x80880000
BEGIN
DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14, 0x50010001
END
After patch:
$ /usr/local/bin/windres -i defstyle.rc
LANGUAGE 0, 0
101 DIALOG MOVEABLE DISCARDABLE 0, 0, 186, 95
BEGIN
DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14, 0x50010001
END
defstyle.patch:
--- binutils/rcparse.y Wed Sep 19 07:33:16 2001
+++ binutils.new/rcparse.y Sun Mar 17 14:41:50 2002
@@ -340,6 +340,7 @@
dialog.ex = NULL;
dialog.controls = NULL;
sub_res_info = $3;
+
style = 0;
}
styles BEG controls END
{
@@ -363,6 +364,7 @@
memset (dialog.ex, 0, sizeof (struct dialog_ex));
dialog.controls = NULL;
sub_res_info = $3;
+
style = 0;
}
styles BEG controls END
{
@@ -387,6 +389,7 @@
dialog.ex->help = $9;
dialog.controls = NULL;
sub_res_info = $3;
+
style = 0;
}
styles BEG controls END
{
@@ -416,7 +419,6 @@
dialog.class = $3;
}
| styles STYLE
-
{ style = dialog.style; }
styleexpr
{
dialog.style = style;
@@ -428,12 +430,14 @@
| styles FONT numexpr ',' QUOTEDSTRING
{
dialog.style |= DS_SETFONT;
+
style |= DS_SETFONT;
dialog.pointsize = $3;
unicode_from_ascii ((int *) NULL, &dialog.font, $5);
}
| styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr
{
dialog.style |= DS_SETFONT;
+
style |= DS_SETFONT;
dialog.pointsize = $3;
unicode_from_ascii ((int *) NULL, &dialog.font, $5);
if (dialog.ex == NULL)