From 57d08f2ff9c2bf796bcf92931bf4dcd48b6e5679 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 28 Apr 2001 18:02:19 +0000 Subject: [PATCH] Add Jordan Russell's patch for a sunken-edge border like a DOS box. Configurable, of course, because I for one like the border as thin as possible. git-svn-id: svn://svn.tartarus.org/sgt/putty@1092 cda61777-01e9-0310-a592-d414129be87e --- putty.h | 1 + settings.c | 2 ++ windlg.c | 17 +++++++++++++++-- window.c | 15 +++++++++++---- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/putty.h b/putty.h index 8acc9a64..06d5d509 100644 --- a/putty.h +++ b/putty.h @@ -242,6 +242,7 @@ typedef struct { int logtype; int logxfovr; int hide_mouseptr; + int sunken_edge; char answerback[256]; /* Colour options */ int try_palette; diff --git a/settings.c b/settings.c index 256e2b2d..164fb319 100644 --- a/settings.c +++ b/settings.c @@ -102,6 +102,7 @@ void save_settings (char *section, int do_host, Config *cfg) { write_setting_s (sesskey, "Answerback", cfg->answerback); write_setting_i (sesskey, "AlwaysOnTop", cfg->alwaysontop); write_setting_i (sesskey, "HideMousePtr", cfg->hide_mouseptr); + write_setting_i (sesskey, "SunkenEdge", cfg->sunken_edge); write_setting_i (sesskey, "CurType", cfg->cursor_type); write_setting_i (sesskey, "BlinkCur", cfg->blink_cur); write_setting_i (sesskey, "Beep", cfg->beep); @@ -260,6 +261,7 @@ void load_settings (char *section, int do_host, Config *cfg) { gpps (sesskey, "Answerback", "PuTTY", cfg->answerback, sizeof(cfg->answerback)); gppi (sesskey, "AlwaysOnTop", 0, &cfg->alwaysontop); gppi (sesskey, "HideMousePtr", 0, &cfg->hide_mouseptr); + gppi (sesskey, "SunkenEdge", 0, &cfg->sunken_edge); gppi (sesskey, "CurType", 0, &cfg->cursor_type); gppi (sesskey, "BlinkCur", 0, &cfg->blink_cur); gppi (sesskey, "Beep", 1, &cfg->beep); diff --git a/windlg.c b/windlg.c index 22683ac8..6f3c35c8 100644 --- a/windlg.c +++ b/windlg.c @@ -354,6 +354,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue, IDC_BOX_APPEARANCE2, IDC_BOX_APPEARANCE3, IDC_BOX_APPEARANCE4, + IDC_BOX_APPEARANCE5, IDC_CURSORSTATIC, IDC_CURBLOCK, IDC_CURUNDER, @@ -365,6 +366,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue, IDC_WINEDIT, IDC_WINNAME, IDC_HIDEMOUSE, + IDC_SUNKENEDGE, appearancepanelend, connectionpanelstart, @@ -608,6 +610,7 @@ static void init_dlg_ctrls(HWND hwnd) { SetDlgItemText (hwnd, IDC_WINEDIT, cfg.wintitle); CheckDlgButton (hwnd, IDC_WINNAME, cfg.win_name_always); CheckDlgButton (hwnd, IDC_HIDEMOUSE, cfg.hide_mouseptr); + CheckDlgButton (hwnd, IDC_SUNKENEDGE, cfg.sunken_edge); CheckRadioButton (hwnd, IDC_CURBLOCK, IDC_CURVERT, cfg.cursor_type==0 ? IDC_CURBLOCK : cfg.cursor_type==1 ? IDC_CURUNDER : IDC_CURVERT); @@ -792,7 +795,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { } if (panel == loggingpanelstart) { - /* The Logging panel. Accelerators used: [acgo] tplfwes */ + /* The Logging panel. Accelerators used: [acgo] tplfwe */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling session logging", @@ -960,7 +963,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { } if (panel == appearancepanelstart) { - /* The Appearance panel. Accelerators used: [acgo] luvb h ti p */ + /* The Appearance panel. Accelerators used: [acgo] luvb h ti p s */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling PuTTY's appearance", @@ -990,6 +993,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { checkbox(&cp, "Hide mouse &pointer when typing in window", IDC_HIDEMOUSE); endbox(&cp); + beginbox(&cp, "Adjust the window border", + IDC_BOX_APPEARANCE5); + checkbox(&cp, "&Sunken-edge border (slightly thicker)", + IDC_SUNKENEDGE); + endbox(&cp); } if (panel == translationpanelstart) { @@ -1767,6 +1775,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg, HIWORD(wParam) == BN_DOUBLECLICKED) cfg.hide_mouseptr = IsDlgButtonChecked (hwnd, IDC_HIDEMOUSE); break; + case IDC_SUNKENEDGE: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.sunken_edge = IsDlgButtonChecked (hwnd, IDC_SUNKENEDGE); + break; case IDC_CURBLOCK: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) diff --git a/window.c b/window.c index 62e4be75..59dbbe09 100644 --- a/window.c +++ b/window.c @@ -371,7 +371,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { int exwinmode = 0; if (!cfg.scrollbar) winmode &= ~(WS_VSCROLL); if (cfg.locksize) winmode &= ~(WS_THICKFRAME|WS_MAXIMIZEBOX); - if (cfg.alwaysontop) exwinmode = WS_EX_TOPMOST; + if (cfg.alwaysontop) exwinmode |= WS_EX_TOPMOST; + if (cfg.sunken_edge) exwinmode |= WS_EX_CLIENTEDGE; hwnd = CreateWindowEx (exwinmode, appname, appname, winmode, CW_USEDEFAULT, CW_USEDEFAULT, guess_width, guess_height, @@ -1193,6 +1194,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, case IDM_RECONF: { int prev_alwaysontop = cfg.alwaysontop; + int prev_sunken_edge = cfg.sunken_edge; char oldlogfile[FILENAME_MAX]; int oldlogtype; int need_setwpos = FALSE; @@ -1246,15 +1248,19 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, nexflag = exflag; if (cfg.alwaysontop != prev_alwaysontop) { if (cfg.alwaysontop) { - nexflag = WS_EX_TOPMOST; + nexflag |= WS_EX_TOPMOST; SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } else { - nexflag = 0; + nexflag &= ~(WS_EX_TOPMOST); SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } } + if (cfg.sunken_edge) + nexflag |= WS_EX_CLIENTEDGE; + else + nexflag &= ~(WS_EX_CLIENTEDGE); nflg = flag; if (cfg.scrollbar) nflg |= WS_VSCROLL; @@ -1291,7 +1297,8 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, cfg.width != cols || old_fwidth != font_width || old_fheight != font_height || - cfg.savelines != savelines) + cfg.savelines != savelines || + cfg.sunken_edge != prev_sunken_edge) need_setwpos = TRUE; term_size(cfg.height, cfg.width, cfg.savelines); InvalidateRect(hwnd, NULL, TRUE); -- 2.11.0