Added key modifier and heartbeat options to GUI.

This commit is contained in:
crs 2003-03-22 11:49:13 +00:00
parent a6cb8769ba
commit 68ecf48a70
4 changed files with 80 additions and 17 deletions

View File

@ -20,7 +20,8 @@
#include "LaunchUtil.h"
#include "resource.h"
static const int s_defaultDelay = 250;
static const int s_defaultDelay = 250;
static const int s_defaultHeartbeat = 5000;
//
// CGlobalOptions
@ -32,7 +33,8 @@ CGlobalOptions::CGlobalOptions(HWND parent, CConfig* config) :
m_parent(parent),
m_config(config),
m_delayTime(s_defaultDelay),
m_twoTapTime(s_defaultDelay)
m_twoTapTime(s_defaultDelay),
m_heartbeatTime(s_defaultHeartbeat)
{
assert(s_singleton == NULL);
s_singleton = this;
@ -68,6 +70,11 @@ CGlobalOptions::init(HWND hwnd)
setItemChecked(child, false);
child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_TIME);
setWindowText(child, buffer);
sprintf(buffer, "%d", m_heartbeatTime);
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
setItemChecked(child, false);
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
setWindowText(child, buffer);
// get the global options
const CConfig::CScreenOptions* options = m_config->getOptions("");
@ -94,6 +101,15 @@ CGlobalOptions::init(HWND hwnd)
setWindowText(child, buffer);
}
}
else if (id == kOptionHeartbeat) {
if (value > 0) {
sprintf(buffer, "%d", value);
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
setItemChecked(child, true);
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
setWindowText(child, buffer);
}
}
}
}
}
@ -102,8 +118,9 @@ bool
CGlobalOptions::save(HWND hwnd)
{
HWND child;
int newDelayTime = 0;
int newTwoTapTime = 0;
int newDelayTime = 0;
int newTwoTapTime = 0;
int newHeartbeatTime = 0;
// get requested options
child = getItem(hwnd, IDC_GLOBAL_DELAY_CHECK);
@ -136,10 +153,26 @@ CGlobalOptions::save(HWND hwnd)
newTwoTapTime = s_defaultDelay;
}
}
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
if (isItemChecked(child)) {
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
newHeartbeatTime = getTime(hwnd, child, true);
if (newHeartbeatTime == 0) {
return false;
}
}
else {
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
newHeartbeatTime = getTime(hwnd, child, false);
if (newHeartbeatTime == 0) {
newHeartbeatTime = s_defaultHeartbeat;
}
}
// remove existing config options
m_config->removeOption("", kOptionScreenSwitchDelay);
m_config->removeOption("", kOptionScreenSwitchTwoTap);
m_config->removeOption("", kOptionHeartbeat);
// add requested options
child = getItem(hwnd, IDC_GLOBAL_DELAY_CHECK);
@ -150,11 +183,15 @@ CGlobalOptions::save(HWND hwnd)
if (isItemChecked(child)) {
m_config->addOption("", kOptionScreenSwitchTwoTap, newTwoTapTime);
}
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
if (isItemChecked(child)) {
m_config->addOption("", kOptionHeartbeat, newHeartbeatTime);
}
// save last values
m_delayTime = newDelayTime;
m_twoTapTime = newTwoTapTime;
m_delayTime = newDelayTime;
m_twoTapTime = newTwoTapTime;
m_heartbeatTime = newHeartbeatTime;
return true;
}

View File

@ -61,6 +61,7 @@ private:
CConfig* m_config;
int m_delayTime;
int m_twoTapTime;
int m_heartbeatTime;
};
#endif

View File

@ -103,7 +103,7 @@ BEGIN
PUSHBUTTON "Quit",IDCANCEL,243,241,50,14
END
IDD_ADD DIALOG DISCARDABLE 0, 0, 192, 170
IDD_ADD DIALOG DISCARDABLE 0, 0, 192, 236
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Add Screen"
FONT 8, "MS Sans Serif"
@ -113,15 +113,31 @@ BEGIN
LTEXT "&Aliases:",IDC_STATIC,7,25,25,8
EDITTEXT IDC_ADD_ALIASES_EDIT,79,26,106,40,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
GROUPBOX "Options",IDC_STATIC,7,72,178,64
LTEXT "If your Caps Lock or Num Lock keys behave strangely on this client screen then try turning the half-duplex options on and reconnect the client.",
IDC_STATIC,13,82,165,25
CONTROL "Half-duplex &Caps Lock",IDC_ADD_HD_CAPS_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,13,110,165,10
CONTROL "Half-duplex &Num Lock",IDC_ADD_HD_NUM_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,13,122,165,10
DEFPUSHBUTTON "OK",IDOK,79,149,50,14
PUSHBUTTON "Cancel",IDCANCEL,135,149,50,14
GROUPBOX "Options",IDC_STATIC,7,72,178,64
GROUPBOX "Modifiers",IDC_STATIC,7,139,178,65
LTEXT "Shift",IDC_STATIC,13,155,15,8
COMBOBOX IDC_ADD_MOD_SHIFT,37,152,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Ctrl",IDC_STATIC,13,170,11,8
COMBOBOX IDC_ADD_MOD_CTRL,37,168,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Alt",IDC_STATIC,13,186,9,8
COMBOBOX IDC_ADD_MOD_ALT,37,184,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Meta",IDC_STATIC,101,154,17,8
COMBOBOX IDC_ADD_MOD_META,125,152,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Super",IDC_STATIC,101,170,20,8
COMBOBOX IDC_ADD_MOD_SUPER,125,168,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,79,215,50,14
PUSHBUTTON "Cancel",IDCANCEL,135,215,50,14
END
IDD_WAIT DIALOG DISCARDABLE 0, 0, 186, 54
@ -154,7 +170,7 @@ BEGIN
IDC_STATIC,7,43,181,17
END
IDD_GLOBAL_OPTIONS DIALOG DISCARDABLE 0, 0, 207, 148
IDD_GLOBAL_OPTIONS DIALOG DISCARDABLE 0, 0, 207, 196
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Sans Serif"
@ -175,8 +191,15 @@ BEGIN
EDITTEXT IDC_GLOBAL_TWO_TAP_TIME,112,98,45,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "ms",IDC_STATIC,159,100,10,8
DEFPUSHBUTTON "OK",IDOK,94,127,50,14
PUSHBUTTON "Cancel",IDCANCEL,150,127,50,14
LTEXT "Synergy can periodically check that clients are still alive and connected. Use this only if synergy doesn't detect when clients disconnect.",
IDC_STATIC,7,122,193,24
CONTROL "Check clients every",IDC_GLOBAL_HEARTBEAT_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,153,78,10
EDITTEXT IDC_GLOBAL_HEARTBEAT_TIME,112,152,45,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "ms",IDC_STATIC,159,154,10,8
DEFPUSHBUTTON "OK",IDOK,94,175,50,14
PUSHBUTTON "Cancel",IDCANCEL,150,175,50,14
END
IDD_ADVANCED_OPTIONS DIALOG DISCARDABLE 0, 0, 230, 133
@ -220,7 +243,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 185
TOPMARGIN, 7
BOTTOMMARGIN, 163
BOTTOMMARGIN, 229
END
IDD_WAIT, DIALOG
@ -244,7 +267,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 200
TOPMARGIN, 7
BOTTOMMARGIN, 141
BOTTOMMARGIN, 189
END
IDD_ADVANCED_OPTIONS, DIALOG

View File

@ -93,7 +93,9 @@
#define IDC_GLOBAL_TWO_TAP_TIME 1044
#define IDC_ADD_MOD_CTRL 1044
#define IDC_ADD_MOD_ALT 1045
#define IDC_GLOBAL_HEARTBEAT_CHECK 1045
#define IDC_ADD_MOD_META 1046
#define IDC_GLOBAL_HEARTBEAT_TIME 1046
#define IDC_ADD_MOD_SUPER 1047
#define IDC_ADVANCED_DEFAULTS 1049
@ -104,7 +106,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 110
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1050
#define _APS_NEXT_CONTROL_VALUE 1052
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif