MainFrame: Maximize by default (at first start)
This commit is contained in:
parent
bfcd9f3c29
commit
8098c09589
3 changed files with 14 additions and 8 deletions
src/slic3r/GUI
|
@ -466,7 +466,7 @@ void GUI_App::update_ui_from_settings()
|
||||||
mainframe->update_ui_from_settings();
|
mainframe->update_ui_from_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::persist_window_geometry(wxTopLevelWindow *window)
|
void GUI_App::persist_window_geometry(wxTopLevelWindow *window, bool default_maximized)
|
||||||
{
|
{
|
||||||
const std::string name = into_u8(window->GetName());
|
const std::string name = into_u8(window->GetName());
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ void GUI_App::persist_window_geometry(wxTopLevelWindow *window)
|
||||||
event.Skip();
|
event.Skip();
|
||||||
});
|
});
|
||||||
|
|
||||||
window_pos_restore(window, name);
|
window_pos_restore(window, name, default_maximized);
|
||||||
|
|
||||||
on_window_geometry(window, [=]() {
|
on_window_geometry(window, [=]() {
|
||||||
window_pos_sanitize(window);
|
window_pos_sanitize(window);
|
||||||
|
@ -883,15 +883,21 @@ void GUI_App::window_pos_save(wxTopLevelWindow* window, const std::string &name)
|
||||||
app_config->save();
|
app_config->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::window_pos_restore(wxTopLevelWindow* window, const std::string &name)
|
void GUI_App::window_pos_restore(wxTopLevelWindow* window, const std::string &name, bool default_maximized)
|
||||||
{
|
{
|
||||||
if (name.empty()) { return; }
|
if (name.empty()) { return; }
|
||||||
const auto config_key = (boost::format("window_%1%") % name).str();
|
const auto config_key = (boost::format("window_%1%") % name).str();
|
||||||
|
|
||||||
if (! app_config->has(config_key)) { return; }
|
if (! app_config->has(config_key)) {
|
||||||
|
window->Maximize(default_maximized);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto metrics = WindowMetrics::deserialize(app_config->get(config_key));
|
auto metrics = WindowMetrics::deserialize(app_config->get(config_key));
|
||||||
if (! metrics) { return; }
|
if (! metrics) {
|
||||||
|
window->Maximize(default_maximized);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
window->SetSize(metrics->get_rect());
|
window->SetSize(metrics->get_rect());
|
||||||
window->Maximize(metrics->get_maximized());
|
window->Maximize(metrics->get_maximized());
|
||||||
|
|
|
@ -124,7 +124,7 @@ public:
|
||||||
const std::string& err);
|
const std::string& err);
|
||||||
// void notify(/*message*/);
|
// void notify(/*message*/);
|
||||||
|
|
||||||
void persist_window_geometry(wxTopLevelWindow *window);
|
void persist_window_geometry(wxTopLevelWindow *window, bool default_maximized = false);
|
||||||
void update_ui_from_settings();
|
void update_ui_from_settings();
|
||||||
|
|
||||||
bool select_language(wxArrayString & names, wxArrayLong & identifiers);
|
bool select_language(wxArrayString & names, wxArrayLong & identifiers);
|
||||||
|
@ -176,7 +176,7 @@ public:
|
||||||
private:
|
private:
|
||||||
bool on_init_inner();
|
bool on_init_inner();
|
||||||
void window_pos_save(wxTopLevelWindow* window, const std::string &name);
|
void window_pos_save(wxTopLevelWindow* window, const std::string &name);
|
||||||
void window_pos_restore(wxTopLevelWindow* window, const std::string &name);
|
void window_pos_restore(wxTopLevelWindow* window, const std::string &name, bool default_maximized = false);
|
||||||
void window_pos_sanitize(wxTopLevelWindow* window);
|
void window_pos_sanitize(wxTopLevelWindow* window);
|
||||||
};
|
};
|
||||||
DECLARE_APP(GUI_App)
|
DECLARE_APP(GUI_App)
|
||||||
|
|
|
@ -129,7 +129,7 @@ DPIFrame(NULL, wxID_ANY, SLIC3R_BUILD, wxDefaultPosition, wxDefaultSize, wxDEFAU
|
||||||
event.Skip();
|
event.Skip();
|
||||||
});
|
});
|
||||||
|
|
||||||
wxGetApp().persist_window_geometry(this);
|
wxGetApp().persist_window_geometry(this, true);
|
||||||
|
|
||||||
update_ui_from_settings(); // FIXME (?)
|
update_ui_from_settings(); // FIXME (?)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue