1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-19 12:08:05 -05:00

The bell overload times are now measured in milliseconds, although

the config box still enters them in seconds (it allows fractions).

[originally from svn r1089]
This commit is contained in:
Simon Tatham 2001-04-28 15:47:26 +00:00
parent 296cad5962
commit 321adcb4b9
3 changed files with 22 additions and 8 deletions

View File

@ -267,8 +267,8 @@ void load_settings (char *section, int do_host, Config *cfg) {
sizeof(cfg->bell_wavefile)); sizeof(cfg->bell_wavefile));
gppi (sesskey, "BellOverload", 1, &cfg->bellovl); gppi (sesskey, "BellOverload", 1, &cfg->bellovl);
gppi (sesskey, "BellOverloadN", 5, &cfg->bellovl_n); gppi (sesskey, "BellOverloadN", 5, &cfg->bellovl_n);
gppi (sesskey, "BellOverloadT", 2, &cfg->bellovl_t); gppi (sesskey, "BellOverloadT", 2000, &cfg->bellovl_t);
gppi (sesskey, "BellOverloadS", 5, &cfg->bellovl_s); gppi (sesskey, "BellOverloadS", 5000, &cfg->bellovl_s);
gppi (sesskey, "ScrollbackLines", 200, &cfg->savelines); gppi (sesskey, "ScrollbackLines", 200, &cfg->savelines);
gppi (sesskey, "DECOriginMode", 0, &cfg->dec_om); gppi (sesskey, "DECOriginMode", 0, &cfg->dec_om);
gppi (sesskey, "AutoWrapMode", 1, &cfg->wrap_mode); gppi (sesskey, "AutoWrapMode", 1, &cfg->wrap_mode);

View File

@ -906,7 +906,7 @@ void term_out(void) {
* t seconds ago. * t seconds ago.
*/ */
while (beephead && while (beephead &&
beephead->ticks < ticks - cfg.bellovl_t*1000) { beephead->ticks < ticks - cfg.bellovl_t) {
struct beeptime *tmp = beephead; struct beeptime *tmp = beephead;
beephead = tmp->next; beephead = tmp->next;
sfree(tmp); sfree(tmp);
@ -916,7 +916,7 @@ void term_out(void) {
} }
if (cfg.bellovl && beep_overloaded && if (cfg.bellovl && beep_overloaded &&
ticks-lastbeep >= cfg.bellovl_s * 1000) { ticks-lastbeep >= cfg.bellovl_s) {
/* /*
* If we're currently overloaded and the * If we're currently overloaded and the
* last beep was more than s seconds ago, * last beep was more than s seconds ago,

View File

@ -43,6 +43,20 @@ static void MyGetDlgItemInt (HWND hwnd, int id, int *result) {
*result = n; *result = n;
} }
static void MyGetDlgItemFlt (HWND hwnd, int id, int *result, int scale) {
char text[80];
BOOL ok;
ok = GetDlgItemText (hwnd, id, text, sizeof(text)-1);
if (ok && text[0])
*result = (int) (scale * atof(text));
}
static void MySetDlgItemFlt (HWND hwnd, int id, double value) {
char text[80];
sprintf(text, "%g", value);
SetDlgItemText (hwnd, id, text);
}
static int CALLBACK LogProc (HWND hwnd, UINT msg, static int CALLBACK LogProc (HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam) { WPARAM wParam, LPARAM lParam) {
int i; int i;
@ -585,8 +599,8 @@ static void init_dlg_ctrls(HWND hwnd) {
SetDlgItemText (hwnd, IDC_BELL_WAVEEDIT, cfg.bell_wavefile); SetDlgItemText (hwnd, IDC_BELL_WAVEEDIT, cfg.bell_wavefile);
CheckDlgButton (hwnd, IDC_BELLOVL, cfg.bellovl); CheckDlgButton (hwnd, IDC_BELLOVL, cfg.bellovl);
SetDlgItemInt (hwnd, IDC_BELLOVLN, cfg.bellovl_n, FALSE); SetDlgItemInt (hwnd, IDC_BELLOVLN, cfg.bellovl_n, FALSE);
SetDlgItemInt (hwnd, IDC_BELLOVLT, cfg.bellovl_t, FALSE); MySetDlgItemFlt (hwnd, IDC_BELLOVLT, cfg.bellovl_t / 1000.0);
SetDlgItemInt (hwnd, IDC_BELLOVLS, cfg.bellovl_s, FALSE); MySetDlgItemFlt (hwnd, IDC_BELLOVLS, cfg.bellovl_s / 1000.0);
CheckDlgButton (hwnd, IDC_BCE, cfg.bce); CheckDlgButton (hwnd, IDC_BCE, cfg.bce);
CheckDlgButton (hwnd, IDC_BLINKTEXT, cfg.blinktext); CheckDlgButton (hwnd, IDC_BLINKTEXT, cfg.blinktext);
@ -1727,11 +1741,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
break; break;
case IDC_BELLOVLT: case IDC_BELLOVLT:
if (HIWORD(wParam) == EN_CHANGE) if (HIWORD(wParam) == EN_CHANGE)
MyGetDlgItemInt (hwnd, IDC_BELLOVLT, &cfg.bellovl_t); MyGetDlgItemFlt (hwnd, IDC_BELLOVLT, &cfg.bellovl_t, 1000);
break; break;
case IDC_BELLOVLS: case IDC_BELLOVLS:
if (HIWORD(wParam) == EN_CHANGE) if (HIWORD(wParam) == EN_CHANGE)
MyGetDlgItemInt (hwnd, IDC_BELLOVLS, &cfg.bellovl_s); MyGetDlgItemFlt (hwnd, IDC_BELLOVLS, &cfg.bellovl_s, 1000);
break; break;
case IDC_BLINKTEXT: case IDC_BLINKTEXT:
if (HIWORD(wParam) == BN_CLICKED || if (HIWORD(wParam) == BN_CLICKED ||