Commit 1fca47b7 authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

msi: Don't open code dialog_add_control() in dialog_line_control().

Commit b1cc87cb ("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.
parent 3eceda2f
...@@ -419,6 +419,9 @@ static struct control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, ...@@ -419,6 +419,9 @@ static struct control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec,
font = dialog_get_style( title_font, &title ); 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, control->hwnd = CreateWindowExW( exstyle, szCls, title, style,
x, y, width, height, parent, NULL, NULL, NULL ); x, y, width, height, parent, NULL, NULL, NULL );
...@@ -1163,62 +1166,8 @@ static UINT dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1163,62 +1166,8 @@ static UINT dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec )
static UINT dialog_line_control( msi_dialog *dialog, MSIRECORD *rec ) static UINT dialog_line_control( msi_dialog *dialog, MSIRECORD *rec )
{ {
DWORD attributes; if (!dialog_add_control( dialog, rec, L"Static", SS_ETCHEDHORZ | SS_SUNKEN))
LPCWSTR name; return ERROR_FUNCTION_FAILED;
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 );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
......
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