mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user