[ros-diffs] [gedmurphy] 30176: various rough additions towards a working dialog

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Mon Nov 5 15:39:25 CET 2007


Author: gedmurphy
Date: Mon Nov  5 17:39:24 2007
New Revision: 30176

URL: http://svn.reactos.org/svn/reactos?rev=30176&view=rev
Log:
various rough additions towards a working dialog

Modified:
    trunk/reactos/base/applications/mstsc/connectdialog.c
    trunk/reactos/base/applications/mstsc/lang/en-US.rc
    trunk/reactos/base/applications/mstsc/resource.h
    trunk/reactos/base/applications/mstsc/rsrc.rc
    trunk/reactos/base/applications/mstsc/win32.c

Modified: trunk/reactos/base/applications/mstsc/connectdialog.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/connectdialog.c?rev=30176&r1=30175&r2=30176&view=diff
==============================================================================
--- trunk/reactos/base/applications/mstsc/connectdialog.c (original)
+++ trunk/reactos/base/applications/mstsc/connectdialog.c Mon Nov  5 17:39:24 2007
@@ -1,4 +1,4 @@
-/* -*- c-basic-offset: 8 -*-
+/*
    rdesktop: A Remote Desktop Protocol client.
    Connection settings dialog
    Copyright (C) Ged Murphy 2007
@@ -20,10 +20,48 @@
 
 #include <windows.h>
 #include <commctrl.h>
+#include <stdio.h>
+#include <tchar.h>
 #include "resource.h"
 
+/* As slider control can't contain user data, we have to keep an
+ * array of RESOLUTION_INFO to have our own associated data.
+ */
+typedef struct _RESOLUTION_INFO
+{
+    DWORD dmPelsWidth;
+    DWORD dmPelsHeight;
+} RESOLUTION_INFO, *PRESOLUTION_INFO;
+
+typedef struct _SETTINGS_ENTRY
+{
+    struct _SETTINGS_ENTRY *Blink;
+    struct _SETTINGS_ENTRY *Flink;
+    DWORD dmBitsPerPel;
+    DWORD dmPelsWidth;
+    DWORD dmPelsHeight;
+} SETTINGS_ENTRY, *PSETTINGS_ENTRY;
+
+typedef struct _DISPLAY_DEVICE_ENTRY
+{
+    struct _DISPLAY_DEVICE_ENTRY *Flink;
+    LPTSTR DeviceDescription;
+    LPTSTR DeviceName;
+    LPTSTR DeviceKey;
+    LPTSTR DeviceID;
+    DWORD DeviceStateFlags;
+    PSETTINGS_ENTRY Settings; /* sorted by increasing dmPelsHeight, BPP */
+    DWORD SettingsCount;
+    PRESOLUTION_INFO Resolutions;
+    DWORD ResolutionsCount;
+    PSETTINGS_ENTRY CurrentSettings; /* Points into Settings list */
+    SETTINGS_ENTRY InitialSettings;
+} DISPLAY_DEVICE_ENTRY, *PDISPLAY_DEVICE_ENTRY;
+
 typedef struct _INFO
 {
+    PDISPLAY_DEVICE_ENTRY DisplayDeviceList;
+    PDISPLAY_DEVICE_ENTRY CurrentDisplayDevice;
     HWND hSelf;
     HWND hTab;
     HWND hGeneralPage;
@@ -65,7 +103,7 @@
     SetWindowPos(pInfo->hGeneralPage,
                  NULL, 
                  15, 
-                 122, 
+                 110, 
                  0, 
                  0, 
                  SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
@@ -138,13 +176,326 @@
 }
 
 
+static PSETTINGS_ENTRY
+GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTINGS_ENTRY* CurrentSettings)
+{
+    DEVMODE devmode;
+    DWORD NbSettings = 0;
+    DWORD iMode = 0;
+    DWORD dwFlags = 0;
+    PSETTINGS_ENTRY Settings = NULL;
+    HDC hDC;
+    PSETTINGS_ENTRY Current;
+    DWORD bpp, xres, yres, checkbpp;
+    DWORD curDispFreq;
+
+
+    /* Get current settings */
+    *CurrentSettings = NULL;
+    hDC = CreateIC(NULL, DeviceName, NULL, NULL);
+    bpp = GetDeviceCaps(hDC, PLANES);
+    bpp *= GetDeviceCaps(hDC, BITSPIXEL);
+    xres = GetDeviceCaps(hDC, HORZRES);
+    yres = GetDeviceCaps(hDC, VERTRES);
+    DeleteDC(hDC);
+
+    /* List all settings */
+    devmode.dmSize = (WORD)sizeof(DEVMODE);
+    devmode.dmDriverExtra = 0;
+
+    if (!EnumDisplaySettingsEx(DeviceName, ENUM_CURRENT_SETTINGS, &devmode, dwFlags))
+        return NULL;
+
+    curDispFreq = devmode.dmDisplayFrequency;
+
+    while (EnumDisplaySettingsEx(DeviceName, iMode, &devmode, dwFlags))
+    {
+        if ((devmode.dmBitsPerPel==8 ||
+             devmode.dmBitsPerPel==16 ||
+             devmode.dmBitsPerPel==24 ||
+             devmode.dmBitsPerPel==32) &&
+             devmode.dmDisplayFrequency==curDispFreq)
+        {
+            checkbpp=1;
+        }
+        else
+            checkbpp=0;
+
+        if (devmode.dmPelsWidth < 640 ||
+            devmode.dmPelsHeight < 480 || checkbpp == 0)
+        {
+            iMode++;
+            continue;
+        }
+
+        Current = HeapAlloc(GetProcessHeap(), 0, sizeof(SETTINGS_ENTRY));
+        if (Current != NULL)
+        {
+            /* Sort resolutions by increasing height, and BPP */
+            PSETTINGS_ENTRY Previous = NULL;
+            PSETTINGS_ENTRY Next = Settings;
+            Current->dmPelsWidth = devmode.dmPelsWidth;
+            Current->dmPelsHeight = devmode.dmPelsHeight;
+            Current->dmBitsPerPel = devmode.dmBitsPerPel;
+            while (Next != NULL && (
+                   Next->dmPelsWidth < Current->dmPelsWidth ||
+                   (Next->dmPelsWidth == Current->dmPelsWidth && Next->dmPelsHeight < Current->dmPelsHeight) ||
+                   (Next->dmPelsHeight == Current->dmPelsHeight &&
+                    Next->dmPelsWidth == Current->dmPelsWidth &&
+                    Next->dmBitsPerPel < Current->dmBitsPerPel )))
+            {
+                Previous = Next;
+                Next = Next->Flink;
+            }
+            Current->Blink = Previous;
+            Current->Flink = Next;
+            if (Previous == NULL)
+                Settings = Current;
+            else
+                Previous->Flink = Current;
+            if (Next != NULL)
+                Next->Blink = Current;
+            if (devmode.dmPelsWidth == xres && devmode.dmPelsHeight == yres && devmode.dmBitsPerPel == bpp)
+            {
+                *CurrentSettings = Current;
+            }
+            NbSettings++;
+        }
+        iMode++;
+    }
+
+    *pSettingsCount = NbSettings;
+    return Settings;
+}
+
+
+AddDisplayDevice(PINFO pInfo, PDISPLAY_DEVICE DisplayDevice)
+{
+    PDISPLAY_DEVICE_ENTRY newEntry = NULL;
+    LPTSTR description = NULL;
+    LPTSTR name = NULL;
+    LPTSTR key = NULL;
+    LPTSTR devid = NULL;
+    DWORD descriptionSize, nameSize, keySize, devidSize;
+    PSETTINGS_ENTRY Current;
+    DWORD ResolutionsCount = 1;
+    DWORD i;
+
+    newEntry = HeapAlloc(GetProcessHeap(),
+                         0,
+                         sizeof(DISPLAY_DEVICE_ENTRY));
+    if (!newEntry) goto ByeBye;
+    ZeroMemory(newEntry, sizeof(DISPLAY_DEVICE_ENTRY));
+
+    newEntry->Settings = GetPossibleSettings(DisplayDevice->DeviceName,
+                                             &newEntry->SettingsCount,
+                                             &newEntry->CurrentSettings);
+    if (!newEntry->Settings) goto ByeBye;
+
+    newEntry->InitialSettings.dmPelsWidth = newEntry->CurrentSettings->dmPelsWidth;
+    newEntry->InitialSettings.dmPelsHeight = newEntry->CurrentSettings->dmPelsHeight;
+    newEntry->InitialSettings.dmBitsPerPel = newEntry->CurrentSettings->dmBitsPerPel;
+
+    /* Count different resolutions */
+    for (Current = newEntry->Settings; Current != NULL; Current = Current->Flink)
+    {
+        if (Current->Flink != NULL &&
+            ((Current->dmPelsWidth != Current->Flink->dmPelsWidth) &&
+            (Current->dmPelsHeight != Current->Flink->dmPelsHeight)))
+        {
+            ResolutionsCount++;
+        }
+    }
+
+    newEntry->Resolutions = HeapAlloc(GetProcessHeap(),
+                                      0,
+                                      ResolutionsCount * sizeof(RESOLUTION_INFO));
+    if (!newEntry->Resolutions) goto ByeBye;
+
+    newEntry->ResolutionsCount = ResolutionsCount;
+
+    /* Fill resolutions infos */
+    for (Current = newEntry->Settings, i = 0; Current != NULL; Current = Current->Flink)
+    {
+        if (Current->Flink == NULL ||
+            (Current->Flink != NULL &&
+            ((Current->dmPelsWidth != Current->Flink->dmPelsWidth) &&
+            (Current->dmPelsHeight != Current->Flink->dmPelsHeight))))
+        {
+            newEntry->Resolutions[i].dmPelsWidth = Current->dmPelsWidth;
+            newEntry->Resolutions[i].dmPelsHeight = Current->dmPelsHeight;
+            i++;
+        }
+    }
+    descriptionSize = (_tcslen(DisplayDevice->DeviceString) + 1) * sizeof(TCHAR);
+    description = HeapAlloc(GetProcessHeap(), 0, descriptionSize);
+    if (!description) goto ByeBye;
+
+    nameSize = (_tcslen(DisplayDevice->DeviceName) + 1) * sizeof(TCHAR);
+    name = HeapAlloc(GetProcessHeap(), 0, nameSize);
+    if (!name) goto ByeBye;
+
+    keySize = (_tcslen(DisplayDevice->DeviceKey) + 1) * sizeof(TCHAR);
+    key = HeapAlloc(GetProcessHeap(), 0, keySize);
+    if (!key) goto ByeBye;
+
+    devidSize = (_tcslen(DisplayDevice->DeviceID) + 1) * sizeof(TCHAR);
+    devid = HeapAlloc(GetProcessHeap(), 0, devidSize);
+    if (!devid) goto ByeBye;
+
+    memcpy(description, DisplayDevice->DeviceString, descriptionSize);
+    memcpy(name, DisplayDevice->DeviceName, nameSize);
+    memcpy(key, DisplayDevice->DeviceKey, keySize);
+    memcpy(devid, DisplayDevice->DeviceID, devidSize);
+    newEntry->DeviceDescription = description;
+    newEntry->DeviceName = name;
+    newEntry->DeviceKey = key;
+    newEntry->DeviceID = devid;
+    newEntry->DeviceStateFlags = DisplayDevice->StateFlags;
+    newEntry->Flink = pInfo->DisplayDeviceList;
+    pInfo->DisplayDeviceList = newEntry;
+    return TRUE;
+
+ByeBye:
+    if (newEntry != NULL)
+    {
+        if (newEntry->Settings != NULL)
+        {
+            Current = newEntry->Settings;
+            while (Current != NULL)
+            {
+                PSETTINGS_ENTRY Next = Current->Flink;
+                HeapFree(GetProcessHeap(), 0, Current);
+                Current = Next;
+            }
+        }
+        if (newEntry->Resolutions != NULL)
+            HeapFree(GetProcessHeap(), 0, newEntry->Resolutions);
+        HeapFree(GetProcessHeap(), 0, newEntry);
+    }
+    if (description != NULL)
+        HeapFree(GetProcessHeap(), 0, description);
+    if (name != NULL)
+        HeapFree(GetProcessHeap(), 0, name);
+    if (key != NULL)
+        HeapFree(GetProcessHeap(), 0, key);
+    if (devid != NULL)
+        HeapFree(GetProcessHeap(), 0, devid);
+    return FALSE;
+}
+
+static VOID
+UpdateDisplay(IN HWND hwndDlg, PINFO pGlobalData, IN BOOL bUpdateThumb)
+{
+    TCHAR Buffer[64];
+    TCHAR Pixel[64];
+    DWORD index;
+
+    LoadString(hInst, IDS_PIXEL, Pixel, sizeof(Pixel) / sizeof(TCHAR));
+    _stprintf(Buffer, Pixel, pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth, pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight, Pixel);
+    //SendDlgItemMessage(pGlobalData->hDisplayPage, IDC_SETTINGS_RESOLUTION_TEXT, WM_SETTEXT, 0, (LPARAM)Buffer);
+    SetDlgItemText(pGlobalData->hDisplayPage, pGlobalData->hDisplayPage, Buffer);
+
+    if (LoadString(hInst, (2900 + pGlobalData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel), Buffer, sizeof(Buffer) / sizeof(TCHAR)))
+        SendDlgItemMessage(hwndDlg, IDC_GEOSLIDER, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)Buffer);
+}
+
+
+static VOID
+FillResolutionsAndColors(PINFO pInfo)
+{
+    PSETTINGS_ENTRY Current;
+    DWORD index, i, num;
+    DWORD MaxBpp = 0;
+    UINT HighBpp;
+
+    pInfo->CurrentDisplayDevice = pInfo->DisplayDeviceList; /* Update global variable */
+
+    /* find max bpp */
+    SendDlgItemMessage(pInfo->hDisplayPage,
+                       IDC_BPPCOMBO,
+                       CB_RESETCONTENT,
+                       0,
+                       0);
+    for (Current = pInfo->DisplayDeviceList->Settings; Current != NULL; Current = Current->Flink)
+    {
+        if (Current->dmBitsPerPel > MaxBpp)
+            MaxBpp = Current->dmBitsPerPel;
+    }
+    switch (MaxBpp)
+    {
+        case 32:
+        case 24: HighBpp = IDS_HIGHCOLOR24; break;
+        case 16: HighBpp = IDS_HIGHCOLOR16; break;
+        case 8:  HighBpp = IDS_256COLORS;   break;
+    }
+
+    /* Fill color depths combo box */
+    SendDlgItemMessage(pInfo->hDisplayPage,
+                      IDC_BPPCOMBO,
+                      CB_RESETCONTENT,
+                      0,
+                      0);
+    num = HighBpp - IDS_256COLORS;
+
+    for (i = 0, Current = pInfo->DisplayDeviceList->Settings;
+         i <= num && Current != NULL;
+         i++, Current = Current->Flink)
+    {
+        TCHAR Buffer[64];
+        if (LoadString(hInst,
+                       (IDS_256COLORS + i),
+                       Buffer,
+                       sizeof(Buffer) / sizeof(TCHAR)))
+        {
+            index = (DWORD)SendDlgItemMessage(pInfo->hDisplayPage,
+                                              IDC_BPPCOMBO,
+                                              CB_FINDSTRINGEXACT,
+                                              -1,
+                                              (LPARAM)Buffer);
+            if (index == (DWORD)CB_ERR)
+            {
+                index = (DWORD)SendDlgItemMessage(pInfo->hDisplayPage,
+                                                  IDC_BPPCOMBO,
+                                                  CB_ADDSTRING,
+                                                  0,
+                                                  (LPARAM)Buffer);
+                SendDlgItemMessage(pInfo->hDisplayPage,
+                                   IDC_BPPCOMBO,
+                                   CB_SETITEMDATA,
+                                   index,
+                                   Current->dmBitsPerPel);
+            }
+        }
+    }
+
+    /* Fill resolutions slider */
+    SendDlgItemMessage(pInfo->hDisplayPage,
+                       IDC_GEOSLIDER,
+                       TBM_CLEARTICS,
+                       TRUE,
+                       0);
+    SendDlgItemMessage(pInfo->hDisplayPage,
+                       IDC_GEOSLIDER,
+                       TBM_SETRANGE,
+                       TRUE,
+                       MAKELONG(0, pInfo->DisplayDeviceList->ResolutionsCount)); //extra 1 for full screen
+
+    UpdateDisplay(pInfo->hDisplayPage, pInfo, TRUE);
+}
+
+
 static VOID
 DisplayOnInit(PINFO pInfo)
 {
+    DISPLAY_DEVICE displayDevice;
+    DWORD iDevNum = 0;
+    BOOL GotDev = FALSE;
+
     SetWindowPos(pInfo->hDisplayPage,
                  NULL,
                  15,
-                 122,
+                 110,
                  0,
                  0,
                  SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
@@ -191,6 +542,21 @@
                       sizeof(BITMAP),
                       &pInfo->bitmap);
         }
+
+        /* Get video cards list */
+        displayDevice.cb = (DWORD)sizeof(DISPLAY_DEVICE);
+        while (EnumDisplayDevices(NULL, iDevNum, &displayDevice, 0x1))
+        {
+            if ((displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) != 0)
+            {
+                if (AddDisplayDevice(pInfo, &displayDevice))
+                    GotDev = TRUE;
+            }
+            iDevNum++;
+        }
+
+        if (GotDev)
+            FillResolutionsAndColors(pInfo);
 }
 
 
@@ -238,19 +604,45 @@
             break;
         }
 
-            case WM_CLOSE:
-            {
-                if (pInfo->hRemote)
-                    DestroyIcon(pInfo->hRemote);
-
-                if (pInfo->hColor)
-                    DestroyIcon(pInfo->hColor);
-
-                if (pInfo->hSpectrum)
-                    DeleteObject(pInfo->hSpectrum);
-
-                break;
-            }
+        case WM_HSCROLL:
+        {
+            switch (LOWORD(wParam))
+            {
+                case TB_LINEUP:
+                case TB_LINEDOWN:
+                case TB_PAGEUP:
+                case TB_PAGEDOWN:
+                case TB_TOP:
+                case TB_BOTTOM:
+                case TB_ENDTRACK:
+                {
+                    DWORD newPosition = (DWORD)SendDlgItemMessage(hDlg, IDC_GEOSLIDER, TBM_GETPOS, 0, 0);
+                    //OnResolutionChanged(hwndDlg, pGlobalData, newPosition, TRUE);
+                    UpdateDisplay(hDlg, pInfo, TRUE);
+                    break;
+                }
+
+                case TB_THUMBTRACK:
+                    //OnResolutionChanged(hDlg, pInfo, HIWORD(wParam), FALSE);
+                    UpdateDisplay(hDlg, pInfo, TRUE);
+                    break;
+            }
+            break;
+        }
+
+        case WM_CLOSE:
+        {
+            if (pInfo->hRemote)
+                DestroyIcon(pInfo->hRemote);
+
+            if (pInfo->hColor)
+                DestroyIcon(pInfo->hColor);
+
+            if (pInfo->hSpectrum)
+                DeleteObject(pInfo->hSpectrum);
+
+            break;
+        }
 
         break;
     }

