int bellovl_s; /* period of silence to re-enable bell (s) */
char bell_wavefile[FILENAME_MAX];
int scrollbar;
- int locksize;
- int lockfont;
+ enum { RESIZE_TERM, RESIZE_DISABLED, RESIZE_FONT } resize_action;
int bce;
int blinktext;
int win_name_always;
write_setting_i(sesskey, "ScrollBar", cfg->scrollbar);
write_setting_i(sesskey, "ScrollOnKey", cfg->scroll_on_key);
write_setting_i(sesskey, "ScrollOnDisp", cfg->scroll_on_disp);
- write_setting_i(sesskey, "LockSize", cfg->locksize);
- write_setting_i(sesskey, "LockFont", cfg->lockfont);
+ write_setting_i(sesskey, "LockSize", cfg->resize_action);
write_setting_i(sesskey, "BCE", cfg->bce);
write_setting_i(sesskey, "BlinkText", cfg->blinktext);
write_setting_i(sesskey, "X11Forward", cfg->x11_forward);
gppi(sesskey, "ScrollBar", 1, &cfg->scrollbar);
gppi(sesskey, "ScrollOnKey", 0, &cfg->scroll_on_key);
gppi(sesskey, "ScrollOnDisp", 1, &cfg->scroll_on_disp);
- gppi(sesskey, "LockSize", 0, &cfg->locksize);
- gppi(sesskey, "LockFont", cfg->locksize, &cfg->lockfont);
+ gppi(sesskey, "LockSize", 0, &cfg->resize_action);
gppi(sesskey, "BCE", 0, &cfg->bce);
gppi(sesskey, "BlinkText", 0, &cfg->blinktext);
gppi(sesskey, "X11Forward", 0, &cfg->x11_forward);
IDC_ROWSEDIT,
IDC_COLSSTATIC,
IDC_COLSEDIT,
- IDC_LOCKSIZE,
- IDC_LOCKFONT,
+ IDC_RESIZESTATIC,
+ IDC_RESIZETERM,
+ IDC_RESIZEFONT,
+ IDC_RESIZENONE,
IDC_SCROLLBAR,
IDC_CLOSEWARN,
IDC_SAVESTATIC,
cfg.cursor_type == 1 ? IDC_CURUNDER : IDC_CURVERT);
CheckDlgButton(hwnd, IDC_BLINKCUR, cfg.blink_cur);
CheckDlgButton(hwnd, IDC_SCROLLBAR, cfg.scrollbar);
- CheckDlgButton(hwnd, IDC_LOCKSIZE, cfg.locksize);
- CheckDlgButton(hwnd, IDC_LOCKFONT, cfg.lockfont);
+ CheckRadioButton(hwnd, IDC_RESIZETERM, IDC_RESIZENONE,
+ cfg.resize_action == RESIZE_TERM ? IDC_RESIZETERM :
+ cfg.resize_action == RESIZE_FONT ? IDC_RESIZEFONT :
+ IDC_RESIZENONE);
CheckRadioButton(hwnd, IDC_COEALWAYS, IDC_COENORMAL,
cfg.close_on_exit == COE_NORMAL ? IDC_COENORMAL :
cfg.close_on_exit ==
multiedit(&cp,
"&Rows", IDC_ROWSSTATIC, IDC_ROWSEDIT, 50,
"Colu&mns", IDC_COLSSTATIC, IDC_COLSEDIT, 50, NULL);
- checkbox(&cp, "Lock terminal size against resi&zing", IDC_LOCKSIZE);
- checkbox(&cp, "Lock font size against resi&zing", IDC_LOCKFONT);
+ radioline(&cp, "Action when the window is resized:", IDC_RESIZESTATIC,
+ 3, "Resi&ze terminal", IDC_RESIZETERM,
+ "Change fo&nt", IDC_RESIZEFONT,
+ "Forb&id resizing", IDC_RESIZENONE, NULL);
endbox(&cp);
beginbox(&cp, "Control the scrollback in the window",
IDC_BOX_WINDOW2);
cfg.scrollbar =
IsDlgButtonChecked(hwnd, IDC_SCROLLBAR);
break;
- case IDC_LOCKSIZE:
+ case IDC_RESIZETERM:
+ case IDC_RESIZEFONT:
+ case IDC_RESIZENONE:
if (HIWORD(wParam) == BN_CLICKED ||
- HIWORD(wParam) == BN_DOUBLECLICKED)
- cfg.locksize =
- IsDlgButtonChecked(hwnd, IDC_LOCKSIZE);
- break;
- case IDC_LOCKFONT:
- if (HIWORD(wParam) == BN_CLICKED ||
- HIWORD(wParam) == BN_DOUBLECLICKED)
- cfg.lockfont =
- IsDlgButtonChecked(hwnd, IDC_LOCKFONT);
+ HIWORD(wParam) == BN_DOUBLECLICKED) {
+ cfg.resize_action =
+ IsDlgButtonChecked(hwnd,
+ IDC_RESIZETERM) ? RESIZE_TERM :
+ IsDlgButtonChecked(hwnd,
+ IDC_RESIZEFONT) ? RESIZE_FONT :
+ RESIZE_DISABLED;
+ }
break;
case IDC_WINEDIT:
if (HIWORD(wParam) == EN_CHANGE)
int exwinmode = 0;
if (!cfg.scrollbar)
winmode &= ~(WS_VSCROLL);
- if (cfg.locksize && cfg.lockfont)
+ if (cfg.resize_action == RESIZE_DISABLED)
winmode &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
if (cfg.alwaysontop)
exwinmode |= WS_EX_TOPMOST;
/* If the window is maximized supress resizing attempts */
if (IsZoomed(hwnd)) {
- if (cfg.lockfont)
+ if (cfg.resize_action != RESIZE_FONT)
return;
}
- if (cfg.lockfont && cfg.locksize) return;
+ if (cfg.resize_action == RESIZE_DISABLED) return;
if (h == rows && w == cols) return;
/* Sanity checks ... */
term_size(h, w, cfg.savelines);
- if (cfg.lockfont) {
+ if (cfg.resize_action != RESIZE_FONT) {
width = extra_width + font_width * w;
height = extra_height + font_height * h;
extra_width = wr.right - wr.left - cr.right + cr.left;
extra_height = wr.bottom - wr.top - cr.bottom + cr.top;
- if (!cfg.lockfont) {
+ if (cfg.resize_action == RESIZE_FONT) {
if ( font_width != win_width/cols ||
font_height != win_height/rows) {
deinit_fonts();
* window. But that may be too big for the screen which forces us
* to change the terminal.
*/
- if ((cfg.lockfont && reinit==0) || reinit>0) {
+ if ((cfg.resize_action != RESIZE_FONT && reinit==0) || reinit>0) {
offset_width = offset_height = cfg.window_border;
extra_width = wr.right - wr.left - cr.right + cr.left + offset_width*2;
extra_height = wr.bottom - wr.top - cr.bottom + cr.top +offset_height*2;
if (cfg.height != prev_cfg.height ||
cfg.width != prev_cfg.width ||
cfg.savelines != prev_cfg.savelines ||
- cfg.locksize )
+ cfg.resize_action != RESIZE_TERM)
term_size(cfg.height, cfg.width, cfg.savelines);
/* Enable or disable the scroll bar, etc */
nflg |= WS_VSCROLL;
else
nflg &= ~WS_VSCROLL;
- if (cfg.locksize && cfg.lockfont)
+ if (cfg.resize_action == RESIZE_DISABLED)
nflg &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
else
nflg |= (WS_THICKFRAME | WS_MAXIMIZEBOX);
}
/* Oops */
- if (cfg.locksize && cfg.lockfont && IsZoomed(hwnd)) {
+ if (cfg.resize_action == RESIZE_DISABLED && IsZoomed(hwnd)) {
force_normal(hwnd);
init_lvl = 2;
}
cfg.fontcharset != prev_cfg.fontcharset ||
cfg.vtmode != prev_cfg.vtmode ||
cfg.bold_colour != prev_cfg.bold_colour ||
- (cfg.lockfont && !prev_cfg.lockfont))
+ (cfg.resize_action != RESIZE_FONT &&
+ prev_cfg.resize_action == RESIZE_FONT))
init_lvl = 2;
InvalidateRect(hwnd, NULL, TRUE);
* 1) Keep the sizetip uptodate
* 2) Make sure the window size is _stepped_ in units of the font size.
*/
- if (!cfg.locksize && !alt_pressed) {
+ if (cfg.resize_action == RESIZE_TERM && !alt_pressed) {
int width, height, w, h, ew, eh;
LPRECT r = (LPRECT) lParam;
if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED)
SetWindowText(hwnd, window_name);
- if (cfg.lockfont && cfg.locksize) {
+ if (cfg.resize_action == RESIZE_DISABLED) {
/* A resize, well it better be a minimize. */
reset_window(-1);
} else {
was_zoomed = 1;
prev_rows = rows;
prev_cols = cols;
- if (cfg.lockfont) {
+ if (cfg.resize_action != RESIZE_FONT) {
w = width / font_width;
if (w < 1) w = 1;
h = height / font_height;
reset_window(0);
} else if (wParam == SIZE_RESTORED && was_zoomed) {
was_zoomed = 0;
- if (cfg.lockfont)
+ if (cfg.resize_action != RESIZE_FONT)
term_size(prev_rows, prev_cols, cfg.savelines);
reset_window(0);
}
* down the connection during an NT opaque drag.)
*/
if (resizing) {
- if (!cfg.locksize && !alt_pressed) {
+ if (cfg.resize_action == RESIZE_TERM && !alt_pressed) {
need_backend_resize = TRUE;
w = (width-cfg.window_border*2) / font_width;
if (w < 1) w = 1;