Commit 1ce88e95 authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

- Bugfix: Styles were evaluated as expressions. The NOT in combination

with style flags was not overwriting the default styles like WS_VISIBLE. Solved by introducing own rules for parsing styles.
parent aebda22e
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Version 1.0.16 (6-Nov-1999)
Juergen.Schmied@debitel.net
- Bugfix: Styles were evaluated as expressions. The NOT in combination
with style flags was not overwriting the default styles like WS_VISIBLE.
Solved by introducing own rules for parsing styles.
---------------------------------------------------------------------------
Version 1.0.15 (13-Aug-1999) Version 1.0.15 (13-Aug-1999)
Bertho Stultiens <bertho@akhphd.au.dk> Bertho Stultiens <bertho@akhphd.au.dk>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "config.h" #include "config.h"
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
...@@ -497,9 +498,17 @@ void dump_control(control_t *ctrl) ...@@ -497,9 +498,17 @@ void dump_control(control_t *ctrl)
printf("\tId: %d\n", ctrl->id); printf("\tId: %d\n", ctrl->id);
printf("\tx, y, w, h: %d, %d, %d, %d\n", ctrl->x, ctrl->y, ctrl->width, ctrl->height); printf("\tx, y, w, h: %d, %d, %d, %d\n", ctrl->x, ctrl->y, ctrl->width, ctrl->height);
if(ctrl->gotstyle) if(ctrl->gotstyle)
printf("\tStyle: %08lx\n", ctrl->style); {
assert(ctrl->style != NULL);
assert(ctrl->style->and_mask == 0);
printf("\tStyle: %08lx\n", ctrl->style->or_mask);
}
if(ctrl->gotexstyle) if(ctrl->gotexstyle)
printf("\tExStyle: %08lx\n", ctrl->exstyle); {
assert(ctrl->exstyle != NULL);
assert(ctrl->exstyle->and_mask == 0);
printf("\tExStyle: %08lx\n", ctrl->exstyle->or_mask);
}
if(ctrl->gothelpid) if(ctrl->gothelpid)
printf("\tHelpid: %ld\n", ctrl->helpid); printf("\tHelpid: %ld\n", ctrl->helpid);
if(ctrl->extra) if(ctrl->extra)
...@@ -529,9 +538,18 @@ void dump_dialog(dialog_t *dlg) ...@@ -529,9 +538,18 @@ void dump_dialog(dialog_t *dlg)
dump_lvc(&(dlg->lvc)); dump_lvc(&(dlg->lvc));
printf("x, y, w, h: %d, %d, %d, %d\n", dlg->x, dlg->y, dlg->width, dlg->height); printf("x, y, w, h: %d, %d, %d, %d\n", dlg->x, dlg->y, dlg->width, dlg->height);
if(dlg->gotstyle) if(dlg->gotstyle)
printf("Style: %08lx\n", dlg->style); {
assert(dlg->style != NULL);
assert(dlg->style->and_mask == 0);
printf("Style: %08lx\n", dlg->style->or_mask);
}
if(dlg->gotexstyle) if(dlg->gotexstyle)
printf("ExStyle: %08lx\n", dlg->exstyle); {
assert(dlg->exstyle != NULL);
assert(dlg->exstyle->and_mask == 0);
printf("ExStyle: %08lx\n", dlg->exstyle->or_mask);
}
printf("Menu: %s\n", get_nameid_str(dlg->menu)); printf("Menu: %s\n", get_nameid_str(dlg->menu));
printf("Class: %s\n", get_nameid_str(dlg->dlgclass)); printf("Class: %s\n", get_nameid_str(dlg->dlgclass));
printf("Title: "); print_string(dlg->title); printf("\n"); printf("Title: "); print_string(dlg->title); printf("\n");
...@@ -570,9 +588,17 @@ void dump_dialogex(dialogex_t *dlgex) ...@@ -570,9 +588,17 @@ void dump_dialogex(dialogex_t *dlgex)
dump_lvc(&(dlgex->lvc)); dump_lvc(&(dlgex->lvc));
printf("x, y, w, h: %d, %d, %d, %d\n", dlgex->x, dlgex->y, dlgex->width, dlgex->height); printf("x, y, w, h: %d, %d, %d, %d\n", dlgex->x, dlgex->y, dlgex->width, dlgex->height);
if(dlgex->gotstyle) if(dlgex->gotstyle)
printf("Style: %08lx\n", dlgex->style); {
assert(dlgex->style != NULL);
assert(dlgex->style->and_mask == 0);
printf("Style: %08lx\n", dlgex->style->or_mask);
}
if(dlgex->gotexstyle) if(dlgex->gotexstyle)
printf("ExStyle: %08lx\n", dlgex->exstyle); {
assert(dlgex->exstyle != NULL);
assert(dlgex->exstyle->and_mask == 0);
printf("ExStyle: %08lx\n", dlgex->exstyle->or_mask);
}
if(dlgex->gothelpid) if(dlgex->gothelpid)
printf("Helpid: %ld\n", dlgex->helpid); printf("Helpid: %ld\n", dlgex->helpid);
printf("Menu: %s\n", get_nameid_str(dlgex->menu)); printf("Menu: %s\n", get_nameid_str(dlgex->menu));
......
...@@ -415,8 +415,8 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg) ...@@ -415,8 +415,8 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg)
{ {
restag = put_res_header(res, WRC_RT_DIALOG, NULL, name, dlg->memopt, &(dlg->lvc)); restag = put_res_header(res, WRC_RT_DIALOG, NULL, name, dlg->memopt, &(dlg->lvc));
put_dword(res, dlg->style); put_dword(res, dlg->style->or_mask);
put_dword(res, dlg->gotexstyle ? dlg->exstyle : 0); put_dword(res, dlg->gotexstyle ? dlg->exstyle->or_mask : 0);
tag_nctrl = res->size; tag_nctrl = res->size;
put_word(res, 0); /* Number of controls */ put_word(res, 0); /* Number of controls */
put_word(res, dlg->x); put_word(res, dlg->x);
...@@ -445,8 +445,8 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg) ...@@ -445,8 +445,8 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg)
while(ctrl) while(ctrl)
{ {
/* FIXME: what is default control style? */ /* FIXME: what is default control style? */
put_dword(res, ctrl->gotstyle ? ctrl->style : WS_CHILD); put_dword(res, ctrl->gotstyle ? ctrl->style->or_mask: WS_CHILD);
put_dword(res, ctrl->gotexstyle ? ctrl->exstyle : 0); put_dword(res, ctrl->gotexstyle ? ctrl->exstyle->or_mask : 0);
put_word(res, ctrl->x); put_word(res, ctrl->x);
put_word(res, ctrl->y); put_word(res, ctrl->y);
put_word(res, ctrl->width); put_word(res, ctrl->width);
...@@ -481,7 +481,7 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg) ...@@ -481,7 +481,7 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg)
{ {
restag = put_res_header(res, WRC_RT_DIALOG, NULL, name, dlg->memopt, NULL); restag = put_res_header(res, WRC_RT_DIALOG, NULL, name, dlg->memopt, NULL);
put_dword(res, dlg->gotstyle ? dlg->style : WS_POPUPWINDOW); put_dword(res, dlg->gotstyle ? dlg->style->or_mask : WS_POPUPWINDOW);
tag_nctrl = res->size; tag_nctrl = res->size;
put_byte(res, 0); /* Number of controls */ put_byte(res, 0); /* Number of controls */
put_word(res, dlg->x); put_word(res, dlg->x);
...@@ -513,7 +513,7 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg) ...@@ -513,7 +513,7 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg)
put_word(res, ctrl->width); put_word(res, ctrl->width);
put_word(res, ctrl->height); put_word(res, ctrl->height);
put_word(res, ctrl->id); put_word(res, ctrl->id);
put_dword(res, ctrl->gotstyle ? ctrl->style : WS_CHILD); put_dword(res, ctrl->gotstyle ? ctrl->style->or_mask: WS_CHILD);
if(ctrl->ctlclass) if(ctrl->ctlclass)
{ {
if(ctrl->ctlclass->type == name_ord if(ctrl->ctlclass->type == name_ord
...@@ -583,8 +583,8 @@ res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex) ...@@ -583,8 +583,8 @@ res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex)
put_word(res, 1); /* Signature */ put_word(res, 1); /* Signature */
put_word(res, 0xffff); /* DlgVer */ put_word(res, 0xffff); /* DlgVer */
put_dword(res, dlgex->gothelpid ? dlgex->helpid : 0); put_dword(res, dlgex->gothelpid ? dlgex->helpid : 0);
put_dword(res, dlgex->gotexstyle ? dlgex->exstyle : 0); put_dword(res, dlgex->gotexstyle ? dlgex->exstyle->or_mask : 0);
put_dword(res, dlgex->gotstyle ? dlgex->style : WS_POPUPWINDOW); put_dword(res, dlgex->gotstyle ? dlgex->style->or_mask : WS_POPUPWINDOW);
tag_nctrl = res->size; tag_nctrl = res->size;
put_word(res, 0); /* Number of controls */ put_word(res, 0); /* Number of controls */
put_word(res, dlgex->x); put_word(res, dlgex->x);
...@@ -619,9 +619,9 @@ res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex) ...@@ -619,9 +619,9 @@ res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex)
while(ctrl) while(ctrl)
{ {
put_dword(res, ctrl->gothelpid ? ctrl->helpid : 0); put_dword(res, ctrl->gothelpid ? ctrl->helpid : 0);
put_dword(res, ctrl->gotexstyle ? ctrl->exstyle : 0); put_dword(res, ctrl->gotexstyle ? ctrl->exstyle->or_mask : 0);
/* FIXME: what is default control style? */ /* FIXME: what is default control style? */
put_dword(res, ctrl->gotstyle ? ctrl->style : WS_CHILD | WS_VISIBLE); put_dword(res, ctrl->gotstyle ? ctrl->style->or_mask : WS_CHILD | WS_VISIBLE);
put_word(res, ctrl->x); put_word(res, ctrl->x);
put_word(res, ctrl->y); put_word(res, ctrl->y);
put_word(res, ctrl->width); put_word(res, ctrl->width);
......
...@@ -279,10 +279,18 @@ dlginit_t *new_dlginit(raw_data_t *rd, int *memopt) ...@@ -279,10 +279,18 @@ dlginit_t *new_dlginit(raw_data_t *rd, int *memopt)
return di; return di;
} }
style_pair_t *new_style_pair(int style, int exstyle) style_pair_t *new_style_pair(style_t *style, style_t *exstyle)
{ {
style_pair_t *sp = (style_pair_t *)xmalloc(sizeof(style_pair_t)); style_pair_t *sp = (style_pair_t *)xmalloc(sizeof(style_pair_t));
sp->style = style; sp->style = style;
sp->exstyle = exstyle; sp->exstyle = exstyle;
return sp; return sp;
} }
style_t *new_style(DWORD or_mask, DWORD and_mask)
{
style_t *st = (style_t *)xmalloc(sizeof(style_t));
st->or_mask = or_mask;
st->and_mask = and_mask;
return st;
}
...@@ -64,7 +64,8 @@ void copy_raw_data(raw_data_t *dst, raw_data_t *src, int offs, int len); ...@@ -64,7 +64,8 @@ void copy_raw_data(raw_data_t *dst, raw_data_t *src, int offs, int len);
int *new_int(int i); int *new_int(int i);
stringtable_t *new_stringtable(lvc_t *lvc); stringtable_t *new_stringtable(lvc_t *lvc);
toolbar_t *new_toolbar(int button_width, int button_Height, toolbar_item_t *items, int nitems); toolbar_t *new_toolbar(int button_width, int button_Height, toolbar_item_t *items, int nitems);
style_pair_t *new_style_pair(int style, int exstyle); style_pair_t *new_style_pair(style_t *style, style_t *exstyle);
style_t *new_style(DWORD or_mask, DWORD and_mask);
#endif #endif
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include "wrctypes.h" #include "wrctypes.h"
#endif #endif
#define WRC_VERSION "1.0.15" #define WRC_VERSION "1.0.16"
#define WRC_RELEASEDATE "(13-Aug-1999)" #define WRC_RELEASEDATE "(6-Nov-1999)"
#define WRC_FULLVERSION WRC_VERSION " " WRC_RELEASEDATE #define WRC_FULLVERSION WRC_VERSION " " WRC_RELEASEDATE
/* Only used in heavy debugging sessions */ /* Only used in heavy debugging sessions */
......
...@@ -111,6 +111,12 @@ typedef struct font_id { ...@@ -111,6 +111,12 @@ typedef struct font_id {
int italic; int italic;
} font_id_t; } font_id_t;
/* control styles */
typedef struct style {
DWORD or_mask;
DWORD and_mask;
} style_t;
/* resource types */ /* resource types */
/* These are in the same order (and ordinal) as the RT_xxx /* These are in the same order (and ordinal) as the RT_xxx
* defines. This is _required_. * defines. This is _required_.
...@@ -171,8 +177,8 @@ typedef struct control { ...@@ -171,8 +177,8 @@ typedef struct control {
int y; int y;
int width; /* Size */ int width; /* Size */
int height; int height;
DWORD style; /* Style */ style_t *style; /* Style */
DWORD exstyle; style_t *exstyle;
DWORD helpid; /* EX: */ DWORD helpid; /* EX: */
int gotstyle; /* Used to determine whether the default */ int gotstyle; /* Used to determine whether the default */
int gotexstyle; /* styles must be set */ int gotexstyle; /* styles must be set */
...@@ -186,8 +192,8 @@ typedef struct dialog { ...@@ -186,8 +192,8 @@ typedef struct dialog {
int y; int y;
int width; /* Size */ int width; /* Size */
int height; int height;
DWORD style; /* Style */ style_t *style; /* Style */
DWORD exstyle; style_t *exstyle;
int gotstyle; /* Used to determine whether the default */ int gotstyle; /* Used to determine whether the default */
int gotexstyle; /* styles must be set */ int gotexstyle; /* styles must be set */
name_id_t *menu; name_id_t *menu;
...@@ -205,8 +211,8 @@ typedef struct dialogex { ...@@ -205,8 +211,8 @@ typedef struct dialogex {
int y; int y;
int width; /* Size */ int width; /* Size */
int height; int height;
DWORD style; /* Style */ style_t *style; /* Style */
DWORD exstyle; style_t *exstyle;
DWORD helpid; /* EX: */ DWORD helpid; /* EX: */
int gotstyle; /* Used to determine whether the default */ int gotstyle; /* Used to determine whether the default */
int gotexstyle; /* styles must be set */ int gotexstyle; /* styles must be set */
...@@ -529,8 +535,8 @@ typedef struct res_count { ...@@ -529,8 +535,8 @@ typedef struct res_count {
} res_count_t; } res_count_t;
typedef struct style_pair { typedef struct style_pair {
int style; style_t *style;
int exstyle; style_t *exstyle;
} style_pair_t; } style_pair_t;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment