The code which realizes full functionality Control Panel,
in a kind existing now, was added.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@467 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/winvnc/ControlPanel.cxx b/winvnc/ControlPanel.cxx
index 1f69306..e668d91 100644
--- a/winvnc/ControlPanel.cxx
+++ b/winvnc/ControlPanel.cxx
@@ -8,7 +8,6 @@
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
-//using namespace rfb_win32;
 using namespace winvnc;
 
 bool ControlPanel::showDialog()
@@ -26,6 +25,8 @@
   InitLVColumns(IDC_LIST_CONNECTIONS, handle, 120, 3, ColumnsStrings,
                 LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
                 LVS_EX_FULLROWSELECT, LVCFMT_LEFT);
+  SendCommand(3, -1);
+  setItemChecked(IDC_DISABLE_CLIENTS, ListConnStatus.getDisable());
 }
 
 bool ControlPanel::onCommand(int cmd)
@@ -42,11 +43,6 @@
       SendCommand(2, -1);
       return false;
     }
-  case IDC_DISABLE_CLIENTS:
-    {     
-      
-      return false;
-    }
   case IDC_KILL_SEL_CLIENT:
     {     
       SendCommand(3, 3);
@@ -68,6 +64,12 @@
       EndDialog(handle, 0);
       return false;
     }
+  case IDC_DISABLE_CLIENTS:
+    {   
+      ListConnStatus.setDisable(isItemChecked(IDC_DISABLE_CLIENTS));
+      SendCommand(3, -1);
+      return false;
+    }
   }
   return false;
   
@@ -109,7 +111,6 @@
       stop_updating = false;
       SendCommand(3, 2);
     }
-    initDialog();
     return TRUE;
   case WM_COMMAND:
     switch (LOWORD(wParam)) {
@@ -141,15 +142,15 @@
   COPYDATASTRUCT copyData;
   copyData.dwData = command;
   copyData.lpData = 0;
+  getSelConnInfo();
   if (data != -1) {
-    getSelConnInfo();
     ListConnStatus.Copy(&ListSelConn);
-    for (ListConnStatus.iBegin(); !ListConnStatus.iEnd(); ListConnStatus.iNext())
-      ListConnStatus.iSetStatus(data);
+    ListConnStatus.setAllStatus(data);
     copyData.cbData = (DWORD)&ListConnStatus;
   } else {
-    copyData.cbData = 0;
+    ListConnStatus.Clear();
   }
+  copyData.cbData = (DWORD)&ListConnStatus;
   SendMessage(m_hSTIcon, WM_COPYDATA, 0, (LPARAM)&copyData);
 }
 
diff --git a/winvnc/STrayIcon.cxx b/winvnc/STrayIcon.cxx
index 5922026..d3e13da 100644
--- a/winvnc/STrayIcon.cxx
+++ b/winvnc/STrayIcon.cxx
@@ -186,10 +186,13 @@
         SendMessage(getHandle(), WM_CLOSE, 0, 0);
         return 0;
       }
-      setIcon(thread.server.isServerInUse() ? thread.activeIcon : thread.inactiveIcon);
 
-      CPanel->UpdateListView(&LCInfo);
       thread.server.getClientsInfo(&LCInfo);
+      CPanel->UpdateListView(&LCInfo);
+
+      setIcon(thread.server.isServerInUse() ?
+              (!LCInfo.getDisable() ? thread.activeIcon : thread.dis_activeIcon) : 
+              (!LCInfo.getDisable() ? thread.inactiveIcon : thread.dis_inactiveIcon));
 
       return 0;
 
@@ -215,8 +218,10 @@
 };
 
 
-STrayIconThread::STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon_, UINT activeIcon_, UINT menu_)
-: server(sm), inactiveIcon(inactiveIcon_), activeIcon(activeIcon_), menu(menu_),
+STrayIconThread::STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon_, UINT activeIcon_, 
+                                 UINT dis_inactiveIcon_, UINT dis_activeIcon_, UINT menu_)
+: server(sm), inactiveIcon(inactiveIcon_), activeIcon(activeIcon_),
+  dis_inactiveIcon(dis_inactiveIcon_), dis_activeIcon(dis_activeIcon_),menu(menu_),
   windowHandle(0), runTrayIcon(true) {
   start();
 }
diff --git a/winvnc/STrayIcon.h b/winvnc/STrayIcon.h
index cfd5ec0..ef32eba 100644
--- a/winvnc/STrayIcon.h
+++ b/winvnc/STrayIcon.h
@@ -29,7 +29,7 @@
   class STrayIconThread : rfb::Thread {
   public:
     STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon,
-      UINT activeIcon, UINT menu);
+      UINT activeIcon, UINT dis_inactiveIcon, UINT dis_activeIcon, UINT menu);
     virtual ~STrayIconThread() {
       runTrayIcon = false;
       PostThreadMessage(getThreadId(), WM_QUIT, 0, 0);
@@ -49,6 +49,8 @@
     VNCServerWin32& server;
     UINT inactiveIcon;
     UINT activeIcon;
+    UINT dis_inactiveIcon;
+    UINT dis_activeIcon;
     UINT menu;
     bool runTrayIcon;
   };
diff --git a/winvnc/VNCServerWin32.cxx b/winvnc/VNCServerWin32.cxx
index 30e9a72..67b3ec5 100644
--- a/winvnc/VNCServerWin32.cxx
+++ b/winvnc/VNCServerWin32.cxx
@@ -155,7 +155,8 @@
   config.setNotifyThread(Thread::self(), VNCM_REG_CHANGED);
 
   // - Create the tray icon if possible
-  STrayIconThread trayIcon(*this, IDI_ICON, IDI_CONNECTED, IDR_TRAY);
+  STrayIconThread trayIcon(*this, IDI_ICON, IDI_CONNECTED, IDI_ICON_DISABLE,
+                            IDI_CONNECTED_DISABLE, IDR_TRAY);
 
   DWORD result = 0;
   try {
diff --git a/winvnc/connecte.ico b/winvnc/connecte.ico
new file mode 100644
index 0000000..8f814b3
--- /dev/null
+++ b/winvnc/connecte.ico
Binary files differ
diff --git a/winvnc/icon_dis.ico b/winvnc/icon_dis.ico
new file mode 100644
index 0000000..0a6ea15
--- /dev/null
+++ b/winvnc/icon_dis.ico
Binary files differ
diff --git a/winvnc/resource.h b/winvnc/resource.h
index b9c0e04..b01ed96 100644
--- a/winvnc/resource.h
+++ b/winvnc/resource.h
@@ -12,6 +12,8 @@
 #define IDD_CONTROL_PANEL               106
 #define IDD_QUERY_CONNECT               107
 #define IDD_ADD_NEW_CLIENT              108
+#define IDI_ICON_DISABLE                109
+#define IDI_CONNECTED_DISABLE           110
 #define IDC_DESCRIPTION                 1000
 #define IDC_BUILDTIME                   1001
 #define IDC_VERSION                     1002
@@ -42,7 +44,7 @@
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        109
+#define _APS_NEXT_RESOURCE_VALUE        111
 #define _APS_NEXT_COMMAND_VALUE         40007
 #define _APS_NEXT_CONTROL_VALUE         1024
 #define _APS_NEXT_SYMED_VALUE           101
diff --git a/winvnc/winvnc.dsp b/winvnc/winvnc.dsp
index 9111851..a35a5e0 100644
--- a/winvnc/winvnc.dsp
+++ b/winvnc/winvnc.dsp
@@ -205,10 +205,18 @@
 # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"

 # Begin Source File

 

+SOURCE=.\connecte.ico

+# End Source File

+# Begin Source File

+

 SOURCE=.\connected.ico

 # End Source File

 # Begin Source File

 

+SOURCE=.\icon_dis.ico

+# End Source File

+# Begin Source File

+

 SOURCE=.\java\logo150x150.gif

 # End Source File

 # Begin Source File

diff --git a/winvnc/winvnc.rc b/winvnc/winvnc.rc
index 61cf8a6..ab92218 100644
--- a/winvnc/winvnc.rc
+++ b/winvnc/winvnc.rc
@@ -82,6 +82,15 @@
 END
 #endif    // APSTUDIO_INVOKED
 
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON_DISABLE        ICON    DISCARDABLE     "icon_dis.ico"
 #endif    // English (U.S.) resources
 /////////////////////////////////////////////////////////////////////////////
 
@@ -275,6 +284,7 @@
 // remains consistent on all systems.
 IDI_ICON                ICON    DISCARDABLE     "winvnc.ico"
 IDI_CONNECTED           ICON    DISCARDABLE     "connected.ico"
+IDI_CONNECTED_DISABLE   ICON    DISCARDABLE     "connecte.ico"
 
 /////////////////////////////////////////////////////////////////////////////
 //