mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-07 07:29:06 +08:00
Changed processing of a wxEVT_SYS_COLOUR_CHANGED event.
Only UI is updated. The application doesn't recreated now
This commit is contained in:
parent
4348b177d6
commit
db32c1f15a
@ -4029,6 +4029,26 @@ void ObjectList::msw_rescale()
|
|||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectList::sys_color_changed()
|
||||||
|
{
|
||||||
|
// msw_rescale_icons() updates icons, so use it
|
||||||
|
msw_rescale_icons();
|
||||||
|
|
||||||
|
// update existing items with bitmaps
|
||||||
|
m_objects_model->Rescale();
|
||||||
|
|
||||||
|
// msw_rescale_menu updates just icons, so use it
|
||||||
|
for (MenuWithSeparators* menu : { &m_menu_object,
|
||||||
|
&m_menu_part,
|
||||||
|
&m_menu_sla_object,
|
||||||
|
&m_menu_instance,
|
||||||
|
&m_menu_layer,
|
||||||
|
&m_menu_default})
|
||||||
|
msw_rescale_menu(menu);
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectList::ItemValueChanged(wxDataViewEvent &event)
|
void ObjectList::ItemValueChanged(wxDataViewEvent &event)
|
||||||
{
|
{
|
||||||
if (event.GetColumn() == colName)
|
if (event.GetColumn() == colName)
|
||||||
|
@ -386,6 +386,7 @@ public:
|
|||||||
void paste_objects_into_list(const std::vector<size_t>& object_idxs);
|
void paste_objects_into_list(const std::vector<size_t>& object_idxs);
|
||||||
|
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
|
void sys_color_changed();
|
||||||
|
|
||||||
void update_after_undo_redo();
|
void update_after_undo_redo();
|
||||||
//update printable state for item from objects model
|
//update printable state for item from objects model
|
||||||
|
@ -981,6 +981,23 @@ void ObjectManipulation::msw_rescale()
|
|||||||
get_og()->msw_rescale();
|
get_og()->msw_rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectManipulation::sys_color_changed()
|
||||||
|
{
|
||||||
|
// btn...->msw_rescale() updates icon on button, so use it
|
||||||
|
m_mirror_bitmap_on.msw_rescale();
|
||||||
|
m_mirror_bitmap_off.msw_rescale();
|
||||||
|
m_mirror_bitmap_hidden.msw_rescale();
|
||||||
|
m_reset_scale_button->msw_rescale();
|
||||||
|
m_reset_rotation_button->msw_rescale();
|
||||||
|
m_drop_to_bed_button->msw_rescale();
|
||||||
|
m_lock_bnt->msw_rescale();
|
||||||
|
|
||||||
|
for (int id = 0; id < 3; ++id)
|
||||||
|
m_mirror_buttons[id].first->msw_rescale();
|
||||||
|
|
||||||
|
get_og()->msw_rescale();
|
||||||
|
}
|
||||||
|
|
||||||
static const char axes[] = { 'x', 'y', 'z' };
|
static const char axes[] = { 'x', 'y', 'z' };
|
||||||
ManipulationEditor::ManipulationEditor(ObjectManipulation* parent,
|
ManipulationEditor::ManipulationEditor(ObjectManipulation* parent,
|
||||||
const std::string& opt_key,
|
const std::string& opt_key,
|
||||||
|
@ -173,6 +173,7 @@ public:
|
|||||||
void update_item_name(const wxString &item_name);
|
void update_item_name(const wxString &item_name);
|
||||||
void update_warning_icon_state(const wxString& tooltip);
|
void update_warning_icon_state(const wxString& tooltip);
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
|
void sys_color_changed();
|
||||||
void on_change(const std::string& opt_key, int axis, double new_value);
|
void on_change(const std::string& opt_key, int axis, double new_value);
|
||||||
void set_focused_editor(ManipulationEditor* focused_editor) {
|
void set_focused_editor(ManipulationEditor* focused_editor) {
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
|
@ -124,6 +124,12 @@ public:
|
|||||||
// set value to _true_ in purpose of possibility of a display dpi changing from System Settings
|
// set value to _true_ in purpose of possibility of a display dpi changing from System Settings
|
||||||
m_can_rescale = true;
|
m_can_rescale = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this->Bind(wxEVT_SYS_COLOUR_CHANGED, [this](wxSysColourChangedEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
on_sys_color_changed();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~DPIAware() {}
|
virtual ~DPIAware() {}
|
||||||
@ -137,6 +143,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void on_dpi_changed(const wxRect &suggested_rect) = 0;
|
virtual void on_dpi_changed(const wxRect &suggested_rect) = 0;
|
||||||
|
virtual void on_sys_color_changed() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float m_scale_factor;
|
float m_scale_factor;
|
||||||
|
@ -190,6 +190,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
Bind(wxEVT_SYS_COLOUR_CHANGED, [this](wxSysColourChangedEvent& event)
|
Bind(wxEVT_SYS_COLOUR_CHANGED, [this](wxSysColourChangedEvent& event)
|
||||||
{
|
{
|
||||||
bool recreate_gui = false;
|
bool recreate_gui = false;
|
||||||
@ -210,6 +211,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
|||||||
wxGetApp().recreate_GUI(_L("Changing of an application in respect to the system mode") + dots);
|
wxGetApp().recreate_GUI(_L("Changing of an application in respect to the system mode") + dots);
|
||||||
event.Skip();
|
event.Skip();
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
wxGetApp().persist_window_geometry(this, true);
|
wxGetApp().persist_window_geometry(this, true);
|
||||||
|
|
||||||
@ -575,6 +577,28 @@ void MainFrame::on_dpi_changed(const wxRect &suggested_rect)
|
|||||||
this->Maximize(is_maximized);
|
this->Maximize(is_maximized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainFrame::on_sys_color_changed()
|
||||||
|
{
|
||||||
|
wxBusyCursor wait;
|
||||||
|
|
||||||
|
// update label colors in respect to the system mode
|
||||||
|
wxGetApp().init_label_colours();
|
||||||
|
|
||||||
|
wxGetApp().preset_bundle->load_default_preset_bitmaps();
|
||||||
|
|
||||||
|
// update Plater
|
||||||
|
wxGetApp().plater()->sys_color_changed();
|
||||||
|
|
||||||
|
// update Tabs
|
||||||
|
for (auto tab : wxGetApp().tabs_list)
|
||||||
|
tab->sys_color_changed();
|
||||||
|
|
||||||
|
// msw_rescale_menu updates just icons, so use it
|
||||||
|
wxMenuBar* menu_bar = this->GetMenuBar();
|
||||||
|
for (size_t id = 0; id < menu_bar->GetMenuCount(); id++)
|
||||||
|
msw_rescale_menu(menu_bar->GetMenu(id));
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::init_menubar()
|
void MainFrame::init_menubar()
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -121,6 +121,7 @@ class MainFrame : public DPIFrame
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void on_dpi_changed(const wxRect &suggested_rect);
|
virtual void on_dpi_changed(const wxRect &suggested_rect);
|
||||||
|
virtual void on_sys_color_changed() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainFrame();
|
MainFrame();
|
||||||
|
@ -1090,6 +1090,34 @@ void Sidebar::msw_rescale()
|
|||||||
p->scrolled->Layout();
|
p->scrolled->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sidebar::sys_color_changed()
|
||||||
|
{
|
||||||
|
// Update preset comboboxes in respect to the system color ...
|
||||||
|
// combo->msw_rescale() updates icon on button, so use it
|
||||||
|
for (PresetComboBox* combo : std::vector<PresetComboBox*>{ p->combo_print,
|
||||||
|
p->combo_sla_print,
|
||||||
|
p->combo_sla_material,
|
||||||
|
p->combo_printer })
|
||||||
|
combo->msw_rescale();
|
||||||
|
for (PresetComboBox* combo : p->combos_filament)
|
||||||
|
combo->msw_rescale();
|
||||||
|
|
||||||
|
// ... then refill them and set min size to correct layout of the sidebar
|
||||||
|
update_all_preset_comboboxes();
|
||||||
|
|
||||||
|
p->object_list->sys_color_changed();
|
||||||
|
p->object_manipulation->sys_color_changed();
|
||||||
|
// p->object_settings->msw_rescale();
|
||||||
|
// p->object_layers->msw_rescale();
|
||||||
|
|
||||||
|
// btn...->msw_rescale() updates icon on button, so use it
|
||||||
|
p->btn_send_gcode->msw_rescale();
|
||||||
|
p->btn_remove_device->msw_rescale();
|
||||||
|
p->btn_export_gcode_removable->msw_rescale();
|
||||||
|
|
||||||
|
p->scrolled->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
void Sidebar::search()
|
void Sidebar::search()
|
||||||
{
|
{
|
||||||
p->searcher.search();
|
p->searcher.search();
|
||||||
@ -5475,6 +5503,17 @@ void Plater::msw_rescale()
|
|||||||
GetParent()->Layout();
|
GetParent()->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plater::sys_color_changed()
|
||||||
|
{
|
||||||
|
p->sidebar->sys_color_changed();
|
||||||
|
|
||||||
|
// msw_rescale_menu updates just icons, so use it
|
||||||
|
p->msw_rescale_object_menu();
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
GetParent()->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
bool Plater::init_view_toolbar()
|
bool Plater::init_view_toolbar()
|
||||||
{
|
{
|
||||||
return p->init_view_toolbar();
|
return p->init_view_toolbar();
|
||||||
|
@ -105,6 +105,7 @@ public:
|
|||||||
void update_mode_sizer() const;
|
void update_mode_sizer() const;
|
||||||
void update_reslice_btn_tooltip() const;
|
void update_reslice_btn_tooltip() const;
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
|
void sys_color_changed();
|
||||||
void search();
|
void search();
|
||||||
void jump_to_option(size_t selected);
|
void jump_to_option(size_t selected);
|
||||||
|
|
||||||
@ -308,6 +309,7 @@ public:
|
|||||||
bool can_reload_from_disk() const;
|
bool can_reload_from_disk() const;
|
||||||
|
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
|
void sys_color_changed();
|
||||||
|
|
||||||
bool init_view_toolbar();
|
bool init_view_toolbar();
|
||||||
|
|
||||||
|
@ -668,6 +668,14 @@ void SearchDialog::on_dpi_changed(const wxRect& suggested_rect)
|
|||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchDialog::on_sys_color_changed()
|
||||||
|
{
|
||||||
|
// msw_rescale updates just icons, so use it
|
||||||
|
search_list_model->msw_rescale();
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// SearchListModel
|
// SearchListModel
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -198,6 +198,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||||
|
virtual void on_sys_color_changed() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -590,6 +590,18 @@ void TabPrinter::msw_rescale()
|
|||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabPrinter::sys_color_changed()
|
||||||
|
{
|
||||||
|
Tab::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();
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
void TabSLAMaterial::init_options_list()
|
void TabSLAMaterial::init_options_list()
|
||||||
{
|
{
|
||||||
if (!m_options_list.empty())
|
if (!m_options_list.empty())
|
||||||
@ -869,6 +881,41 @@ void Tab::msw_rescale()
|
|||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Tab::sys_color_changed()
|
||||||
|
{
|
||||||
|
update_tab_ui();
|
||||||
|
|
||||||
|
// update buttons and cached bitmaps
|
||||||
|
for (const auto btn : m_scaled_buttons)
|
||||||
|
btn->msw_rescale();
|
||||||
|
for (const auto bmp : m_scaled_bitmaps)
|
||||||
|
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)
|
||||||
|
bmp.msw_rescale();
|
||||||
|
// recreate and set new ImageList for tree_ctrl
|
||||||
|
m_icons->RemoveAll();
|
||||||
|
m_icons = new wxImageList(m_scaled_icons_list.front().bmp().GetWidth(), m_scaled_icons_list.front().bmp().GetHeight());
|
||||||
|
for (ScalableBitmap& bmp : m_scaled_icons_list)
|
||||||
|
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();
|
||||||
|
update_labels_colour();
|
||||||
|
|
||||||
|
// update options_groups
|
||||||
|
for (auto page : m_pages)
|
||||||
|
page->msw_rescale();
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
Field* Tab::get_field(const t_config_option_key& opt_key, int opt_index/* = -1*/) const
|
Field* Tab::get_field(const t_config_option_key& opt_key, int opt_index/* = -1*/) const
|
||||||
{
|
{
|
||||||
Field* field = nullptr;
|
Field* field = nullptr;
|
||||||
|
@ -318,6 +318,7 @@ public:
|
|||||||
void update_mode();
|
void update_mode();
|
||||||
void update_visibility();
|
void update_visibility();
|
||||||
virtual void msw_rescale();
|
virtual void msw_rescale();
|
||||||
|
virtual void sys_color_changed();
|
||||||
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
|
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
|
||||||
Field* get_field(const t_config_option_key &opt_key, Page** selected_page, int opt_index = -1);
|
Field* get_field(const t_config_option_key &opt_key, Page** selected_page, int opt_index = -1);
|
||||||
bool set_value(const t_config_option_key& opt_key, const boost::any& value);
|
bool set_value(const t_config_option_key& opt_key, const boost::any& value);
|
||||||
@ -436,6 +437,7 @@ public:
|
|||||||
void on_preset_loaded() override;
|
void on_preset_loaded() override;
|
||||||
void init_options_list() override;
|
void init_options_list() override;
|
||||||
void msw_rescale() override;
|
void msw_rescale() override;
|
||||||
|
void sys_color_changed() override;
|
||||||
bool supports_printer_technology(const PrinterTechnology /* tech */) override { return true; }
|
bool supports_printer_technology(const PrinterTechnology /* tech */) override { return true; }
|
||||||
|
|
||||||
wxSizer* create_bed_shape_widget(wxWindow* parent);
|
wxSizer* create_bed_shape_widget(wxWindow* parent);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user