Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVojtech Kral <vojtech@kral.hk>2019-01-11 20:09:21 +0300
committerVojtech Kral <vojtech@kral.hk>2019-01-21 16:56:23 +0300
commitb3d7bf1c1e5b042d94ff20682de2da6bf8426932 (patch)
tree758088ca46ff556521a86d5c154cb5b5e666d105 /src/slic3r/GUI/GUI_Utils.cpp
parent412ae2865d9eaecf8134c96914c7eb04df4067db (diff)
Fix window geometry persistence #1557
Diffstat (limited to 'src/slic3r/GUI/GUI_Utils.cpp')
-rw-r--r--src/slic3r/GUI/GUI_Utils.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/slic3r/GUI/GUI_Utils.cpp b/src/slic3r/GUI/GUI_Utils.cpp
index 43b3c38f7..db0264459 100644
--- a/src/slic3r/GUI/GUI_Utils.cpp
+++ b/src/slic3r/GUI/GUI_Utils.cpp
@@ -120,19 +120,28 @@ boost::optional<WindowMetrics> WindowMetrics::deserialize(const std::string &str
void WindowMetrics::sanitize_for_display(const wxRect &screen_rect)
{
rect = rect.Intersect(screen_rect);
+
+ // Prevent the window from going too far towards the right and/or bottom edge
+ // It's hardcoded here that the threshold is 80% of the screen size
+ rect.x = std::min(rect.x, screen_rect.x + 4*screen_rect.width/5);
+ rect.y = std::min(rect.y, screen_rect.y + 4*screen_rect.height/5);
}
-std::string WindowMetrics::serialize()
+std::string WindowMetrics::serialize() const
{
return (boost::format("%1%; %2%; %3%; %4%; %5%")
- % rect.GetX()
- % rect.GetY()
- % rect.GetWidth()
- % rect.GetHeight()
+ % rect.x
+ % rect.y
+ % rect.width
+ % rect.height
% static_cast<int>(maximized)
).str();
}
+std::ostream& operator<<(std::ostream &os, const WindowMetrics& metrics)
+{
+ return os << '(' << metrics.serialize() << ')';
+}
}