Modified: trunk/reactos/base/applications/mstsc/lang/en-US.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/lang/en-US.rc?rev=30176&r1=30175&r2=30176&view=diff
==============================================================================
--- trunk/reactos/base/applications/mstsc/lang/en-US.rc (original)
+++ trunk/reactos/base/applications/mstsc/lang/en-US.rc Mon Nov  5 17:39:24 2007
@@ -27,22 +27,23 @@
     ICON            "", IDC_REMICON, 15,19,20,20
     ICON            "", IDC_COLORSICON, 15,98,20,20
     LTEXT           "Set the screen size of your remote desktop. Drag the slider to the far right to go fullscreen",IDC_STATIC,53,22,175,21
-    CONTROL         "",IDC_GEOSLIDER,"msctls_trackbar32",WS_TABSTOP,56,49,124,15
-    COMBOBOX        IDC_BPPCOMBO,56,102,128,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
-    CONTROL         "",IDC_COLORIMAGE,"Static",SS_OWNERDRAW  | SS_SUNKEN, 56,121,127,13
+    CONTROL         "", IDC_GEOSLIDER, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 56, 42, 124, 17
+    COMBOBOX        IDC_BPPCOMBO,56,102,128,80, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "",IDC_COLORIMAGE,"Static",SS_OWNERDRAW | SS_SUNKEN, 56,121,127,10
     LTEXT           "Note: Settings on the remote computer might override this setting.",IDC_STATIC,56,143,165,18
