1
0
Fork 0

Change: Allow Double-Ctrl+Click on default size box to clear saved size. (#14055)

pull/14062/head
Peter Nelson 2025-04-21 14:16:29 +01:00 committed by GitHub
parent 0cf7048a67
commit 788845f731
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -285,7 +285,7 @@ STR_TOOLTIP_CLOSE_WINDOW :{BLACK}Close wi
STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS :{BLACK}Window title - drag this to move window
STR_TOOLTIP_SHADE :{BLACK}Shade window - only show the title bar
STR_TOOLTIP_DEBUG :{BLACK}Show NewGRF debug information
STR_TOOLTIP_DEFSIZE :{BLACK}Resize window to default size. Ctrl+Click to store current size as default
STR_TOOLTIP_DEFSIZE :{BLACK}Resize window to default size. Ctrl+Click to store current size as default. Double Ctrl+Click to reset stored default
STR_TOOLTIP_STICKY :{BLACK}Mark this window as uncloseable by the 'Close All Windows' key. Ctrl+Click to also save state as default
STR_TOOLTIP_RESIZE :{BLACK}Click and drag to resize this window
STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW :{BLACK}Toggle large/small window size

View File

@ -685,8 +685,13 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
case WWT_DEFSIZEBOX: {
if (_ctrl_pressed) {
w->window_desc.pref_width = w->width;
w->window_desc.pref_height = w->height;
if (click_count > 1) {
w->window_desc.pref_width = 0;
w->window_desc.pref_height = 0;
} else {
w->window_desc.pref_width = w->width;
w->window_desc.pref_height = w->height;
}
} else {
int16_t def_width = std::max<int16_t>(std::min<int16_t>(w->window_desc.GetDefaultWidth(), _screen.width), w->nested_root->smallest_x);
int16_t def_height = std::max<int16_t>(std::min<int16_t>(w->window_desc.GetDefaultHeight(), _screen.height - 50), w->nested_root->smallest_y);