mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 00:15:56 +08:00
Set max font size in respect to the display size.
+ non-MSW specific: Suppress colored border for focused control. + Fixed layout of the PointCtrl + WipeTowerDialog: use SpinInput control instead of wxSpinCtrl
This commit is contained in:
parent
168dadc0fa
commit
fea655f668
@ -1528,8 +1528,9 @@ void PointCtrl::BUILD()
|
|||||||
y_textctrl->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
y_textctrl->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
if (!wxOSX) y_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
if (!wxOSX) y_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
auto static_text_x = new wxStaticText(m_parent, wxID_ANY, "x : ");
|
wxSize label_sz = wxSize(int(field_size.x / 2), field_size.y);
|
||||||
auto static_text_y = new wxStaticText(m_parent, wxID_ANY, " y : ");
|
auto static_text_x = new wxStaticText(m_parent, wxID_ANY, "x : ", wxDefaultPosition, label_sz, wxALIGN_RIGHT);
|
||||||
|
auto static_text_y = new wxStaticText(m_parent, wxID_ANY, "y : ", wxDefaultPosition, label_sz, wxALIGN_RIGHT);
|
||||||
static_text_x->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
static_text_x->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
static_text_x->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
static_text_x->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
static_text_y->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
static_text_y->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
@ -1540,9 +1541,9 @@ void PointCtrl::BUILD()
|
|||||||
wxGetApp().UpdateDarkUI(static_text_x, false, true);
|
wxGetApp().UpdateDarkUI(static_text_x, false, true);
|
||||||
wxGetApp().UpdateDarkUI(static_text_y, false, true);
|
wxGetApp().UpdateDarkUI(static_text_y, false, true);
|
||||||
|
|
||||||
temp->Add(static_text_x, 0, wxALIGN_CENTER_VERTICAL, 0);
|
temp->Add(static_text_x);
|
||||||
temp->Add(x_textctrl);
|
temp->Add(x_textctrl);
|
||||||
temp->Add(static_text_y, 0, wxALIGN_CENTER_VERTICAL, 0);
|
temp->Add(static_text_y);
|
||||||
temp->Add(y_textctrl);
|
temp->Add(y_textctrl);
|
||||||
|
|
||||||
x_textctrl->Bind(wxEVT_TEXT_ENTER, ([this](wxCommandEvent e) { propagate_value(x_textctrl); }), x_textctrl->GetId());
|
x_textctrl->Bind(wxEVT_TEXT_ENTER, ([this](wxCommandEvent e) { propagate_value(x_textctrl); }), x_textctrl->GetId());
|
||||||
|
@ -1094,6 +1094,17 @@ void PreferencesDialog::create_settings_mode_color_widget()
|
|||||||
append_preferences_option_to_searcher(m_optgroup_gui, opt_key, title);
|
append_preferences_option_to_searcher(m_optgroup_gui, opt_key, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int get_max_font_pt_size()
|
||||||
|
{
|
||||||
|
const unsigned disp_count = wxDisplay::GetCount();
|
||||||
|
for (int i = 0; i < disp_count; i++) {
|
||||||
|
const wxRect display_rect = wxDisplay(i).GetGeometry();
|
||||||
|
if (display_rect.width >= 2560 && display_rect.height >= 1440)
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
|
||||||
void PreferencesDialog::create_settings_font_widget()
|
void PreferencesDialog::create_settings_font_widget()
|
||||||
{
|
{
|
||||||
wxWindow* parent = m_optgroup_other->parent();
|
wxWindow* parent = m_optgroup_other->parent();
|
||||||
@ -1114,7 +1125,7 @@ void PreferencesDialog::create_settings_font_widget()
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
| wxBORDER_SIMPLE
|
| wxBORDER_SIMPLE
|
||||||
#endif
|
#endif
|
||||||
, 8, 20);
|
, 8, get_max_font_pt_size());
|
||||||
wxGetApp().UpdateDarkUI(size_sc);
|
wxGetApp().UpdateDarkUI(size_sc);
|
||||||
|
|
||||||
auto apply_font = [this, font_example, opt_key, stb_sizer](const int val, const wxFont& font) {
|
auto apply_font = [this, font_example, opt_key, stb_sizer](const int val, const wxFont& font) {
|
||||||
|
@ -23,8 +23,14 @@ StaticBox::StaticBox()
|
|||||||
, radius(8)
|
, radius(8)
|
||||||
{
|
{
|
||||||
border_color = StateColor(std::make_pair(clr_border_disabled, (int) StateColor::Disabled),
|
border_color = StateColor(std::make_pair(clr_border_disabled, (int) StateColor::Disabled),
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
std::make_pair(clr_border_nornal, (int) StateColor::Focused),
|
||||||
|
#endif
|
||||||
std::make_pair(clr_border_hovered, (int) StateColor::Hovered),
|
std::make_pair(clr_border_hovered, (int) StateColor::Hovered),
|
||||||
std::make_pair(clr_border_nornal, (int) StateColor::Normal));
|
std::make_pair(clr_border_nornal, (int) StateColor::Normal));
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
border_color.setTakeFocusedAsHovered(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticBox::StaticBox(wxWindow* parent,
|
StaticBox::StaticBox(wxWindow* parent,
|
||||||
|
@ -15,17 +15,20 @@
|
|||||||
|
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
|
|
||||||
int scale(const int val) { return val * Slic3r::GUI::wxGetApp().em_unit(); }
|
using namespace Slic3r::GUI;
|
||||||
|
|
||||||
|
int scale(const int val) { return val * wxGetApp().em_unit(); }
|
||||||
int ITEM_WIDTH() { return scale(6); }
|
int ITEM_WIDTH() { return scale(6); }
|
||||||
|
|
||||||
static void update_ui(wxWindow* window)
|
static void update_ui(wxWindow* window)
|
||||||
{
|
{
|
||||||
Slic3r::GUI::wxGetApp().UpdateDarkUI(window);
|
wxGetApp().UpdateDarkUI(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters)
|
RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters)
|
||||||
: wxDialog(parent, wxID_ANY, _(L("Ramming customization")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/)
|
: wxDialog(parent, wxID_ANY, _(L("Ramming customization")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/)
|
||||||
{
|
{
|
||||||
|
SetFont(wxGetApp().normal_font());
|
||||||
update_ui(this);
|
update_ui(this);
|
||||||
m_panel_ramming = new RammingPanel(this,parameters);
|
m_panel_ramming = new RammingPanel(this,parameters);
|
||||||
|
|
||||||
@ -43,8 +46,8 @@ RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters)
|
|||||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
main_sizer->Add(m_panel_ramming, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5);
|
main_sizer->Add(m_panel_ramming, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5);
|
||||||
auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL);
|
auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL);
|
||||||
Slic3r::GUI::wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton());
|
wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton());
|
||||||
Slic3r::GUI::wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton());
|
wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton());
|
||||||
main_sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxBOTTOM, 10);
|
main_sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxBOTTOM, 10);
|
||||||
SetSizer(main_sizer);
|
SetSizer(main_sizer);
|
||||||
main_sizer->SetSizeHints(this);
|
main_sizer->SetSizeHints(this);
|
||||||
@ -59,8 +62,7 @@ RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters)
|
|||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
},wxID_OK);
|
},wxID_OK);
|
||||||
this->Show();
|
this->Show();
|
||||||
// wxMessageDialog dlg(this, _(L("Ramming denotes the rapid extrusion just before a tool change in a single-extruder MM printer. Its purpose is to "
|
MessageDialog dlg(this, _(L("Ramming denotes the rapid extrusion just before a tool change in a single-extruder MM printer. Its purpose is to "
|
||||||
Slic3r::GUI::MessageDialog dlg(this, _(L("Ramming denotes the rapid extrusion just before a tool change in a single-extruder MM printer. Its purpose is to "
|
|
||||||
"properly shape the end of the unloaded filament so it does not prevent insertion of the new filament and can itself "
|
"properly shape the end of the unloaded filament so it does not prevent insertion of the new filament and can itself "
|
||||||
"be reinserted later. This phase is important and different materials can require different extrusion speeds to get "
|
"be reinserted later. This phase is important and different materials can require different extrusion speeds to get "
|
||||||
"the good shape. For this reason, the extrusion rates during ramming are adjustable.\n\nThis is an expert-level "
|
"the good shape. For this reason, the extrusion rates during ramming are adjustable.\n\nThis is an expert-level "
|
||||||
@ -108,9 +110,9 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters)
|
|||||||
sizer_chart->Add(m_chart, 0, wxALL, 5);
|
sizer_chart->Add(m_chart, 0, wxALL, 5);
|
||||||
|
|
||||||
m_widget_time = new wxSpinCtrlDouble(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,0.,5.0,3.,0.5);
|
m_widget_time = new wxSpinCtrlDouble(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,0.,5.0,3.,0.5);
|
||||||
m_widget_volume = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,0,10000,0);
|
m_widget_volume = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,0,10000,0);
|
||||||
m_widget_ramming_line_width_multiplicator = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,10,200,100);
|
m_widget_ramming_line_width_multiplicator = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,10,200,100);
|
||||||
m_widget_ramming_step_multiplicator = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,10,200,100);
|
m_widget_ramming_step_multiplicator = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,10,200,100);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
update_ui(m_widget_time->GetText());
|
update_ui(m_widget_time->GetText());
|
||||||
@ -181,10 +183,11 @@ std::string RammingPanel::get_parameters()
|
|||||||
WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours)
|
WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours)
|
||||||
: wxDialog(parent, wxID_ANY, _(L("Wipe tower - Purging volume adjustment")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/)
|
: wxDialog(parent, wxID_ANY, _(L("Wipe tower - Purging volume adjustment")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/)
|
||||||
{
|
{
|
||||||
|
SetFont(wxGetApp().normal_font());
|
||||||
update_ui(this);
|
update_ui(this);
|
||||||
auto widget_button = new wxButton(this,wxID_ANY,"-",wxPoint(0,0),wxDefaultSize);
|
auto widget_button = new wxButton(this,wxID_ANY,"-",wxPoint(0,0),wxDefaultSize);
|
||||||
update_ui(widget_button);
|
update_ui(widget_button);
|
||||||
Slic3r::GUI::wxGetApp().SetWindowVariantForButton(widget_button);
|
wxGetApp().SetWindowVariantForButton(widget_button);
|
||||||
m_panel_wiping = new WipingPanel(this,matrix,extruders, extruder_colours, widget_button);
|
m_panel_wiping = new WipingPanel(this,matrix,extruders, extruder_colours, widget_button);
|
||||||
|
|
||||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
@ -196,8 +199,8 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, c
|
|||||||
main_sizer->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5);
|
main_sizer->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5);
|
||||||
main_sizer->Add(widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 5);
|
main_sizer->Add(widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 5);
|
||||||
auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL);
|
auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL);
|
||||||
Slic3r::GUI::wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton());
|
wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton());
|
||||||
Slic3r::GUI::wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton());
|
wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton());
|
||||||
main_sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10);
|
main_sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10);
|
||||||
SetSizer(main_sizer);
|
SetSizer(main_sizer);
|
||||||
main_sizer->SetSizeHints(this);
|
main_sizer->SetSizeHints(this);
|
||||||
@ -321,9 +324,9 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
|||||||
gridsizer_simple->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString(_(L("unloaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL);
|
gridsizer_simple->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString(_(L("unloaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL);
|
||||||
gridsizer_simple->Add(new wxStaticText(m_page_simple,wxID_ANY,wxString(_(L("loaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL);
|
gridsizer_simple->Add(new wxStaticText(m_page_simple,wxID_ANY,wxString(_(L("loaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL);
|
||||||
|
|
||||||
auto add_spin_ctrl = [this](std::vector<wxSpinCtrl*>& vec, float initial)
|
auto add_spin_ctrl = [this](std::vector<::SpinInput*>& vec, float initial)
|
||||||
{
|
{
|
||||||
wxSpinCtrl* spin_ctrl = new wxSpinCtrl(m_page_simple, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(ITEM_WIDTH(), -1), style | wxALIGN_RIGHT, 0, 300, (int)initial);
|
::SpinInput* spin_ctrl = new ::SpinInput(m_page_simple, "", wxEmptyString, wxDefaultPosition, wxSize(ITEM_WIDTH(), -1), style | wxALIGN_RIGHT, 0, 300, (int)initial);
|
||||||
update_ui(spin_ctrl);
|
update_ui(spin_ctrl);
|
||||||
vec.push_back(spin_ctrl);
|
vec.push_back(spin_ctrl);
|
||||||
|
|
||||||
@ -451,8 +454,7 @@ bool WipingPanel::advanced_matches_simple() {
|
|||||||
// Switches the dialog from simple to advanced mode and vice versa
|
// Switches the dialog from simple to advanced mode and vice versa
|
||||||
void WipingPanel::toggle_advanced(bool user_action) {
|
void WipingPanel::toggle_advanced(bool user_action) {
|
||||||
if (m_advanced && !advanced_matches_simple() && user_action) {
|
if (m_advanced && !advanced_matches_simple() && user_action) {
|
||||||
// if (wxMessageDialog(this,wxString(_(L("Switching to simple settings will discard changes done in the advanced mode!\n\nDo you want to proceed?"))),
|
if (MessageDialog(this, _L("Switching to simple settings will discard changes done in the advanced mode!\n\nDo you want to proceed?"),
|
||||||
if (Slic3r::GUI::MessageDialog(this, _L("Switching to simple settings will discard changes done in the advanced mode!\n\nDo you want to proceed?"),
|
|
||||||
_L("Warning"),wxYES_NO|wxICON_EXCLAMATION).ShowModal() != wxID_YES)
|
_L("Warning"),wxYES_NO|wxICON_EXCLAMATION).ShowModal() != wxID_YES)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
|
|
||||||
#include "RammingChart.hpp"
|
#include "RammingChart.hpp"
|
||||||
|
#include "Widgets/SpinInput.hpp"
|
||||||
|
|
||||||
|
|
||||||
class RammingPanel : public wxPanel {
|
class RammingPanel : public wxPanel {
|
||||||
@ -22,9 +23,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Chart* m_chart = nullptr;
|
Chart* m_chart = nullptr;
|
||||||
wxSpinCtrl* m_widget_volume = nullptr;
|
::SpinInput* m_widget_volume = nullptr;
|
||||||
wxSpinCtrl* m_widget_ramming_line_width_multiplicator = nullptr;
|
::SpinInput* m_widget_ramming_line_width_multiplicator = nullptr;
|
||||||
wxSpinCtrl* m_widget_ramming_step_multiplicator = nullptr;
|
::SpinInput* m_widget_ramming_step_multiplicator = nullptr;
|
||||||
wxSpinCtrlDouble* m_widget_time = nullptr;
|
wxSpinCtrlDouble* m_widget_time = nullptr;
|
||||||
int m_ramming_step_multiplicator;
|
int m_ramming_step_multiplicator;
|
||||||
int m_ramming_line_width_multiplicator;
|
int m_ramming_line_width_multiplicator;
|
||||||
@ -60,8 +61,8 @@ private:
|
|||||||
void fill_in_matrix();
|
void fill_in_matrix();
|
||||||
bool advanced_matches_simple();
|
bool advanced_matches_simple();
|
||||||
|
|
||||||
std::vector<wxSpinCtrl*> m_old;
|
std::vector<::SpinInput*> m_old;
|
||||||
std::vector<wxSpinCtrl*> m_new;
|
std::vector<::SpinInput*> m_new;
|
||||||
std::vector<std::vector<wxTextCtrl*>> edit_boxes;
|
std::vector<std::vector<wxTextCtrl*>> edit_boxes;
|
||||||
std::vector<wxColour> m_colours;
|
std::vector<wxColour> m_colours;
|
||||||
unsigned int m_number_of_extruders = 0;
|
unsigned int m_number_of_extruders = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user