-    LTEXT           "Less",IDC_STATIC,35,52,15,8
-    LTEXT           "More",IDC_STATIC,189,51,17,8
+    LTEXT           "Less",IDC_STATIC,35,42,15,8
+    LTEXT           "More",IDC_STATIC,189,42,17,8
+    LTEXT           "", IDC_SETTINGS_RESOLUTION_TEXT, 56, 62, 124, 10, SS_CENTER
 END
 
-IDD_CONNECTDIALOG DIALOGEX 0, 0, 260, 277
+IDD_CONNECTDIALOG DIALOGEX 0, 0, 260, 267
 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Remote Desktop Connection"
 FONT 8, "MS Shell Dlg", 400, 0, 0x1
 BEGIN
-    DEFPUSHBUTTON   "Connect",IDOK,147,256,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,203,256,50,14
-    CONTROL         "",IDC_TAB,"SysTabControl32",0x0,7,54,246,198
+    DEFPUSHBUTTON   "Connect",IDOK,147,249,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,203,249,50,14
+    CONTROL         "",IDC_TAB,"SysTabControl32",0x0,7,54,246,190
 END
 
 
@@ -50,4 +51,10 @@
 BEGIN
     IDS_TAB_GENERAL         "General"
     IDS_TAB_DISPLAY         "Display"
