UINT nTotalCreated;
UINT mdiFlags;
UINT sbRecalc; /* SB_xxx flags for scrollbar fixup */
+ DWORD initialStyle; /* Style when window was created */ // See http://bugs.winehq.org/show_bug.cgi?id=9435
HBITMAP hBmpClose; /* ReactOS modification */
} MDICLIENTINFO;
static void MDITile( HWND client, MDICLIENTINFO *ci, WPARAM wParam )
{
HWND *win_array;
- int i, total;
+ int i, total, rows, columns;
BOOL has_icons = FALSE;
if (ci->hwndChildMaximized)
if (!(win_array = WIN_ListChildren( client ))) return;
/* remove all the windows we don't want */
- for (i = total = 0; win_array[i]; i++)
+ for (i = total = rows = 0; win_array[i]; i++)
{
if (!IsWindowVisible( win_array[i] )) continue;
if (GetWindow( win_array[i], GW_OWNER )) continue; /* skip owned windows (icon titles) */
continue;
}
if ((wParam & MDITILE_SKIPDISABLED) && !IsWindowEnabled( win_array[i] )) continue;
+ if(total == (rows * (rows + 2))) rows++; /* total+1 == (rows+1)*(rows+1) */
win_array[total++] = win_array[i];
}
win_array[total] = 0;
HWND *pWnd = win_array;
RECT rect;
int x, y, xsize, ysize;
- int rows, columns, r, c, i;
+ int r, c, i;
GetClientRect(client,&rect);
- rows = (int) sqrt((double)total);
- columns = total / rows;
+ columns = total/rows;
+ //while(total < rows*columns) rows++;
if( wParam & MDITILE_HORIZONTAL ) /* version >= 3.1 */
{
nItems = GetMenuItemCount(menu) - 1;
iId = GetMenuItemID(menu,nItems) ;
if (iId == SC_RESTORE || iId == SC_CLOSE)
+ {
+ ERR("system buttons already exist\n");
return 0;
-
+ }
+//// End
/* create a copy of sysmenu popup and insert it into frame menu bar */
if (!(hSysPopup = GetSystemMenu(hChild, FALSE)))
{
}
AppendMenuW(menu, MF_HELP | MF_BITMAP,
- SC_MINIMIZE, (LPCWSTR)HBMMENU_MBAR_MINIMIZE ) ;
+ SC_CLOSE, is_close_enabled(hChild, hSysPopup) ?
+ (LPCWSTR)HBMMENU_MBAR_CLOSE : (LPCWSTR)HBMMENU_MBAR_CLOSE_D );
AppendMenuW(menu, MF_HELP | MF_BITMAP,
SC_RESTORE, (LPCWSTR)HBMMENU_MBAR_RESTORE );
AppendMenuW(menu, MF_HELP | MF_BITMAP,
- SC_CLOSE, is_close_enabled(hChild, hSysPopup) ?
- (LPCWSTR)HBMMENU_MBAR_CLOSE : (LPCWSTR)HBMMENU_MBAR_CLOSE_D );
+ SC_MINIMIZE, (LPCWSTR)HBMMENU_MBAR_MINIMIZE ) ;
/* The system menu is replaced by the child icon */
- hIcon = (HICON)GetClassLongPtrW(hChild, GCLP_HICONSM);
+ hIcon = (HICON)SendMessageW(hChild, WM_GETICON, ICON_SMALL, 0);
if (!hIcon)
- hIcon = (HICON)GetClassLongPtrW(hChild, GCLP_HICON);
+ hIcon = (HICON)SendMessageW(hChild, WM_GETICON, ICON_BIG, 0);
if (!hIcon)
- hIcon = LoadIconW(NULL, IDI_APPLICATION);
-//// End
+ hIcon = LoadImageW(0, MAKEINTRESOURCEW(IDI_WINLOGO), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
if (hIcon)
{
HDC hMemDC;
nItems = GetMenuItemCount(menu) - 1;
iId = GetMenuItemID(menu,nItems) ;
if( !(iId == SC_RESTORE || iId == SC_CLOSE) )
+ {
+ ERR("no system buttons then nothing to do\n");
return 0;
+ }
/*
* Remove the system menu, If that menu is the icon of the window
ci->nTotalCreated = 0;
ci->frameTitle = NULL;
ci->mdiFlags = 0;
- ci->hFrameMenu = GetMenu(cs->hwndParent);
+ ci->initialStyle = cs->style;
+ ci->hFrameMenu = GetMenu(cs->hwndParent);
if (!ci->hBmpClose) ci->hBmpClose = CreateMDIMenuBitmap();
case WM_MDINEXT: /* lParam != 0 means previous window */
{
- HWND next = MDI_GetWindow( ci, (HWND)wParam, !lParam, 0 );
+ HWND hwnd = wParam ? WIN_GetFullHandle((HWND)wParam) : ci->hwndActiveChild;
+ HWND next = MDI_GetWindow( ci, hwnd, !lParam, 0 );
MDI_SwitchActiveChild( ci, next, TRUE );
+ if(!lParam)
+ SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
break;
}
case SC_NEXTWINDOW:
case SC_PREVWINDOW:
case SC_RESTORE:
- return SendMessageW( ci->hwndActiveChild, WM_SYSCOMMAND,
+ return SendMessageW( ci->hwndChildMaximized, WM_SYSCOMMAND,
wParam, lParam);
}
}
case WM_CHILDACTIVATE:
case WM_SYSCOMMAND:
case WM_SHOWWINDOW:
-#ifndef __REACTOS__
case WM_SETVISIBLE:
-#endif
case WM_SIZE:
case WM_NEXTMENU:
case WM_SYSCHAR:
return 0;
case WM_MENUCHAR:
- return 0x00010000; /* MDI children don't have menu bars */
+ return MAKELRESULT( 0, MNC_CLOSE ); /* MDI children don't have menu bars */
case WM_CLOSE:
SendMessageW( client, WM_MDIDESTROY, (WPARAM)hwnd, 0 );
return SendMessageW( GetParent(client), message, wParam, lParam);
break;
case SC_NEXTWINDOW:
- SendMessageW( client, WM_MDINEXT, 0, 0);
+ SendMessageW( client, WM_MDINEXT, (WPARAM)ci->hwndActiveChild, 0);
return 0;
case SC_PREVWINDOW:
- SendMessageW( client, WM_MDINEXT, 0, 1);
+ SendMessageW( client, WM_MDINEXT, (WPARAM)ci->hwndActiveChild, 1);
return 0;
}
break;
case WM_SHOWWINDOW:
-#ifndef __REACTOS__
case WM_SETVISIBLE:
-#endif
- if (ci->hwndChildMaximized) ci->mdiFlags &= ~MDIF_NEEDUPDATE;
- else MDI_PostUpdate(client, ci, SB_BOTH+1);
+ //// Commented out r57663
+ /*if (ci->hwndChildMaximized) ci->mdiFlags &= ~MDIF_NEEDUPDATE;
+ else*/ MDI_PostUpdate(client, ci, SB_BOTH+1);
break;
case WM_SIZE:
SCROLLINFO info;
RECT childRect, clientRect;
HWND *list;
+ MDICLIENTINFO *ci;
WINDOWINFO WindowInfo;
+ ci = get_client_info(hwnd);
GetClientRect( hwnd, &clientRect );
SetRectEmpty( &childRect );
return;
}
+ ERR("CalcChildScroll 1\n");
if ((list = WIN_ListChildren( hwnd )))
{
int i;
{
HeapFree( GetProcessHeap(), 0, list );
ShowScrollBar( hwnd, SB_BOTH, FALSE );
+ ERR("CalcChildScroll 2\n");
return;
}
if (style & WS_VISIBLE)
GetWindowRect( list[i], &rect );
OffsetRect(&rect, -WindowInfo.rcClient.left,
-WindowInfo.rcClient.top);
+ //WIN_GetRectangles( list[i], COORDS_PARENT, &rect, NULL );
+ ERR("CalcChildScroll L\n");
UnionRect( &childRect, &rect, &childRect );
}
}
HeapFree( GetProcessHeap(), 0, list );
}
- MapWindowPoints( 0, hwnd, (POINT *)&childRect, 2 );
UnionRect( &childRect, &clientRect, &childRect );
-
+ ERR("CalcChildScroll 3\n");
/* set common info values */
info.cbSize = sizeof(info);
info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
info.nMax = childRect.right;
info.nPos = 0;
info.nPage = 1 + clientRect.right - clientRect.left;
- SetScrollInfo(hwnd, SB_HORZ, &info, TRUE);
- if (scroll == SB_HORZ) break;
+ //info.nMax = childRect.right - clientRect.right;
+ //info.nPos = clientRect.left - childRect.left;
+ if (ci->initialStyle & WS_HSCROLL)
+ SetScrollInfo(hwnd, SB_HORZ, &info, TRUE);
+ if (scroll == SB_HORZ)
+ {
+ ERR("CalcChildScroll H\n");
+ break;
+ }
+ else
+ {
+ ERR("CalcChildScroll B\n");
+ }
/* fall through */
case SB_VERT:
info.nMin = childRect.top;
info.nMax = childRect.bottom;
info.nPos = 0;
info.nPage = 1 + clientRect.bottom - clientRect.top;
- SetScrollInfo(hwnd, SB_VERT, &info, TRUE);
+ //info.nMax = childRect.bottom - clientRect.bottom;
+ //info.nPos = clientRect.top - childRect.top;
+ ERR("CalcChildScroll V\n");
+ if (ci->initialStyle & WS_VSCROLL)
+ SetScrollInfo(hwnd, SB_VERT, &info, TRUE);
break;
}
}