mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-29 17:44:36 +08:00
Fixed rounding of numbers for the controls width (Try to fix controls flashing on HDPI/linux)
This commit is contained in:
parent
e2b8c3e33c
commit
b7f24aebe3
@ -124,7 +124,7 @@ ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(wxString title)
|
||||
ConfigOptionsGroupShp optgroup;
|
||||
optgroup = std::make_shared<ConfigOptionsGroup>(panel, _(L("Settings")));
|
||||
|
||||
optgroup->label_width = 100;
|
||||
optgroup->label_width = int(7.7*wxGetApp().em_unit() + 0.5);//100;
|
||||
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
||||
update_shape();
|
||||
};
|
||||
|
@ -49,11 +49,13 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
||||
def.default_value = new ConfigOptionString{ " " };
|
||||
m_og->append_single_option_line(Option(def, "object_name"));
|
||||
|
||||
const int field_width = int(3.8 * wxGetApp().em_unit()+0.5)/*50*/;
|
||||
|
||||
// Legend for object modification
|
||||
auto line = Line{ "", "" };
|
||||
def.label = "";
|
||||
def.type = coString;
|
||||
def.width = 3.8 * wxGetApp().em_unit()/*50*/;
|
||||
def.width = field_width/*50*/;
|
||||
|
||||
std::vector<std::string> axes{ "x", "y", "z" };
|
||||
for (const auto axis : axes) {
|
||||
@ -65,13 +67,13 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
||||
m_og->append_line(line);
|
||||
|
||||
|
||||
auto add_og_to_object_settings = [this](const std::string& option_name, const std::string& sidetext)
|
||||
auto add_og_to_object_settings = [this, field_width](const std::string& option_name, const std::string& sidetext)
|
||||
{
|
||||
Line line = { _(option_name), "" };
|
||||
ConfigOptionDef def;
|
||||
def.type = coFloat;
|
||||
def.default_value = new ConfigOptionFloat(0.0);
|
||||
def.width = 3.8 * wxGetApp().em_unit()/*50*/;
|
||||
def.width = field_width/*50*/;
|
||||
|
||||
if (option_name == "Rotation")
|
||||
{
|
||||
|
@ -593,7 +593,7 @@ Field* ConfigOptionsGroup::get_fieldc(const t_config_option_key& opt_key, int op
|
||||
void ogStaticText::SetText(const wxString& value, bool wrap/* = true*/)
|
||||
{
|
||||
SetLabel(value);
|
||||
if (wrap) Wrap(400);
|
||||
if (wrap) Wrap(35 * wxGetApp().em_unit()/*400*/);
|
||||
GetParent()->Layout();
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ class OptionsGroup {
|
||||
public:
|
||||
const bool staticbox {true};
|
||||
const wxString title {wxString("")};
|
||||
size_t label_width {200};
|
||||
size_t label_width = 15 * wxGetApp().em_unit();// {200};
|
||||
wxSizer* sizer {nullptr};
|
||||
column_t extra_column {nullptr};
|
||||
t_change m_on_change { nullptr };
|
||||
|
@ -562,7 +562,7 @@ Sidebar::Sidebar(Plater *parent)
|
||||
// calculate width of the preset labels
|
||||
p->sizer_presets->Layout();
|
||||
const wxArrayInt& ar = p->sizer_presets->GetColWidths();
|
||||
int label_width = ar.IsEmpty() ? 7.7*wxGetApp().em_unit() : ar.front()-4;
|
||||
int label_width = ar.IsEmpty() ? int(7.7*wxGetApp().em_unit()+0.5) : ar.front()-4;
|
||||
|
||||
p->sizer_params = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
|
@ -56,6 +56,8 @@ Tab::Tab(wxNotebook* parent, const wxString& title, const char* name) :
|
||||
m_compatible_prints.dialog_label = _(L("Select the print profiles this profile is compatible with."));
|
||||
|
||||
wxGetApp().tabs_list.push_back(this);
|
||||
|
||||
m_em_unit = wxGetApp().em_unit();
|
||||
}
|
||||
|
||||
void Tab::set_type()
|
||||
@ -96,7 +98,7 @@ void Tab::create_preset_tab()
|
||||
#endif //__WXOSX__
|
||||
|
||||
// preset chooser
|
||||
m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(20 * wxGetApp().em_unit(), -1), 0, 0, wxCB_READONLY);
|
||||
m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(20 * m_em_unit, -1), 0, 0, wxCB_READONLY);
|
||||
|
||||
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||
|
||||
@ -201,7 +203,7 @@ void Tab::create_preset_tab()
|
||||
m_hsizer->Add(m_left_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 3);
|
||||
|
||||
// tree
|
||||
m_treectrl = new wxTreeCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(15 * wxGetApp().em_unit(), -1),
|
||||
m_treectrl = new wxTreeCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(15 * m_em_unit, -1),
|
||||
wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_SUNKEN | wxWANTS_CHARS);
|
||||
m_left_sizer->Add(m_treectrl, 1, wxEXPAND);
|
||||
m_icons = new wxImageList(16, 16, true, 1);
|
||||
@ -1105,14 +1107,14 @@ void TabPrint::build()
|
||||
optgroup = page->new_optgroup(_(L("Post-processing scripts")), 0);
|
||||
option = optgroup->get_option("post_process");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 4 * wxGetApp().em_unit();//50;
|
||||
option.opt.height = 4 * m_em_unit;//50;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Notes")), "note.png");
|
||||
optgroup = page->new_optgroup(_(L("Notes")), 0);
|
||||
option = optgroup->get_option("notes");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 19 * wxGetApp().em_unit();//250;
|
||||
option.opt.height = 19 * m_em_unit;//250;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Dependencies")), "wrench.png");
|
||||
@ -1468,18 +1470,20 @@ void TabFilament::build()
|
||||
};
|
||||
optgroup->append_line(line);
|
||||
|
||||
const int gcode_field_height = int(11.5 * m_em_unit + 0.5); // 150
|
||||
const int notes_field_height = 19 * m_em_unit; // 250
|
||||
|
||||
page = add_options_page(_(L("Custom G-code")), "cog.png");
|
||||
optgroup = page->new_optgroup(_(L("Start G-code")), 0);
|
||||
Option option = optgroup->get_option("start_filament_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 11.5 * wxGetApp().em_unit();// 150;
|
||||
option.opt.height = gcode_field_height;// 150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("End G-code")), 0);
|
||||
option = optgroup->get_option("end_filament_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 11.5 * wxGetApp().em_unit();// 150;
|
||||
option.opt.height = gcode_field_height;// 150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Notes")), "note.png");
|
||||
@ -1487,7 +1491,7 @@ void TabFilament::build()
|
||||
optgroup->label_width = 0;
|
||||
option = optgroup->get_option("filament_notes");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 19 * wxGetApp().em_unit();// 250;
|
||||
option.opt.height = notes_field_height;// 250;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Dependencies")), "wrench.png");
|
||||
@ -1846,48 +1850,50 @@ void TabPrinter::build_fff()
|
||||
optgroup->append_single_option_line("use_volumetric_e");
|
||||
optgroup->append_single_option_line("variable_layer_height");
|
||||
|
||||
const int gcode_field_height = int(11.5 * m_em_unit + 0.5); // 150
|
||||
const int notes_field_height = 19 * m_em_unit; // 250
|
||||
page = add_options_page(_(L("Custom G-code")), "cog.png");
|
||||
optgroup = page->new_optgroup(_(L("Start G-code")), 0);
|
||||
option = optgroup->get_option("start_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 11.5 * wxGetApp().em_unit();//150;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("End G-code")), 0);
|
||||
option = optgroup->get_option("end_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 11.5 * wxGetApp().em_unit();//150;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Before layer change G-code")), 0);
|
||||
option = optgroup->get_option("before_layer_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 11.5 * wxGetApp().em_unit();//150;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("After layer change G-code")), 0);
|
||||
option = optgroup->get_option("layer_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 11.5 * wxGetApp().em_unit();//150;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Tool change G-code")), 0);
|
||||
option = optgroup->get_option("toolchange_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 11.5 * wxGetApp().em_unit();//150;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Between objects G-code (for sequential printing)")), 0);
|
||||
option = optgroup->get_option("between_objects_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 11.5 * wxGetApp().em_unit();//150;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Notes")), "note.png");
|
||||
optgroup = page->new_optgroup(_(L("Notes")), 0);
|
||||
option = optgroup->get_option("printer_notes");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 19 * wxGetApp().em_unit();//250;
|
||||
option.opt.height = notes_field_height;//250;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Dependencies")), "wrench.png");
|
||||
@ -1964,11 +1970,13 @@ void TabPrinter::build_sla()
|
||||
optgroup = page->new_optgroup(_(L("Print Host upload")));
|
||||
build_printhost(optgroup.get());
|
||||
|
||||
const int notes_field_height = 19 * m_em_unit; // 250
|
||||
|
||||
page = add_options_page(_(L("Notes")), "note.png");
|
||||
optgroup = page->new_optgroup(_(L("Notes")), 0);
|
||||
option = optgroup->get_option("printer_notes");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 19*wxGetApp().em_unit();//250;
|
||||
option.opt.height = notes_field_height;//250;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Dependencies")), "wrench.png");
|
||||
@ -2017,7 +2025,7 @@ PageShp TabPrinter::build_kinematics_page()
|
||||
// Legend for OptionsGroups
|
||||
auto optgroup = page->new_optgroup("");
|
||||
optgroup->set_show_modified_btns_val(false);
|
||||
optgroup->label_width = 18 * wxGetApp().em_unit();// 230;
|
||||
optgroup->label_width = 18 * m_em_unit;// 230;
|
||||
auto line = Line{ "", "" };
|
||||
|
||||
ConfigOptionDef def;
|
||||
@ -3103,7 +3111,7 @@ void TabSLAMaterial::build()
|
||||
optgroup->append_single_option_line("initial_exposure_time");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Corrections")));
|
||||
optgroup->label_width = 14.5 * wxGetApp().em_unit();//190;
|
||||
optgroup->label_width = int(14.5 * m_em_unit+0.5);//190;
|
||||
std::vector<std::string> corrections = { "material_correction_printing", "material_correction_curing" };
|
||||
std::vector<std::string> axes{ "X", "Y", "Z" };
|
||||
for (auto& opt_key : corrections) {
|
||||
@ -3124,7 +3132,7 @@ void TabSLAMaterial::build()
|
||||
optgroup->label_width = 0;
|
||||
Option option = optgroup->get_option("material_notes");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 19 * wxGetApp().em_unit();//250;
|
||||
option.opt.height = 19 * m_em_unit;//250;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Dependencies")), "wrench.png");
|
||||
|
@ -203,6 +203,8 @@ protected:
|
||||
|
||||
void set_type();
|
||||
|
||||
int m_em_unit;
|
||||
|
||||
public:
|
||||
PresetBundle* m_preset_bundle;
|
||||
bool m_show_btn_incompatible_presets = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user