+    IDS_256COLORS           "256 Colors"
+    IDS_HIGHCOLOR15         "High Color (15 bit)"
+    IDS_HIGHCOLOR16         "High Color (16 bit)"
+    IDS_HIGHCOLOR24         "True Color (24 bit)"
+    IDS_PIXEL               "%lux%lu Pixels"
+    IDS_FULLSCREEN          "Full Screen"
 END

Modified: trunk/reactos/base/applications/mstsc/resource.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/resource.h?rev=30176&r1=30175&r2=30176&view=diff
==============================================================================
--- trunk/reactos/base/applications/mstsc/resource.h (original)
+++ trunk/reactos/base/applications/mstsc/resource.h Mon Nov  5 17:39:24 2007
@@ -1,6 +1,7 @@
+#define IDC_STATIC                      -1
+
 #define IDD_CONNECTDIALOG               101
 #define IDD_GENERAL                     105
-#define IDS_TAB_DISPLAY                 106
 #define IDD_DISPLAY                     107
 #define IDC_TAB                         1003
 #define IDC_SERVERCOMBO                 1007
@@ -9,6 +10,7 @@
 #define IDC_OPEN                        1010
 #define IDC_GEOSLIDER                   1012
 #define IDC_BPPCOMBO                    1013
+#define IDC_SETTINGS_RESOLUTION_TEXT    1014
 
 #define IDC_LOGONICON                   1016
 #define IDC_CONNICON                    1017
@@ -19,10 +21,19 @@
 #define IDB_SPECT                       1017
 
 #define IDC_COLORIMAGE                  1018
-#define IDS_TAB_GENERAL                 1104
-#define IDC_STATIC                      -1
 
 #define IDI_LOGON                       2000
 #define IDI_CONN                        2001
 #define IDI_REMOTE                      2002
 #define IDI_COLORS                      2003
+#define IDI_MSTSC                       2004
+
+#define IDS_TAB_DISPLAY                 3000
+#define IDS_TAB_GENERAL                 3001
+#define IDS_PIXEL                       3006
+#define IDS_FULLSCREEN                  3007
+
+#define IDS_256COLORS                   4000
+#define IDS_HIGHCOLOR15                 4001
+#define IDS_HIGHCOLOR16                 4002
+#define IDS_HIGHCOLOR24                 4003

Modified: trunk/reactos/base/applications/mstsc/rsrc.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/rsrc.rc?rev=30176&r1=30175&r2=30176&view=diff
==============================================================================
--- trunk/reactos/base/applications/mstsc/rsrc.rc (original)
+++ trunk/reactos/base/applications/mstsc/rsrc.rc Mon Nov  5 17:39:24 2007
@@ -3,8 +3,9 @@
 
 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 
-//1 24 DISCARDABLE "manifest.xml"
+1 24 DISCARDABLE "manifest.xml"
 
+IDI_MSTSC   ICON   "res/mstsc.ico"
 IDI_LOGON   ICON   "res/logon.ico"
 IDI_CONN    ICON   "res/connection.ico"
 IDI_REMOTE  ICON   "res/remote.ico"

Modified: trunk/reactos/base/applications/mstsc/win32.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/win32.c?rev=30176&r1=30175&r2=30176&view=diff
==============================================================================
--- trunk/reactos/base/applications/mstsc/win32.c (original)
+++ trunk/reactos/base/applications/mstsc/win32.c Mon Nov  5 17:39:24 2007
@@ -18,18 +18,12 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#ifdef _WIN32_WCE
-#define MYWINCE
-#endif
-
 #include <winsock2.h> /* winsock2.h first */
 #include <windows.h>
-#ifdef MYWINCE
-#include <aygshell.h> /* aygshell.lib */
-#endif /* MYWINCE */
 #include <winuser.h>
 #include <stdio.h>
 #include "uimain.h"
+#include "resource.h"
 
 extern char g_username[];
 extern char g_hostname[];
@@ -69,9 +63,6 @@
 static int g_clip_bottom = 600;
 static RECT g_wnd_clip; /* this client area of whats actually visable */
                         /* set from WM_SIZE */
-#ifdef MYWINCE
-static int g_sip_up = 0;
-#endif
 
 /*****************************************************************************/
 static void
@@ -665,79 +656,6 @@
   return 0;
 }
 
