mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 09:21:14 +00:00
msi: Don't open code dialog_add_control() in dialog_line_control().
Commit b1cc87cb65
("msi: The line control has a height of exactly 2
device units.", 2007-12-16) open-coded the body of
(msi_)dialog_add_control() inside dialog_line_control() modulo the
height override.
Except the fixed height, line controls have nothing special compared to
other controls. Thus, there is little merit in open-coding it.
Also, dialog_line_control() has bit-rotted over time; it already missed
a few changes that were done to any other controls.
Fix this by just using dialog_add_control(). Also, add a special case
logic just for line controls.
This commit is contained in:
parent
3eceda2f2a
commit
1fca47b724
1 changed files with 5 additions and 56 deletions
|
@ -419,6 +419,9 @@ static struct control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec,
|
|||
font = dialog_get_style( title_font, &title );
|
||||
}
|
||||
|
||||
if (!wcsicmp( MSI_RecordGetString( rec, 3 ), L"Line" ))
|
||||
height = 2; /* line is exactly 2 units in height */
|
||||
|
||||
control->hwnd = CreateWindowExW( exstyle, szCls, title, style,
|
||||
x, y, width, height, parent, NULL, NULL, NULL );
|
||||
|
||||
|
@ -1163,62 +1166,8 @@ static UINT dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||
|
||||
static UINT dialog_line_control( msi_dialog *dialog, MSIRECORD *rec )
|
||||
{
|
||||
DWORD attributes;
|
||||
LPCWSTR name;
|
||||
DWORD style, exstyle = 0;
|
||||
DWORD x, y, width, height;
|
||||
struct control *control;
|
||||
|
||||
TRACE("%p %p\n", dialog, rec);
|
||||
|
||||
style = WS_CHILD | SS_ETCHEDHORZ | SS_SUNKEN;
|
||||
|
||||
name = MSI_RecordGetString( rec, 2 );
|
||||
attributes = MSI_RecordGetInteger( rec, 8 );
|
||||
|
||||
if( attributes & msidbControlAttributesVisible )
|
||||
style |= WS_VISIBLE;
|
||||
if( ~attributes & msidbControlAttributesEnabled )
|
||||
style |= WS_DISABLED;
|
||||
if( attributes & msidbControlAttributesSunken )
|
||||
exstyle |= WS_EX_CLIENTEDGE;
|
||||
|
||||
dialog_map_events( dialog, name );
|
||||
|
||||
control = malloc( offsetof( struct control, name[wcslen( name ) + 1] ) );
|
||||
if (!control)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
||||
lstrcpyW( control->name, name );
|
||||
list_add_tail( &dialog->controls, &control->entry );
|
||||
control->handler = NULL;
|
||||
control->update = NULL;
|
||||
control->property = NULL;
|
||||
control->value = NULL;
|
||||
control->hBitmap = NULL;
|
||||
control->hIcon = NULL;
|
||||
control->hImageList = NULL;
|
||||
control->hDll = NULL;
|
||||
control->tabnext = wcsdup( MSI_RecordGetString( rec, 11 ) );
|
||||
control->type = wcsdup( MSI_RecordGetString( rec, 3 ) );
|
||||
control->progress_current = 0;
|
||||
control->progress_max = 100;
|
||||
control->progress_backwards = FALSE;
|
||||
|
||||
x = MSI_RecordGetInteger( rec, 4 );
|
||||
y = MSI_RecordGetInteger( rec, 5 );
|
||||
width = MSI_RecordGetInteger( rec, 6 );
|
||||
|
||||
x = dialog_scale_unit( dialog, x );
|
||||
y = dialog_scale_unit( dialog, y );
|
||||
width = dialog_scale_unit( dialog, width );
|
||||
height = 2; /* line is exactly 2 units in height */
|
||||
|
||||
control->hwnd = CreateWindowExW( exstyle, L"Static", NULL, style,
|
||||
x, y, width, height, dialog->hwnd, NULL, NULL, NULL );
|
||||
|
||||
TRACE("Dialog %s control %s hwnd %p\n",
|
||||
debugstr_w(dialog->name), debugstr_w(name), control->hwnd );
|
||||
if (!dialog_add_control( dialog, rec, L"Static", SS_ETCHEDHORZ | SS_SUNKEN))
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue