From 6a5d0fedd891c4a5d7c6adf2e68cbe58b8aa545c Mon Sep 17 00:00:00 2001 From: Daniel Reimer Date: Sun, 26 Apr 2015 13:06:35 +0000 Subject: [PATCH] [ROSAPPS] Add previously built templates back to build. Fix several warnings in dialog and mdi template. This should be it for rosapps stuff svn path=/trunk/; revision=67435 --- rosapps/CMakeLists.txt | 1 + rosapps/templates/CMakeLists.txt | 3 + rosapps/templates/dialog/CMakeLists.txt | 14 ++ rosapps/templates/dialog/dialog.rc | 2 +- rosapps/templates/dialog/memdlg.c | 2 +- rosapps/templates/mdi/CMakeLists.txt | 11 + rosapps/templates/mdi/childwnd.c | 251 +++++++++---------- rosapps/templates/mdi/framewnd.c | 4 +- rosapps/templates/mdi/main.c | 35 ++- rosapps/templates/mdi/main.h | 2 +- rosapps/templates/old_wordpad/CMakeLists.txt | 13 + 11 files changed, 189 insertions(+), 149 deletions(-) create mode 100644 rosapps/templates/CMakeLists.txt create mode 100644 rosapps/templates/dialog/CMakeLists.txt create mode 100644 rosapps/templates/mdi/CMakeLists.txt create mode 100644 rosapps/templates/old_wordpad/CMakeLists.txt diff --git a/rosapps/CMakeLists.txt b/rosapps/CMakeLists.txt index 9010ab6b0a6..1837ca2b870 100644 --- a/rosapps/CMakeLists.txt +++ b/rosapps/CMakeLists.txt @@ -2,3 +2,4 @@ add_subdirectory(applications) add_subdirectory(demos) add_subdirectory(drivers) add_subdirectory(lib) +add_subdirectory(templates) diff --git a/rosapps/templates/CMakeLists.txt b/rosapps/templates/CMakeLists.txt new file mode 100644 index 00000000000..8a9dae073d5 --- /dev/null +++ b/rosapps/templates/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(dialog) +add_subdirectory(mdi) +add_subdirectory(old_wordpad) diff --git a/rosapps/templates/dialog/CMakeLists.txt b/rosapps/templates/dialog/CMakeLists.txt new file mode 100644 index 00000000000..f209f002886 --- /dev/null +++ b/rosapps/templates/dialog/CMakeLists.txt @@ -0,0 +1,14 @@ + +list(APPEND SOURCE + dialog.c + memdlg.c + page1.c + page2.c + page3.c + trace.c) + +add_executable(template_dialog ${SOURCE} dialog.rc) +set_module_type(template_dialog win32cui) +add_target_compile_flags(template_dialog "-Wno-unused-but-set-variable") +add_importlibs(template_dialog user32 gdi32 comctl32 msvcrt kernel32 ntdll) +add_cd_file(TARGET template_dialog DESTINATION reactos/system32 FOR all) diff --git a/rosapps/templates/dialog/dialog.rc b/rosapps/templates/dialog/dialog.rc index 1b4eece2a5b..45a0cd4800c 100644 --- a/rosapps/templates/dialog/dialog.rc +++ b/rosapps/templates/dialog/dialog.rc @@ -1,6 +1,6 @@ //Microsoft Developer Studio generated resource script. // -#include "resrc1.h" +// #include "resrc1.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// diff --git a/rosapps/templates/dialog/memdlg.c b/rosapps/templates/dialog/memdlg.c index 6bbb1912bb1..310d242b431 100644 --- a/rosapps/templates/dialog/memdlg.c +++ b/rosapps/templates/dialog/memdlg.c @@ -137,7 +137,7 @@ LRESULT CreateMemoryDialog(HINSTANCE hinst, HWND hwndOwner, LPSTR lpszMessage) *lpw++ = 0x0082; // static class for (lpwsz = (LPWSTR)lpw; - *lpwsz++ = (WCHAR)*lpszMessage++; + *lpwsz++ == (WCHAR)*lpszMessage++; ); lpw = (LPWORD)lpwsz; lpw = lpwAlign(lpw); // align creation data on DWORD boundary diff --git a/rosapps/templates/mdi/CMakeLists.txt b/rosapps/templates/mdi/CMakeLists.txt new file mode 100644 index 00000000000..9debc998841 --- /dev/null +++ b/rosapps/templates/mdi/CMakeLists.txt @@ -0,0 +1,11 @@ + +list(APPEND SOURCE + about.c + framewnd.c + childwnd.c + main.c) + +add_executable(template_mdi ${SOURCE} mdi.rc) +set_module_type(template_mdi win32cui) +add_importlibs(template_mdi advapi32 user32 gdi32 comctl32 msvcrt kernel32 ntdll) +add_cd_file(TARGET template_mdi DESTINATION reactos/system32 FOR all) diff --git a/rosapps/templates/mdi/childwnd.c b/rosapps/templates/mdi/childwnd.c index c2a166851c5..9adea23c6a0 100644 --- a/rosapps/templates/mdi/childwnd.c +++ b/rosapps/templates/mdi/childwnd.c @@ -44,14 +44,14 @@ static void draw_splitbar(HWND hWnd, int x) { - RECT rt; - HDC hdc = GetDC(hWnd); + RECT rt; + HDC hdc = GetDC(hWnd); - GetClientRect(hWnd, &rt); - rt.left = x - SPLIT_WIDTH/2; - rt.right = x + SPLIT_WIDTH/2+1; - InvertRect(hdc, &rt); - ReleaseDC(hWnd, hdc); + GetClientRect(hWnd, &rt); + rt.left = x - SPLIT_WIDTH/2; + rt.right = x + SPLIT_WIDTH/2+1; + InvertRect(hdc, &rt); + ReleaseDC(hWnd, hdc); } static void OnPaint(HWND hWnd, ChildWnd* pChildWnd) @@ -84,7 +84,7 @@ static void OnPaint(HWND hWnd, ChildWnd* pChildWnd) static void OnSize(ChildWnd* pChildWnd, WPARAM wParam, LPARAM lParam) { if (wParam != SIZE_MINIMIZED) { - //resize_tree(pChildWnd, LOWORD(lParam), HIWORD(lParam)); + //resize_tree(pChildWnd, LOWORD(lParam), HIWORD(lParam)); } } @@ -104,155 +104,154 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA); ASSERT(pChildWnd); - if (1) { - switch(message) { - case WM_CREATE: - return 0; - - case WM_MDIACTIVATE: // set an alternate menu here - if (lParam == (LPARAM)hWnd) { - } else { - } - DrawMenuBar(hFrameWnd); -// return 0; - break; + switch(message) { + case WM_CREATE: + return 0; - case WM_PAINT: - OnPaint(hWnd, pChildWnd); - return 0; + case WM_MDIACTIVATE: // set an alternate menu here + if (lParam == (LPARAM)hWnd) { + } else { + } + DrawMenuBar(hFrameWnd); + // return 0; + break; - case WM_NCDESTROY: - //SetWindowLong(hWnd, GWL_USERDATA, 0); - break; + case WM_PAINT: + OnPaint(hWnd, pChildWnd); + return 0; - case WM_SETCURSOR: - if (LOWORD(lParam) == HTCLIENT) { - POINT pt; - GetCursorPos(&pt); - ScreenToClient(hWnd, &pt); + case WM_NCDESTROY: + // SetWindowLong(hWnd, GWL_USERDATA, 0); + break; - if (pt.x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && pt.xnSplitPos+SPLIT_WIDTH/2+1) { - SetCursor(LoadCursor(0, IDC_SIZEWE)); - return TRUE; - } - } - //goto def; - break; + case WM_SETCURSOR: + if (LOWORD(lParam) == HTCLIENT) { + POINT pt; + GetCursorPos(&pt); + ScreenToClient(hWnd, &pt); - case WM_LBUTTONDOWN: { - RECT rt; - int x = LOWORD(lParam); - GetClientRect(hWnd, &rt); - if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && xnSplitPos+SPLIT_WIDTH/2+1) { - last_split = pChildWnd->nSplitPos; + if (pt.x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && pt.xnSplitPos+SPLIT_WIDTH/2+1) { + SetCursor(LoadCursor(0, IDC_SIZEWE)); + return TRUE; + } + } + //goto def; + break; + + case WM_LBUTTONDOWN: { + RECT rt; + int x = LOWORD(lParam); + GetClientRect(hWnd, &rt); + if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && xnSplitPos+SPLIT_WIDTH/2+1) { + last_split = pChildWnd->nSplitPos; #ifdef _NO_EXTENSIONS - draw_splitbar(hWnd, last_split); + draw_splitbar(hWnd, last_split); #endif - SetCapture(hWnd); - } - break;} + SetCapture(hWnd); + } + break;} - case WM_LBUTTONUP: - if (GetCapture() == hWnd) { + case WM_LBUTTONUP: + if (GetCapture() == hWnd) { #ifdef _NO_EXTENSIONS - RECT rt; - int x = LOWORD(lParam); - draw_splitbar(hWnd, last_split); - last_split = -1; - GetClientRect(hWnd, &rt); - pChildWnd->nSplitPos = x; - //resize_tree(pChildWnd, rt.right, rt.bottom); + RECT rt; + int x = LOWORD(lParam); + draw_splitbar(hWnd, last_split); + last_split = -1; + GetClientRect(hWnd, &rt); + pChildWnd->nSplitPos = x; + //resize_tree(pChildWnd, rt.right, rt.bottom); #endif - ReleaseCapture(); - } - break; + ReleaseCapture(); + } + break; #ifdef _NO_EXTENSIONS - case WM_CAPTURECHANGED: - if (GetCapture()==hWnd && last_split>=0) - draw_splitbar(hWnd, last_split); - break; + case WM_CAPTURECHANGED: + if (GetCapture()==hWnd && last_split>=0) + draw_splitbar(hWnd, last_split); + break; #endif - case WM_KEYDOWN: - if (wParam == VK_ESCAPE) - if (GetCapture() == hWnd) { - RECT rt; + case WM_KEYDOWN: + if (wParam == VK_ESCAPE) + if (GetCapture() == hWnd) { + RECT rt; #ifdef _NO_EXTENSIONS - draw_splitbar(hWnd, last_split); + draw_splitbar(hWnd, last_split); #else - pChildWnd->nSplitPos = last_split; + pChildWnd->nSplitPos = last_split; #endif - GetClientRect(hWnd, &rt); - //resize_tree(pChildWnd, rt.right, rt.bottom); - last_split = -1; - ReleaseCapture(); - SetCursor(LoadCursor(0, IDC_ARROW)); - } - break; + GetClientRect(hWnd, &rt); + //resize_tree(pChildWnd, rt.right, rt.bottom); + last_split = -1; + ReleaseCapture(); + SetCursor(LoadCursor(0, IDC_ARROW)); + } + break; - case WM_MOUSEMOVE: - if (GetCapture() == hWnd) { - RECT rt; - int x = LOWORD(lParam); + case WM_MOUSEMOVE: + if (GetCapture() == hWnd) { + RECT rt; + int x = LOWORD(lParam); #ifdef _NO_EXTENSIONS - HDC hdc = GetDC(hWnd); - GetClientRect(hWnd, &rt); - rt.left = last_split-SPLIT_WIDTH/2; - rt.right = last_split+SPLIT_WIDTH/2+1; - InvertRect(hdc, &rt); - last_split = x; - rt.left = x-SPLIT_WIDTH/2; - rt.right = x+SPLIT_WIDTH/2+1; - InvertRect(hdc, &rt); - ReleaseDC(hWnd, hdc); + HDC hdc = GetDC(hWnd); + GetClientRect(hWnd, &rt); + rt.left = last_split-SPLIT_WIDTH/2; + rt.right = last_split+SPLIT_WIDTH/2+1; + InvertRect(hdc, &rt); + last_split = x; + rt.left = x-SPLIT_WIDTH/2; + rt.right = x+SPLIT_WIDTH/2+1; + InvertRect(hdc, &rt); + ReleaseDC(hWnd, hdc); #else - GetClientRect(hWnd, &rt); - if (x>=0 && xnSplitPos = x; - resize_tree(pChildWnd, rt.right, rt.bottom); - rt.left = x-SPLIT_WIDTH/2; - rt.right = x+SPLIT_WIDTH/2+1; - InvalidateRect(hWnd, &rt, FALSE); - UpdateWindow(pChildWnd->left.hWnd); - UpdateWindow(hWnd); - UpdateWindow(pChildWnd->right.hWnd); - } + GetClientRect(hWnd, &rt); + if (x>=0 && xnSplitPos = x; + resize_tree(pChildWnd, rt.right, rt.bottom); + rt.left = x-SPLIT_WIDTH/2; + rt.right = x+SPLIT_WIDTH/2+1; + InvalidateRect(hWnd, &rt, FALSE); + UpdateWindow(pChildWnd->left.hWnd); + UpdateWindow(hWnd); + UpdateWindow(pChildWnd->right.hWnd); + } #endif - } - break; + } + break; #ifndef _NO_EXTENSIONS - case WM_GETMINMAXINFO: - DefMDIChildProc(hWnd, message, wParam, lParam); - {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; - lpmmi->ptMaxTrackSize.x <<= 1;//2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN - lpmmi->ptMaxTrackSize.y <<= 1;//2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN - break;} + case WM_GETMINMAXINFO: + DefMDIChildProc(hWnd, message, wParam, lParam); + {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; + lpmmi->ptMaxTrackSize.x <<= 1;//2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN + lpmmi->ptMaxTrackSize.y <<= 1;//2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN + break;} #endif - case WM_SETFOCUS: - SetCurrentDirectory(pChildWnd->szPath); - SetFocus(pChildWnd->nFocusPanel? pChildWnd->hRightWnd: pChildWnd->hLeftWnd); - break; + case WM_SETFOCUS: + SetCurrentDirectory(pChildWnd->szPath); + SetFocus(pChildWnd->nFocusPanel? pChildWnd->hRightWnd: pChildWnd->hLeftWnd); + break; /* - case WM_COMMAND: - pane = GetFocus()==pChildWnd->left.hWnd? &pChildWnd->left: &pChildWnd->right; - switch(LOWORD(wParam)) { - case ID_WINDOW_NEW_WINDOW: - return 0; - default: - return pane_command(pane, LOWORD(wParam)); - break; - } + case WM_COMMAND: + pane = GetFocus()==pChildWnd->left.hWnd? &pChildWnd->left: &pChildWnd->right; + switch(LOWORD(wParam)) { + case ID_WINDOW_NEW_WINDOW: + return 0; + default: + return pane_command(pane, LOWORD(wParam)); break; + } + break; */ - case WM_SIZE: + case WM_SIZE: if (wParam != SIZE_MINIMIZED) { OnSize(pChildWnd, wParam, lParam); } // fall through - default: def: + // default: def: return DefMDIChildProc(hWnd, message, wParam, lParam); - } + } return DefMDIChildProc(hWnd, message, wParam, lParam); } diff --git a/rosapps/templates/mdi/framewnd.c b/rosapps/templates/mdi/framewnd.c index ab70495f3f7..90aeee204d1 100644 --- a/rosapps/templates/mdi/framewnd.c +++ b/rosapps/templates/mdi/framewnd.c @@ -70,12 +70,12 @@ static void resize_frame_rect(HWND hWnd, PRECT prect) MoveWindow(hMDIClient, prect->left-1,prect->top-1,prect->right+2,prect->bottom+1, TRUE); } -static void resize_frame(HWND hWnd, int cx, int cy) +/* static void resize_frame(HWND hWnd, int cx, int cy) { RECT rect = {0, 0, cx, cy}; resize_frame_rect(hWnd, &rect); -} +}*/ void resize_frame_client(HWND hWnd) { diff --git a/rosapps/templates/mdi/main.c b/rosapps/templates/mdi/main.c index c7fbf3f981a..6cb88c281ab 100644 --- a/rosapps/templates/mdi/main.c +++ b/rosapps/templates/mdi/main.c @@ -92,28 +92,27 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) }; ATOM hChildWndClass = RegisterClass(&wcChild); // register child windows class #else - WNDCLASSEX wcChild = { - sizeof(WNDCLASSEX), - CS_HREDRAW | CS_VREDRAW/*style*/, - ChildWndProc, - 0/*cbClsExtra*/, - sizeof(HANDLE)/*cbWndExtra*/, - hInstance, - LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MDI_APP)), - LoadCursor(0, IDC_ARROW), - 0/*hbrBackground*/, - 0/*lpszMenuName*/, - szChildClass, - (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDC_MDI_APP), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED) - - }; - ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class + // WNDCLASSEX wcChild = { + // sizeof(WNDCLASSEX), + // CS_HREDRAW | CS_VREDRAW/*style*/, + // ChildWndProc, + // 0/*cbClsExtra*/, + // sizeof(HANDLE)/*cbWndExtra*/, + // hInstance, + // LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MDI_APP)), + // LoadCursor(0, IDC_ARROW), + // 0/*hbrBackground*/, + // 0/*lpszMenuName*/, + // szChildClass, + // (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDC_MDI_APP), IMAGE_ICON, + // GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED) + // }; + // ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class #endif HMENU hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDC_MDI_APP)); HMENU hMenuOptions = GetSubMenu(hMenu, ID_OPTIONS_MENU); - HMENU hChildMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDC_MDI_APP_CHILD)); + // HMENU hChildMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDC_MDI_APP_CHILD)); INITCOMMONCONTROLSEX icc = { sizeof(INITCOMMONCONTROLSEX), diff --git a/rosapps/templates/mdi/main.h b/rosapps/templates/mdi/main.h index c2d6370792a..7c83a684913 100644 --- a/rosapps/templates/mdi/main.h +++ b/rosapps/templates/mdi/main.h @@ -33,7 +33,7 @@ extern "C" { #include "resource.h" -#include "../../lib/ros2win/ros2win.h" +// #include "../../lib/ros2win/ros2win.h" //////////////////////////////////////////////////////////////////////////////// diff --git a/rosapps/templates/old_wordpad/CMakeLists.txt b/rosapps/templates/old_wordpad/CMakeLists.txt new file mode 100644 index 00000000000..4c3ec964578 --- /dev/null +++ b/rosapps/templates/old_wordpad/CMakeLists.txt @@ -0,0 +1,13 @@ + +list(APPEND SOURCE + dialogs.c + editwnd.c + mainwnd.c + misc.c + opensave.c + wordpad.c) + +add_executable(old_wordpad ${SOURCE} wordpad.rc) +set_module_type(old_wordpad win32gui UNICODE) +add_importlibs(old_wordpad user32 gdi32 comdlg32 advapi32 shell32 comctl32 msvcrt kernel32 ntdll) +add_cd_file(TARGET old_wordpad DESTINATION reactos/system32 FOR all) -- 2.17.1