-#ifdef MYWINCE
-/*****************************************************************************/
-static LRESULT
-handle_WM_SETTINGCHANGE(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
-  SIPINFO si;
-  SHMENUBARINFO mb;
-  int x;
-  int y;
-  int w;
-  int h;
-  int style;
-
-  ZeroMemory(&si, sizeof(SIPINFO));
-  si.cbSize = sizeof(SIPINFO);
-  SHSipInfo(SPI_GETSIPINFO, lParam, &si, 0);
-  x = si.rcVisibleDesktop.left;
-  y = si.rcVisibleDesktop.top;
-  w = si.rcVisibleDesktop.right - x;
-  h = si.rcVisibleDesktop.bottom - y;
-  /* get rid of menu */
-  DestroyWindow(SHFindMenuBar(g_Wnd));
-  if (si.fdwFlags & SIPF_ON)
-  {
-    g_sip_up = 1; /* used for WM_SETFOCUS */
-    ZeroMemory(&mb, sizeof(SHMENUBARINFO));
-    mb.cbSize = sizeof(SHMENUBARINFO);
-    mb.hwndParent = g_Wnd;
-    mb.dwFlags = SHCMBF_EMPTYBAR;
-    SHCreateMenuBar(&mb);
-    MoveWindow(g_Wnd, x, y, w, h, FALSE);
-    SHFullScreen(g_Wnd, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON |
-                 SHFS_SHOWSTARTICON);
-  }
-  else
-  {
-    g_sip_up = 0;
-    if (g_fullscreen)
-    {
-      MoveWindow(g_Wnd, 0, 0, g_screen_width, g_screen_height, FALSE);
-    }
-    else
-    {
-      MoveWindow(g_Wnd, x, y, w, h, FALSE);
-    }
-    if ((g_fullscreen && g_width <= g_screen_width &&
-         g_height <= g_screen_height) ||
-        (!g_fullscreen && g_width <= w && g_height <= h))
-    {
-      style = GetWindowLong(g_Wnd, GWL_STYLE);
-      if (style & WS_HSCROLL)
-      {
-        style &= ~WS_HSCROLL;
-        style &= ~WS_VSCROLL;
-        SetWindowLong(g_Wnd, GWL_STYLE, style);
-        g_xscroll = 0;
-        g_yscroll = 0;
-      }
-    }
-    if (g_fullscreen)
-    {
-      SHFullScreen(g_Wnd, SHFS_HIDETASKBAR | SHFS_SHOWSIPBUTTON |
-                   SHFS_SHOWSTARTICON);
-    }
-    else
-    {
-      SHFullScreen(g_Wnd, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON |
-                   SHFS_SHOWSTARTICON);
-    }
-  }
-  return 0;
-}
-#endif /* MYWINCE */
 
 /*****************************************************************************/
 LRESULT CALLBACK
@@ -793,18 +711,8 @@
       return handle_WM_HSCROLL(hWnd, message, wParam, lParam);
     case WM_VSCROLL:
       return handle_WM_VSCROLL(hWnd, message, wParam, lParam);
-#ifdef MYWINCE
-    case WM_SETTINGCHANGE:
-      return handle_WM_SETTINGCHANGE(hWnd, message, wParam, lParam);
-#endif /* MYWINCE */
     case WM_SETFOCUS:
       mi_check_modifier();
-#ifdef MYWINCE
-      if (g_sip_up)
-      {
-        SHSipPreference(hWnd, SIP_UP);
-      }
-#endif
       return DefWindowProc(hWnd, message, wParam, lParam);
     default:
       return DefWindowProc(hWnd, message, wParam, lParam);
@@ -854,6 +762,8 @@
   str_to_uni(classname, "rdesktop");
   wc.lpszClassName = classname;
   str_to_uni(caption, "ReactOS Remote Desktop");
