From 75a73f40b30d21fff890b3b38325bbef04ea4c2e Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 27 Jul 2024 21:05:10 +0200 Subject: [PATCH] try harder to fit editor menu on the screen --- dialogs.cpp | 4 ++++ graph.cpp | 5 ++++- mapeditor.cpp | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dialogs.cpp b/dialogs.cpp index dd0c2d33..6ba9ad1c 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -719,6 +719,10 @@ EX namespace dialog { dwidth = vid.xres - vid.yres; dcenter = vid.xres - dwidth / 2; } + else if(cmode & sm::DIALOG_OFFMAP) { + dwidth = vid.xres / 3; + dcenter = vid.xres * 5 / 6; + } measure(); diff --git a/graph.cpp b/graph.cpp index cbd908a4..f20ffc7c 100644 --- a/graph.cpp +++ b/graph.cpp @@ -5574,6 +5574,8 @@ EX void calcparam() { if(tour::on && (tour::slides[tour::currentslide].flags & tour::SIDESCREEN) && ok) current_display->sidescreen = true; #endif + if((cmode & sm::DIALOG_OFFMAP) && !centered_menus && vid.xres > vid.yres * 11/10) + current_display->sidescreen = true; if(current_display->sidescreen) cd->xcenter = vid.yres/2; } @@ -5863,7 +5865,7 @@ namespace sm { static constexpr int CENTER = 1024; static constexpr int ZOOMABLE = 4096; static constexpr int TORUSCONFIG = 8192; - static constexpr int MAYDARK = 16384; + static constexpr int MAYDARK = 16384; // use together with SIDE; if the screen is not wide or centered_menus is set, it will disable SIDE and instead darken the screen static constexpr int DIALOG_STRICT_X = 32768; // do not interpret dialog clicks outside of the X region static constexpr int EXPANSION = (1<<16); static constexpr int HEXEDIT = (1<<17); @@ -5878,6 +5880,7 @@ namespace sm { static constexpr int EDIT_INSIDE_WALLS = (1<<26); // mouseover targets inside walls static constexpr int DIALOG_WIDE = (1<<27); // make dialogs wide static constexpr int MOUSEAIM = (1<<28); // mouse aiming active here + static constexpr int DIALOG_OFFMAP = (1<<29); // try hard to keep dialogs off the map } #endif diff --git a/mapeditor.cpp b/mapeditor.cpp index 54d30b1e..99ec1074 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -1615,7 +1615,7 @@ EX namespace mapeditor { EX void showMapEditor() { cmode = sm::MAP | sm::PANNING; - if(show_menu) cmode |= sm::SIDE; + if(show_menu) cmode |= sm::DIALOG_OFFMAP; if(building_mode) { if(anyshiftclick) cmode |= sm::EDIT_INSIDE_WALLS; else cmode |= sm::EDIT_BEFORE_WALLS;