mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-25 09:41:11 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_gcode_viewer
This commit is contained in:
commit
ed252f1741
24 changed files with 209 additions and 17 deletions
|
|
@ -306,6 +306,12 @@ void Field::msw_rescale(bool rescale_sidetext)
|
|||
}
|
||||
}
|
||||
|
||||
void Field::sys_color_changed()
|
||||
{
|
||||
m_Undo_to_sys_btn->msw_rescale();
|
||||
m_Undo_btn->msw_rescale();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -221,6 +221,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void msw_rescale(bool rescale_sidetext = false);
|
||||
void sys_color_changed();
|
||||
|
||||
bool get_enter_pressed() const { return bEnterPressed; }
|
||||
void set_enter_pressed(bool pressed) { bEnterPressed = pressed; }
|
||||
|
|
|
|||
|
|
@ -4947,7 +4947,7 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
return false;
|
||||
|
||||
item.name = "settings";
|
||||
item.icon_filename = "cog.svg";
|
||||
item.icon_filename = "cog_.svg";
|
||||
item.tooltip = _u8L("Switch to Settings") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") +
|
||||
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) +
|
||||
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
|
||||
|
|
@ -5554,6 +5554,7 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() const
|
|||
m_main_toolbar.set_scale(sc);
|
||||
m_undoredo_toolbar.set_scale(sc);
|
||||
m_collapse_toolbar.set_scale(sc);
|
||||
size *= m_retina_helper->get_scale_factor();
|
||||
#else
|
||||
m_main_toolbar.set_icons_size(size);
|
||||
m_undoredo_toolbar.set_icons_size(size);
|
||||
|
|
@ -5574,6 +5575,9 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() const
|
|||
|
||||
// set minimum scale as a auto scale for the toolbars
|
||||
float new_scale = std::min(new_h_scale, new_v_scale);
|
||||
#if ENABLE_RETINA_GL
|
||||
new_scale /= m_retina_helper->get_scale_factor();
|
||||
#endif
|
||||
if (fabs(new_scale - scale) > 0.01) // scale is changed by 1% and more
|
||||
wxGetApp().set_auto_toolbar_icon_scale(new_scale);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -580,6 +580,11 @@ void GUI_App::set_label_clr_sys(const wxColour& clr) {
|
|||
app_config->save();
|
||||
}
|
||||
|
||||
wxSize GUI_App::get_min_size() const
|
||||
{
|
||||
return wxSize(76*m_em_unit, 49 * m_em_unit);
|
||||
}
|
||||
|
||||
float GUI_App::toolbar_icon_scale(const bool is_limited/* = false*/) const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ public:
|
|||
const wxFont& bold_font() { return m_bold_font; }
|
||||
const wxFont& normal_font() { return m_normal_font; }
|
||||
int em_unit() const { return m_em_unit; }
|
||||
wxSize get_min_size() const;
|
||||
float toolbar_icon_scale(const bool is_limited = false) const;
|
||||
void set_auto_toolbar_icon_scale(float scale) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -272,6 +272,33 @@ void ObjectLayers::msw_rescale()
|
|||
m_grid_sizer->Layout();
|
||||
}
|
||||
|
||||
void ObjectLayers::sys_color_changed()
|
||||
{
|
||||
m_bmp_delete.msw_rescale();
|
||||
m_bmp_add.msw_rescale();
|
||||
|
||||
m_grid_sizer->SetHGap(wxGetApp().em_unit());
|
||||
|
||||
// rescale edit-boxes
|
||||
const int cells_cnt = m_grid_sizer->GetCols() * m_grid_sizer->GetEffectiveRowsCount();
|
||||
for (int i = 0; i < cells_cnt; i++)
|
||||
{
|
||||
const wxSizerItem* item = m_grid_sizer->GetItem(i);
|
||||
if (item->IsSizer()) {// case when we have editor with buttons
|
||||
const std::vector<size_t> btns = {2, 3}; // del_btn, add_btn
|
||||
for (auto btn : btns) {
|
||||
wxSizerItem* b_item = item->GetSizer()->GetItem(btn);
|
||||
if (b_item->IsWindow()) {
|
||||
auto button = dynamic_cast<PlusMinusButton*>(b_item->GetWindow());
|
||||
if (button != nullptr)
|
||||
button->msw_rescale();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_grid_sizer->Layout();
|
||||
}
|
||||
|
||||
void ObjectLayers::reset_selection()
|
||||
{
|
||||
m_selectable_range = { 0.0, 0.0 };
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ public:
|
|||
|
||||
void UpdateAndShow(const bool show) override;
|
||||
void msw_rescale();
|
||||
void sys_color_changed();
|
||||
void reset_selection();
|
||||
void set_selectable_range(const t_layer_height_range& range) { m_selectable_range = range; }
|
||||
|
||||
|
|
|
|||
|
|
@ -417,6 +417,8 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
|||
m_main_grid_sizer->Add(editors_grid_sizer, 1, wxEXPAND);
|
||||
|
||||
m_check_inch = new wxCheckBox(parent, wxID_ANY, "Inches");
|
||||
m_check_inch->SetFont(wxGetApp().normal_font());
|
||||
|
||||
m_check_inch->SetValue(m_imperial_units);
|
||||
m_check_inch->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) {
|
||||
wxGetApp().app_config->set("use_inches", m_check_inch->GetValue() ? "1" : "0");
|
||||
|
|
@ -995,7 +997,7 @@ void ObjectManipulation::sys_color_changed()
|
|||
for (int id = 0; id < 3; ++id)
|
||||
m_mirror_buttons[id].first->msw_rescale();
|
||||
|
||||
get_og()->msw_rescale();
|
||||
get_og()->sys_color_changed();
|
||||
}
|
||||
|
||||
static const char axes[] = { 'x', 'y', 'z' };
|
||||
|
|
|
|||
|
|
@ -89,6 +89,19 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
|||
|
||||
m_loaded = true;
|
||||
|
||||
#ifdef __APPLE__
|
||||
// Using SetMinSize() on Mac messes up the window position in some cases
|
||||
// cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0
|
||||
// So, if we haven't possibility to set MinSize() for the MainFrame,
|
||||
// set the MinSize() as a half of regular for the m_plater and m_tabpanel, when settings layout is in slNew mode
|
||||
// Otherwise, MainFrame will be maximized by height
|
||||
if (slNew) {
|
||||
wxSize size = wxGetApp().get_min_size();
|
||||
size.SetHeight(int(0.5*size.GetHeight()));
|
||||
m_plater->SetMinSize(size);
|
||||
m_tabpanel->SetMinSize(size);
|
||||
}
|
||||
#endif
|
||||
// initialize layout
|
||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||
if (m_plater && m_layout != slOld)
|
||||
|
|
@ -101,7 +114,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
|||
SetSizer(sizer);
|
||||
Fit();
|
||||
|
||||
const wxSize min_size = wxSize(76*wxGetApp().em_unit(), 49*wxGetApp().em_unit());
|
||||
const wxSize min_size = wxGetApp().get_min_size(); //wxSize(76*wxGetApp().em_unit(), 49*wxGetApp().em_unit());
|
||||
#ifdef __APPLE__
|
||||
// Using SetMinSize() on Mac messes up the window position in some cases
|
||||
// cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0
|
||||
|
|
@ -1471,7 +1484,7 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe)
|
|||
|
||||
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10
|
||||
// with multiple high resolution displays connected.
|
||||
m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||
m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxGetApp().get_min_size(), wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
|
||||
m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ void ObjectDataViewModelNode::update_settings_digest_bitmaps()
|
|||
std::map<std::string, wxBitmap>& categories_icon = Slic3r::GUI::wxGetApp().obj_list()->CATEGORY_ICON;
|
||||
|
||||
std::string scaled_bitmap_name = m_name.ToUTF8().data();
|
||||
scaled_bitmap_name += "-em" + std::to_string(Slic3r::GUI::wxGetApp().em_unit());
|
||||
scaled_bitmap_name += "-em" + std::to_string(wxGetApp().em_unit()) + (wxGetApp().dark_mode() ? "-dm" : "");
|
||||
|
||||
wxBitmap *bmp = m_bitmap_cache->find(scaled_bitmap_name);
|
||||
if (bmp == nullptr) {
|
||||
|
|
|
|||
|
|
@ -568,6 +568,18 @@ void ConfigOptionsGroup::msw_rescale()
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigOptionsGroup::sys_color_changed()
|
||||
{
|
||||
// update bitmaps for near label widgets (like "Set uniform scale" button on settings panel)
|
||||
if (rescale_near_label_widget)
|
||||
for (auto near_label_widget : m_near_label_widget_ptrs)
|
||||
rescale_near_label_widget(near_label_widget);
|
||||
|
||||
// update undo buttons : rescale bitmaps
|
||||
for (const auto& field : m_fields)
|
||||
field.second->sys_color_changed();
|
||||
}
|
||||
|
||||
boost::any ConfigOptionsGroup::config_value(const std::string& opt_key, int opt_index, bool deserialize) {
|
||||
|
||||
if (deserialize) {
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ public:
|
|||
void Show(const bool show);
|
||||
bool update_visibility(ConfigOptionMode mode);
|
||||
void msw_rescale();
|
||||
void sys_color_changed();
|
||||
boost::any config_value(const std::string& opt_key, int opt_index, bool deserialize);
|
||||
// return option value from config
|
||||
boost::any get_config_value(const DynamicPrintConfig& config, const std::string& opt_key, int opt_index = -1);
|
||||
|
|
|
|||
|
|
@ -773,7 +773,9 @@ Sidebar::Sidebar(Plater *parent)
|
|||
p->scrolled->SetScrollbars(0, 100, 1, 2);
|
||||
|
||||
SetFont(wxGetApp().normal_font());
|
||||
#ifndef __APPLE__
|
||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
#endif
|
||||
|
||||
// Sizer in the scrolled area
|
||||
auto *scrolled_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
|
@ -1110,7 +1112,7 @@ void Sidebar::sys_color_changed()
|
|||
p->object_list->sys_color_changed();
|
||||
p->object_manipulation->sys_color_changed();
|
||||
// p->object_settings->msw_rescale();
|
||||
// p->object_layers->msw_rescale();
|
||||
p->object_layers->sys_color_changed();
|
||||
|
||||
// btn...->msw_rescale() updates icon on button, so use it
|
||||
p->btn_send_gcode->msw_rescale();
|
||||
|
|
@ -4382,7 +4384,7 @@ void Sidebar::set_btn_label(const ActionButtonType btn_type, const wxString& lab
|
|||
// Plater / Public
|
||||
|
||||
Plater::Plater(wxWindow *parent, MainFrame *main_frame)
|
||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(76 * wxGetApp().em_unit(), 49 * wxGetApp().em_unit()))
|
||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxGetApp().get_min_size())
|
||||
, p(new priv(this, main_frame))
|
||||
{
|
||||
// Initialization performed in the private c-tor
|
||||
|
|
|
|||
|
|
@ -190,15 +190,13 @@ void Tab::create_preset_tab()
|
|||
add_scaled_button(panel, &m_search_btn, "search");
|
||||
m_search_btn->SetToolTip(format_wxstr(_L("Click to start a search or use %1% shortcut"), "Ctrl+F"));
|
||||
|
||||
// Determine the theme color of OS (dark or light)
|
||||
auto luma = wxGetApp().get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
// Bitmaps to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
|
||||
add_scaled_bitmap(this, m_bmp_value_lock , luma >= 128 ? "lock_closed" : "lock_closed_white");
|
||||
add_scaled_bitmap(this, m_bmp_value_lock , "lock_closed");
|
||||
add_scaled_bitmap(this, m_bmp_value_unlock, "lock_open");
|
||||
m_bmp_non_system = &m_bmp_white_bullet;
|
||||
// Bitmaps to be shown on the "Undo user changes" button next to each input field.
|
||||
add_scaled_bitmap(this, m_bmp_value_revert, "undo");
|
||||
add_scaled_bitmap(this, m_bmp_white_bullet, luma >= 128 ? "dot" : "dot_white");
|
||||
add_scaled_bitmap(this, m_bmp_white_bullet, "dot");
|
||||
|
||||
fill_icon_descriptions();
|
||||
set_tooltips_text();
|
||||
|
|
@ -597,7 +595,7 @@ void TabPrinter::sys_color_changed()
|
|||
// update missed options_groups
|
||||
const std::vector<PageShp>& pages = m_printer_technology == ptFFF ? m_pages_sla : m_pages_fff;
|
||||
for (auto page : pages)
|
||||
page->msw_rescale();
|
||||
page->sys_color_changed();
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
|
@ -890,8 +888,8 @@ void Tab::sys_color_changed()
|
|||
btn->msw_rescale();
|
||||
for (const auto bmp : m_scaled_bitmaps)
|
||||
bmp->msw_rescale();
|
||||
for (ScalableBitmap& bmp : m_mode_bitmap_cache)
|
||||
bmp.msw_rescale();
|
||||
// for (ScalableBitmap& bmp : m_mode_bitmap_cache)
|
||||
// bmp.msw_rescale();
|
||||
|
||||
// update icons for tree_ctrl
|
||||
for (ScalableBitmap& bmp : m_scaled_icons_list)
|
||||
|
|
@ -903,7 +901,6 @@ void Tab::sys_color_changed()
|
|||
m_icons->Add(bmp.bmp());
|
||||
m_treectrl->AssignImageList(m_icons);
|
||||
|
||||
|
||||
// Colors for ui "decoration"
|
||||
m_sys_label_clr = wxGetApp().get_label_clr_sys();
|
||||
m_modified_label_clr = wxGetApp().get_label_clr_modified();
|
||||
|
|
@ -911,7 +908,7 @@ void Tab::sys_color_changed()
|
|||
|
||||
// update options_groups
|
||||
for (auto page : m_pages)
|
||||
page->msw_rescale();
|
||||
page->sys_color_changed();
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
|
@ -3606,6 +3603,12 @@ void Page::msw_rescale()
|
|||
group->msw_rescale();
|
||||
}
|
||||
|
||||
void Page::sys_color_changed()
|
||||
{
|
||||
for (auto group : m_optgroups)
|
||||
group->sys_color_changed();
|
||||
}
|
||||
|
||||
Field* Page::get_field(const t_config_option_key& opt_key, int opt_index /*= -1*/) const
|
||||
{
|
||||
Field* field = nullptr;
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ public:
|
|||
void reload_config();
|
||||
void update_visibility(ConfigOptionMode mode);
|
||||
void msw_rescale();
|
||||
void sys_color_changed();
|
||||
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
|
||||
bool set_value(const t_config_option_key& opt_key, const boost::any& value);
|
||||
ConfigOptionsGroupShp new_optgroup(const wxString& title, int noncommon_label_width = -1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue