diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index bccf211ef..0ff4ed161 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -348,51 +348,6 @@ bool get_current_screen_size(wxWindow *window, unsigned &width, unsigned &height return true; } -// XXX: remove these -void save_window_size(wxTopLevelWindow *window, const std::string &name) -{ - const wxSize size = window->GetSize(); - const wxPoint pos = window->GetPosition(); - const auto maximized = window->IsMaximized() ? "1" : "0"; - - get_app_config()->set((boost::format("window_%1%_size") % name).str(), (boost::format("%1%;%2%") % size.GetWidth() % size.GetHeight()).str()); - get_app_config()->set((boost::format("window_%1%_maximized") % name).str(), maximized); -} - -void restore_window_size(wxTopLevelWindow *window, const std::string &name) -{ - // XXX: This still doesn't behave nicely in some situations (mostly on Linux). - // The problem is that it's hard to obtain window position with respect to screen geometry reliably - // from wxWidgets. Sometimes wxWidgets claim a window is located on a different screen than on which - // it's actually visible. I suspect this has something to do with window initialization (maybe we - // restore window geometry too early), but haven't yet found a workaround. - - const auto display_idx = wxDisplay::GetFromWindow(window); - if (display_idx == wxNOT_FOUND) { return; } - - const auto display = wxDisplay(display_idx).GetClientArea(); - std::vector pair; - - try { - const auto key_size = (boost::format("window_%1%_size") % name).str(); - if (get_app_config()->has(key_size)) { - if (unescape_strings_cstyle(get_app_config()->get(key_size), pair) && pair.size() == 2) { - auto width = boost::lexical_cast(pair[0]); - auto height = boost::lexical_cast(pair[1]); - - window->SetSize(width, height); - } - } - } catch(const boost::bad_lexical_cast &) {} - - // Maximizing should be the last thing to do. - // This ensure the size and position are sane when the user un-maximizes the window. - const auto key_maximized = (boost::format("window_%1%_maximized") % name).str(); - if (get_app_config()->get(key_maximized) == "1") { - window->Maximize(true); - } -} - void about() { AboutDialog dlg; diff --git a/src/slic3r/GUI/GUI.hpp b/src/slic3r/GUI/GUI.hpp index 79b21b503..e33be8f58 100644 --- a/src/slic3r/GUI/GUI.hpp +++ b/src/slic3r/GUI/GUI.hpp @@ -70,11 +70,6 @@ boost::filesystem::path into_path(const wxString &str); // Returns the dimensions of the screen on which the main frame is displayed bool get_current_screen_size(wxWindow *window, unsigned &width, unsigned &height); -// Save window size and maximized status into AppConfig -void save_window_size(wxTopLevelWindow *window, const std::string &name); -// Restore the above -void restore_window_size(wxTopLevelWindow *window, const std::string &name); - // Display an About dialog extern void about(); // Ask the destop to open the datadir using the default file explorer.