+  wc.hIcon = LoadIcon(g_Instance,
+                      MAKEINTRESOURCE(IDI_MSTSC));
   /* Register the window class. */
   if (!RegisterClass(&wc))
   {
@@ -863,21 +773,7 @@
   rc.right = rc.left + UI_MIN(g_width, g_screen_width);
   rc.top = 0;
   rc.bottom = rc.top + UI_MIN(g_height, g_screen_height);
-#ifdef MYWINCE
-  SHInitExtraControls();
-  x = CW_USEDEFAULT;
-  y = CW_USEDEFAULT;
-  w = CW_USEDEFAULT;
-  h = CW_USEDEFAULT;
-  style = WS_VISIBLE;
-  if (g_fullscreen)
-  {
-    x = 0;
-    y = 0;
-    w = g_screen_width;
-    h = g_screen_height;
-  }
-#else /* MYWINCE */
+
   if (g_fullscreen)
   {
     style = WS_POPUP;
@@ -896,7 +792,7 @@
   y = CW_USEDEFAULT;
   w = rc.right - rc.left;
   h = rc.bottom - rc.top;
-#endif /* MYWINCE */
+
   g_Wnd = CreateWindow(wc.lpszClassName, caption,
                        style, x, y, w, h,
                        (HWND) NULL, (HMENU) NULL, g_Instance,
@@ -915,26 +811,9 @@
   }
   UpdateWindow(g_Wnd);
 
-#ifdef MYWINCE
-  if (g_fullscreen)
-  {
-    SHFullScreen(g_Wnd, SHFS_HIDETASKBAR | SHFS_SHOWSIPBUTTON |
-                 SHFS_SHOWSTARTICON);
-  }
-  else
-  {
-    SHFullScreen(g_Wnd, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON |
-                 SHFS_SHOWSTARTICON);
-  }
-#endif /* MYWINCE */
-
-  /* WinCE doesn't have WSAAsyncSelect */
-#ifdef MYWINCE
-  SetTimer(g_Wnd, 1, 1000 / 60, 0); /* 60 per second */
-#else /* MYWINCE */
   WSAAsyncSelect(g_tcp_sck, g_Wnd, WM_APP + 1, FD_READ);
   SetTimer(g_Wnd, 1, 333, 0);
-#endif /* MYWINCE */
+
   return 1;
 }
 
@@ -1151,7 +1030,7 @@
     {
       state = 0;
       g_server_depth = atol(param1);
-      if (g_server_depth != 8 && g_server_depth != 15 && g_server_depth != 16)
+      if (g_server_depth != 8 && g_server_depth != 15 && g_server_depth != 16 && g_server_depth != 24)
       {
         mi_error("invalid server bpp\r\n");
       }
@@ -1207,31 +1086,19 @@
   }
   else if (g_workarea)
   {
-#ifdef MYWINCE
-    g_xoff = 0;
-    g_yoff = 0;
-    g_width = g_screen_width;
-    g_height = g_screen_height - 26; /* start menu size is 26 */
-#else /* MYWINCE */
     g_xoff = GetSystemMetrics(SM_CXEDGE) * 2;
     g_yoff = GetSystemMetrics(SM_CYCAPTION) +
              GetSystemMetrics(SM_CYEDGE) * 2;
     g_width = g_screen_width;
     g_height = g_screen_height;
     g_height = (g_height - g_yoff) - g_xoff - 20; /* todo */
-#endif /* MYWINCE */
     g_width_height_set = 1;
   }
   else
   {
-#ifdef MYWINCE
-    g_xoff = 0;
-    g_yoff = 0;
-#else /* MYWINCE */
     g_xoff = GetSystemMetrics(SM_CXEDGE) * 2;
     g_yoff = GetSystemMetrics(SM_CYCAPTION) +
              GetSystemMetrics(SM_CYEDGE) * 2;
-#endif /* MYWINCE */
   }
   g_width = g_width & (~3);
   return 1;
@@ -1260,11 +1127,8 @@
   valueindex = 0;
   vname[vnameindex] = 0;
   value[valueindex] = 0;
-#ifdef MYWINCE
-  str_to_uni(filename, "\\My Documents\\winrdesktop.ini");
-#else /* MYWINCE */
   str_to_uni(filename, ".\\winrdesktop.ini");
-#endif /* MYWINCE */
+
   fd = CreateFile(filename, GENERIC_READ,
                   FILE_SHARE_READ | FILE_SHARE_WRITE,
                   NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -1334,9 +1198,7 @@
 {
   char param[256];
   char param1[256];
-#ifndef MYWINCE
   TCHAR l_username[256];
-#endif
   DWORD size;
   int len;
   int i;
@@ -1347,8 +1209,7 @@
   strcpy(g_username, "pda");
   /* get username and convert it from unicode */
   size = 255;
-#ifndef MYWINCE
-  /* WinCE doesn't have GetUserName */
+
   if (GetUserName(l_username, &size))
   {
     for (i = size; i >= 0; i--)
@@ -1361,7 +1222,7 @@
   {
     mi_show_error("GetUserName");
   }
-#endif /* MYWINCE */
+
   /* get computer name */
   if (gethostname(g_hostname, 255) != 0)
   {
@@ -1605,12 +1466,8 @@
   HRGN rgn;
   int ok_to_ScrollWindowEx;
 
-  /* WinCE can't scroll in 2 directions at once */
-#ifdef MYWINCE
-  ok_to_ScrollWindowEx = cx == 0 || cy == 0;
-#else /* MYWINCE */
   ok_to_ScrollWindowEx = 1;
-#endif /* MYWINCE */
+
   if (!ok_to_ScrollWindowEx)
   {
     rgn = CreateRectRgn(x - g_xscroll, y - g_yscroll,
@@ -1667,9 +1524,6 @@
                  int width, int height,
                  unsigned char * andmask, unsigned char * xormask)
 {
-#ifdef MYWINCE
-  return (void *) 1;
-#else /* MYWINCE */
   HCURSOR hCur;
 
   hCur = CreateCursor(g_Instance, x, y, width, height, andmask, xormask);
@@ -1678,32 +1532,25 @@
     hCur = LoadCursor(NULL, IDC_ARROW);
   }
   return hCur;
-#endif /* MYWINCE */
 }
 
 /*****************************************************************************/
 void
 mi_destroy_cursor(void * cursor)
 {
-#ifdef MYWINCE
-#else /* MYWINCE */
   if (g_cursor == cursor)
   {
     g_cursor = 0;
   }
   DestroyCursor(cursor);
-#endif /* MYWINCE */
 }
 
 /*****************************************************************************/
 void
 mi_set_cursor(void * cursor)
 {
-#ifdef MYWINCE
-#else /* MYWINCE */
   g_cursor = cursor;
   SetCursor(g_cursor);
-#endif /* MYWINCE */
 }
 
 /*****************************************************************************/




More information about the Ros-diffs mailing list