mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
GUI: Remove old window size persistence code
This commit is contained in:
parent
984b1bc1c1
commit
0d9f26f10b
2 changed files with 0 additions and 50 deletions
|
@ -348,51 +348,6 @@ bool get_current_screen_size(wxWindow *window, unsigned &width, unsigned &height
|
||||||
return true;
|
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<std::string> 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<int>(pair[0]);
|
|
||||||
auto height = boost::lexical_cast<int>(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()
|
void about()
|
||||||
{
|
{
|
||||||
AboutDialog dlg;
|
AboutDialog dlg;
|
||||||
|
|
|
@ -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
|
// Returns the dimensions of the screen on which the main frame is displayed
|
||||||
bool get_current_screen_size(wxWindow *window, unsigned &width, unsigned &height);
|
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
|
// Display an About dialog
|
||||||
extern void about();
|
extern void about();
|
||||||
// Ask the destop to open the datadir using the default file explorer.
|
// Ask the destop to open the datadir using the default file explorer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue