Make Custom GCode Editor resizable (#9405)

* Make gcode editor window resizable

* Make param list expands with the window

* Make dialog shrinkable and give it a proper initial size

* Revert "Hardcode Location of Add Button"

This reverts commit aef74ab005.

* Make sure the dialog fits inside current screen

* Fix compile error
This commit is contained in:
Noisyfox
2025-05-09 23:00:27 +08:00
committed by GitHub
parent 0c4f778ddb
commit 0cc495b425
3 changed files with 29 additions and 6 deletions

View File

@@ -18,6 +18,7 @@
#include <wx/dcclient.h>
#include <wx/font.h>
#include <wx/fontutil.h>
#include <wx/display.h>
#include "libslic3r/Config.hpp"
@@ -481,5 +482,18 @@ bool generate_image(const std::string &filename, wxImage &image, wxSize img_size
std::deque<wxDialog*> dialogStack;
void fit_in_display(wxTopLevelWindow& window, wxSize desired_size)
{
const auto display_size = wxDisplay(window.GetParent()).GetClientArea();
if (desired_size.GetWidth() > display_size.GetWidth()) {
desired_size.SetWidth(display_size.GetWidth() * 4 / 5);
}
if (desired_size.GetHeight() > display_size.GetHeight()) {
desired_size.SetHeight(display_size.GetHeight() * 4 / 5);
}
window.SetSize(desired_size);
}
}
}