[ROSAPPS] Add previously built templates back to build. Fix several warnings in dialo...
authorDaniel Reimer <reimer.daniel@freenet.de>
Sun, 26 Apr 2015 13:06:35 +0000 (13:06 +0000)
committerDaniel Reimer <reimer.daniel@freenet.de>
Sun, 26 Apr 2015 13:06:35 +0000 (13:06 +0000)
svn path=/trunk/; revision=67435

rosapps/CMakeLists.txt
rosapps/templates/CMakeLists.txt [new file with mode: 0644]
rosapps/templates/dialog/CMakeLists.txt [new file with mode: 0644]
rosapps/templates/dialog/dialog.rc
rosapps/templates/dialog/memdlg.c
rosapps/templates/mdi/CMakeLists.txt [new file with mode: 0644]
rosapps/templates/mdi/childwnd.c
rosapps/templates/mdi/framewnd.c
rosapps/templates/mdi/main.c
rosapps/templates/mdi/main.h
rosapps/templates/old_wordpad/CMakeLists.txt [new file with mode: 0644]

index 9010ab6..1837ca2 100644 (file)
@@ -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 (file)
index 0000000..8a9dae0
--- /dev/null
@@ -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 (file)
index 0000000..f209f00
--- /dev/null
@@ -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)
index 1b4eece..45a0cd4 100644 (file)
@@ -1,6 +1,6 @@
 //Microsoft Developer Studio generated resource script.
 //
-#include "resrc1.h"
+// #include "resrc1.h"
 
 #define APSTUDIO_READONLY_SYMBOLS
 /////////////////////////////////////////////////////////////////////////////
index 6bbb191..310d242 100644 (file)
@@ -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 (file)
index 0000000..9debc99
--- /dev/null
@@ -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)
index c2a1668..9adea23 100644 (file)
 
 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.x<pChildWnd->nSplitPos+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 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
-                       last_split = pChildWnd->nSplitPos;
+            if (pt.x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && pt.x<pChildWnd->nSplitPos+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 && x<pChildWnd->nSplitPos+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 && x<rt.right) {
-                               pChildWnd->nSplitPos = 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 && x<rt.right) {
+                pChildWnd->nSplitPos = 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);
 }
index ab70495..90aeee2 100644 (file)
@@ -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)
 {
index c7fbf3f..6cb88c2 100644 (file)
@@ -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),
index c2d6370..7c83a68 100644 (file)
@@ -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 (file)
index 0000000..4c3ec96
--- /dev/null
@@ -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)