Index: base/applications/rapps/listview.c =================================================================== --- base/applications/rapps/listview.c (revision 57785) +++ base/applications/rapps/listview.c (working copy) @@ -102,7 +102,7 @@ { hListView = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEWW, - L"", + NULL, WS_CHILD | WS_VISIBLE | LVS_SORTASCENDING | LVS_REPORT | LVS_SINGLESEL, 205, 28, 465, 250, hwnd, @@ -112,11 +112,12 @@ if (!hListView) { - /* TODO: Show error message */ + MessageBoxW(hwnd, L"Could not create a list view window!", + NULL, MB_ICONERROR); return FALSE; } - (VOID) ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT); + ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT); return TRUE; } Index: base/applications/rapps/misc.c =================================================================== --- base/applications/rapps/misc.c (revision 57785) +++ base/applications/rapps/misc.c (working copy) @@ -56,7 +56,9 @@ if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode)) { - /* TODO: Error message */ + MessageBoxW(hMainWnd, + L"Could not retrieve the currect display settings!", + NULL, MB_ICONERROR); return ILC_COLOR; } Index: base/applications/rapps/rapps.h =================================================================== --- base/applications/rapps/rapps.h (revision 57785) +++ base/applications/rapps/rapps.h (working copy) @@ -84,11 +84,12 @@ BOOL bDelInstaller; /* Window Pos */ BOOL Maximized; - INT Left; - INT Top; - INT Right; - INT Bottom; - + RECT rc; + INT vSplitterPos; + INT hSplitterPosInvert; + INT iNameColumnSize; + INT iVersionColumnSize; + INT iDescriptionColumnSize; } SETTINGS_INFO, *PSETTINGS_INFO; /* available.c */ @@ -167,6 +168,8 @@ BOOL CreateHSplitBar(HWND hwnd); int GetHSplitterPos(VOID); VOID SetHSplitterPos(int Pos); +int GetHSplitterPosInvert(VOID); +VOID SetHSplitterPosInvert(int Pos); /* statusbar.c */ extern HWND hStatusBar; Index: base/applications/rapps/richedit.c =================================================================== --- base/applications/rapps/richedit.c (revision 57785) +++ base/applications/rapps/richedit.c (working copy) @@ -28,7 +28,7 @@ min(Link->chrg.cpMin, Link->chrg.cpMax))*sizeof(WCHAR)); if (!pLink) { - /* TODO: Error message */ + MessageBoxW(hwnd, L"Out of memory!", NULL, MB_ICONERROR); return; } @@ -122,7 +122,8 @@ if (!hRichEdit) { - /* TODO: Show error message */ + MessageBoxW(hwnd, L"Could not create a rich edit control!", + NULL, MB_ICONERROR); return FALSE; } Index: base/applications/rapps/splitter.c =================================================================== --- base/applications/rapps/splitter.c (revision 57785) +++ base/applications/rapps/splitter.c (working copy) @@ -11,20 +11,34 @@ HWND hVSplitter = NULL; HWND hHSplitter = NULL; -static int HSplitterPos = 0; +static int HSplitterPosInvert = 90; int GetHSplitterPos(VOID) { - return HSplitterPos; + return GetClientWindowHeight(hMainWnd) - + (HSplitterPosInvert + GetWindowHeight(hStatusBar)); } VOID SetHSplitterPos(int Pos) { - HSplitterPos = Pos; + HSplitterPosInvert = GetClientWindowHeight(hMainWnd) - + (Pos + GetWindowHeight(hStatusBar)); } +int +GetHSplitterPosInvert(VOID) +{ + return HSplitterPosInvert; +} + +VOID +SetHSplitterPosInvert(int Pos) +{ + HSplitterPosInvert = Pos; +} + /* Callback for horizontal splitter bar */ LRESULT CALLBACK HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) @@ -32,9 +46,7 @@ switch (Msg) { case WM_CREATE: - { - SetHSplitterPos(GetWindowHeight(hListView)); - } + SetHSplitterPos(GetWindowHeight(hListView)); break; case WM_LBUTTONDOWN: @@ -127,9 +139,11 @@ WndClass.hCursor = LoadCursor(0, IDC_SIZENS); WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - if (RegisterClassExW(&WndClass) == (ATOM) 0) + if (!RegisterClassExW(&WndClass)) { - /* TODO: Show error message */ + MessageBoxW(hwnd, + L"Could not register the horizontal splitter window class!", + NULL, MB_ICONERROR); return FALSE; } @@ -146,7 +160,8 @@ if (hHSplitter == NULL) { - /* TODO: Show error message */ + MessageBoxW(hwnd, L"Could not create a horizontal splitter window!", + NULL, MB_ICONERROR); return FALSE; } @@ -262,9 +277,11 @@ WndClass.hCursor = LoadCursor(0, IDC_SIZEWE); WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - if (RegisterClassExW(&WndClass) == (ATOM) 0) + if (!RegisterClassExW(&WndClass)) { - /* TODO: Show error message */ + MessageBoxW(hwnd, + L"Could not register the vertical splitter window class!", + NULL, MB_ICONERROR); return FALSE; } @@ -281,7 +298,8 @@ if (!hVSplitter) { - /* TODO: Show error message */ + MessageBoxW(hwnd, L"Could not create a vertical splitter!", + NULL, MB_ICONERROR); return FALSE; } Index: base/applications/rapps/statusbar.c =================================================================== --- base/applications/rapps/statusbar.c (revision 57785) +++ base/applications/rapps/statusbar.c (working copy) @@ -22,10 +22,9 @@ (HMENU)IDC_STATUSBAR, hInst, NULL); - if (!hStatusBar) { - /* TODO: Show error message */ + MessageBoxW(hwnd, L"Could not create a status bar!", NULL, MB_ICONERROR); return FALSE; } Index: base/applications/rapps/toolbar.c =================================================================== --- base/applications/rapps/toolbar.c (revision 57785) +++ base/applications/rapps/toolbar.c (working copy) @@ -76,7 +76,7 @@ TOOLBAR_HEIGHT, 0))) { - /* TODO: Error message */ + MessageBoxW(hMainWnd, L"Could not load an image!", NULL, MB_ICONERROR); } ImageList_AddIcon(hImageList, hImage); @@ -96,7 +96,8 @@ 1); if (!hImageList) { - /* TODO: Error message */ + MessageBoxW(hMainWnd, L"Could not create an image list!", + NULL, MB_ICONERROR); return NULL; } @@ -158,10 +159,9 @@ 0, hInst, NULL); - if (!hToolBar) { - /* TODO: Show error message */ + MessageBoxW(hwnd, L"Could not create a tool bar!", NULL, MB_ICONERROR); return FALSE; } @@ -169,10 +169,9 @@ SendMessageW(hToolBar, TB_BUTTONSTRUCTSIZE, sizeof(Buttons[0]), 0); hImageList = InitImageList(); - if (!hImageList) { - /* TODO: Show error message */ + MessageBoxW(hwnd, L"Could not create an image list!", NULL, MB_ICONERROR); return FALSE; } Index: base/applications/rapps/treeview.c =================================================================== --- base/applications/rapps/treeview.c (revision 57785) +++ base/applications/rapps/treeview.c (working copy) @@ -34,7 +34,7 @@ { hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE, WC_TREEVIEWW, - L"", + NULL, WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_SHOWSELALWAYS, 0, 28, 200, 350, hwnd, @@ -42,9 +42,9 @@ hInst, NULL); - if (!hListView) + if (!hTreeView) { - /* TODO: Show error message */ + MessageBoxW(hwnd, L"Could not create a tree view!", NULL, MB_ICONERROR); return FALSE; } Index: base/applications/rapps/winmain.c =================================================================== --- base/applications/rapps/winmain.c (revision 57785) +++ base/applications/rapps/winmain.c (working copy) @@ -25,10 +25,12 @@ pSettingsInfo->bDelInstaller = FALSE; pSettingsInfo->Maximized = FALSE; - pSettingsInfo->Left = 0; - pSettingsInfo->Top = 0; - pSettingsInfo->Right = 680; - pSettingsInfo->Bottom = 450; + SetRect(&pSettingsInfo->rc, 0, 0, 680, 450); + pSettingsInfo->vSplitterPos = 200; + pSettingsInfo->hSplitterPosInvert = 90; + pSettingsInfo->iNameColumnSize = 200; + pSettingsInfo->iVersionColumnSize = 100; + pSettingsInfo->iDescriptionColumnSize = 220; } static BOOL @@ -63,11 +65,17 @@ wp.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(hwnd, &wp); - SettingsInfo.Left = wp.rcNormalPosition.left; - SettingsInfo.Top = wp.rcNormalPosition.top; - SettingsInfo.Right = wp.rcNormalPosition.right; - SettingsInfo.Bottom = wp.rcNormalPosition.bottom; + SettingsInfo.rc = wp.rcNormalPosition; SettingsInfo.Maximized = (IsZoomed(hwnd) || (wp.flags & WPF_RESTORETOMAXIMIZED)); + + /* Save splitter settings */ + SettingsInfo.vSplitterPos = GetWindowWidth(hTreeView); + SettingsInfo.hSplitterPosInvert = GetHSplitterPosInvert(); + + /* Save list view column width */ + SettingsInfo.iNameColumnSize = ListView_GetColumnWidth(hListView, 0); + SettingsInfo.iVersionColumnSize = ListView_GetColumnWidth(hListView, 1); + SettingsInfo.iDescriptionColumnSize = ListView_GetColumnWidth(hListView, 2); } if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"Software\\ReactOS\\rapps", 0, NULL, @@ -307,11 +315,11 @@ { if (SettingsInfo.bSaveWndPos) { - MoveWindow(hwnd, SettingsInfo.Left, SettingsInfo.Top, - SettingsInfo.Right - SettingsInfo.Left, - SettingsInfo.Bottom - SettingsInfo.Top, TRUE); + MoveWindow(hwnd, SettingsInfo.rc.left, SettingsInfo.rc.top, + SettingsInfo.rc.right - SettingsInfo.rc.left, + SettingsInfo.rc.bottom - SettingsInfo.rc.top, TRUE); - if (SettingsInfo.Maximized) ShowWindow(hwnd, SW_MAXIMIZE); + if (SettingsInfo.Maximized) PostMessage(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); } if (CreateStatusBar(hwnd) && @@ -331,6 +339,22 @@ LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, sizeof(szBuffer2) / sizeof(WCHAR)); swprintf(szBuffer1, szBuffer2, ListView_GetItemCount(hListView)); SetStatusBarText(szBuffer1); + + if (SettingsInfo.vSplitterPos > 0) + SetWindowPos(hTreeView, 0, 0, 0, SettingsInfo.vSplitterPos, GetWindowHeight(hTreeView), + SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + + if (SettingsInfo.hSplitterPosInvert > 0) + SetHSplitterPosInvert(SettingsInfo.hSplitterPosInvert); + + /* Update listview column width */ + if (SettingsInfo.iNameColumnSize > 0) + ListView_SetColumnWidth(hListView, 0, SettingsInfo.iNameColumnSize); + if (SettingsInfo.iVersionColumnSize > 0) + ListView_SetColumnWidth(hListView, 1, SettingsInfo.iVersionColumnSize); + if (SettingsInfo.iDescriptionColumnSize > 0) + ListView_SetColumnWidth(hListView, 2, SettingsInfo.iDescriptionColumnSize); + return TRUE; } @@ -436,10 +460,9 @@ VOID MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam) { + INT width = LOWORD(lParam), height = HIWORD(lParam); HDWP hdwp = BeginDeferWindowPos(5); INT SearchBarWidth = GetWindowWidth(hSearchBar); - INT RichPos = GetWindowHeight(hRichEdit); - INT NewPos = HIWORD(lParam) - (RichPos + SPLIT_WIDTH + GetWindowHeight(hStatusBar)); INT VSplitterPos; /* Size status bar */ @@ -449,13 +472,8 @@ SendMessage(hToolBar, TB_AUTOSIZE, 0, 0); /* Size SearchBar */ - MoveWindow(hSearchBar, LOWORD(lParam) - SearchBarWidth - 4, 5, SearchBarWidth, 22, TRUE); + MoveWindow(hSearchBar, width - SearchBarWidth - 4, 5, SearchBarWidth, 22, TRUE); - /* - * HIWORD(lParam) - Height of main window - * LOWORD(lParam) - Width of main window - */ - /* Size vertical splitter bar */ DeferWindowPos(hdwp, hVSplitter, @@ -463,7 +481,7 @@ (VSplitterPos = GetWindowWidth(hTreeView)), GetWindowHeight(hToolBar), SPLIT_WIDTH, - HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), + height - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), SWP_NOZORDER|SWP_NOACTIVATE); /* Size TreeView */ @@ -473,24 +491,16 @@ 0, GetWindowHeight(hToolBar), VSplitterPos, - HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), + height - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), SWP_NOZORDER|SWP_NOACTIVATE); - while (NewPos < SPLIT_WIDTH + GetWindowHeight(hToolBar)) - { - RichPos--; - NewPos = HIWORD(lParam) - (RichPos + - SPLIT_WIDTH + GetWindowHeight(hStatusBar)); - } - SetHSplitterPos(NewPos); - /* Size ListView */ DeferWindowPos(hdwp, hListView, 0, VSplitterPos + SPLIT_WIDTH, GetWindowHeight(hToolBar), - LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH), + width - (VSplitterPos + SPLIT_WIDTH), GetHSplitterPos() - GetWindowHeight(hToolBar), SWP_NOZORDER|SWP_NOACTIVATE); @@ -500,8 +510,8 @@ 0, VSplitterPos + SPLIT_WIDTH, GetHSplitterPos() + SPLIT_WIDTH, - LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH), - RichPos, + width - (VSplitterPos + SPLIT_WIDTH), + ((GetClientWindowHeight(hMainWnd) - GetWindowHeight(hStatusBar)) - (GetHSplitterPos() + SPLIT_WIDTH)), SWP_NOZORDER|SWP_NOACTIVATE); /* Size horizontal splitter bar */ @@ -510,7 +520,7 @@ 0, VSplitterPos + SPLIT_WIDTH, GetHSplitterPos(), - LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH), + width - (VSplitterPos + SPLIT_WIDTH), SPLIT_WIDTH, SWP_NOZORDER|SWP_NOACTIVATE); @@ -680,40 +690,20 @@ } break; - case WM_PAINT: - break; - case WM_SIZE: - { - if ((GetClientWindowHeight(hMainWnd) - GetWindowHeight(hStatusBar) - SPLIT_WIDTH) < GetHSplitterPos()) - { - INT NewSplitPos = GetClientWindowHeight(hwnd) - 100 - GetWindowHeight(hStatusBar) - SPLIT_WIDTH; - if (NewSplitPos > GetWindowHeight(hToolBar) + SPLIT_WIDTH) - SetHSplitterPos(NewSplitPos); - } - MainWndOnSize(hwnd, wParam, lParam); - } break; case WM_SIZING: { - int RichEditHeight = GetWindowHeight(hRichEdit); LPRECT pRect = (LPRECT)lParam; - while (RichEditHeight <= 100) - { - if (GetHSplitterPos() - 1 < GetWindowHeight(hToolBar) + GetWindowHeight(hListView) + SPLIT_WIDTH) - break; - SetHSplitterPos(GetHSplitterPos() - 1); - RichEditHeight++; - } - - if (pRect->right-pRect->left < 565) + if (pRect->right - pRect->left < 565) pRect->right = pRect->left + 565; - if (pRect->bottom-pRect->top < 300) + if (pRect->bottom - pRect->top < 300) pRect->bottom = pRect->top + 300; + return TRUE; } @@ -799,7 +789,7 @@ WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); WndClass.lpszMenuName = MAKEINTRESOURCEW(IDR_MAINMENU); - if (RegisterClassExW(&WndClass) == (ATOM)0) goto Exit; + if (!RegisterClassExW(&WndClass)) goto Exit; LoadStringW(hInst, IDS_APPTITLE, szWindowName, sizeof(szWindowName) / sizeof(WCHAR));