FIX: dark mode in filament group pop up

1.Also modify some tips

jira: NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I4e2abfe24afdf7f0d728a486aa248b8e5accbdf4
This commit is contained in:
xun.zhang 2025-03-13 11:12:53 +08:00 committed by lane.wei
parent dc1bac6b6c
commit 98dad923f8
5 changed files with 28 additions and 18 deletions

View File

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="8" cy="8" r="7.5" fill="#F2F2F2" stroke="#DBDBDB"/>
<circle cx="8" cy="8" r="7.5" fill="#F1F1F1" stroke="#DBDBDB"/>
</svg>

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 167 B

View File

@ -333,6 +333,8 @@ wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_
replaces["\"#6B6B6B\""] = "\"#818182\"";
replaces["\"#909090\""] = "\"#FFFFFF\"";
replaces["\"#00FF00\""] = "\"#FF0000\"";
replaces["\"#F1F1F1\""] = "\"#36363B\"";
replaces["\"#DBDBDB\""] = "\"#4A4A51\"";
}
if (!new_color.empty())
replaces["\"#00AE42\""] = "\"" + new_color + "\"";

View File

@ -90,6 +90,14 @@ bool open_filament_group_wiki()
return false;
}
void FilamentGroupPopup::CreateBmps()
{
checked_bmp = create_scaled_bitmap("map_mode_on", nullptr, 16);;
unchecked_bmp = create_scaled_bitmap("map_mode_off", nullptr, 16);
disabled_bmp = create_scaled_bitmap("map_mode_disabled", nullptr, 16);
checked_hover_bmp = create_scaled_bitmap("map_mode_on_hovered", nullptr, 16);
unchecked_hover_bmp = create_scaled_bitmap("map_mode_off_hovered", nullptr, 16);
}
FilamentGroupPopup::FilamentGroupPopup(wxWindow *parent) : PopupWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS)
{
@ -125,12 +133,7 @@ FilamentGroupPopup::FilamentGroupPopup(wxWindow *parent) : PopupWindow(parent, w
std::vector<wxString> mode_details = {AutoForFlushDetail, AutoForMatchDetail, ManualDetail};
top_sizer->AddSpacer(vertical_margin);
checked_bmp = create_scaled_bitmap("map_mode_on", nullptr, 16);;
unchecked_bmp = create_scaled_bitmap("map_mode_off", nullptr, 16);
disabled_bmp = create_scaled_bitmap("map_mode_disabled", nullptr, 16);
checked_hover_bmp = create_scaled_bitmap("map_mode_on_hovered", nullptr, 16);
unchecked_hover_bmp = create_scaled_bitmap("map_mode_off_hovered", nullptr, 16);
global_tag_bmp = create_scaled_bitmap("global_map_mode_tag", nullptr, 16);
CreateBmps();
for (size_t idx = 0; idx < ButtonType::btCount; ++idx) {
wxBoxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL);
@ -247,10 +250,15 @@ void FilamentGroupPopup::DrawRoundedCorner(int radius)
void FilamentGroupPopup::Init()
{
static bool is_dark_mode = wxGetApp().dark_mode();
if (is_dark_mode != wxGetApp().dark_mode()) {
CreateBmps();
is_dark_mode = wxGetApp().dark_mode();
}
const wxString AutoForMatchDesp = "";// _L("(Pre-slicing arrangement)");
const wxString MachineSyncTip = _L("(Sync with printer)");
radio_btns[ButtonType::btForMatch]->Enable(m_connected);
if (m_connected) {
button_labels[ButtonType::btForMatch]->SetForegroundColour(LabelEnableColor);
button_desps[ButtonType::btForMatch]->SetForegroundColour(LabelEnableColor);
@ -376,7 +384,6 @@ void FilamentGroupPopup::OnEnterWindow(wxMouseEvent &) { ResetTimer(); }
void FilamentGroupPopup::UpdateButtonStatus(int hover_idx)
{
auto global_mode = plater_ref->get_global_filament_map_mode();
for (int i = 0; i < ButtonType::btCount; ++i) {
#if 0 // do not display global mode tag
if (mode_list.at(i) == global_mode)

View File

@ -32,6 +32,8 @@ private:
void OnTimer(wxTimerEvent &event);
void Dismiss();
void CreateBmps();
void Init();
void UpdateButtonStatus(int hover_idx = -1);
void DrawRoundedCorner(int radius);
@ -53,7 +55,6 @@ private:
wxTimer *m_timer;
std::vector<wxBitmapButton*> radio_btns;
std::vector<wxBitmapButton*> global_mode_tags;
std::vector<Label *> button_labels;
std::vector<Label *> button_desps;
std::vector<Label *> detail_infos;

View File

@ -4800,12 +4800,12 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
int tips_count = 8;
if (any_more_to_best) {
tips_count = 8;
if (!all_more_to_best)
if (wxGetApp().app_config->get("language") != "zh_CN")
tips_count += 1;
}
else if (any_less_to_single_ext) {
tips_count = 6;
if (!all_less_to_single_ext)
if (wxGetApp().app_config->get("language") != "zh_CN")
tips_count += 1;
}
else
@ -4899,15 +4899,15 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
imgui.text(_u8L("Current grouping of slice result is not optimal."));
wxString tip;
if (delta_weight_to_best >= 0 && delta_change_to_best >= 0)
tip = from_u8((boost::format(_u8L("Cost %1%g filament and %2% changes more than optimal grouping."))
tip = from_u8((boost::format(_u8L("Increase %1%g filament and %2% changes compared to optimal grouping."))
% number_format(delta_weight_to_best)
% delta_change_to_best).str());
else if (delta_weight_to_best >= 0 && delta_change_to_best < 0)
tip = from_u8((boost::format(_u8L("Increase %1%g filament and reduce %2% changes compared to optimal grouping."))
tip = from_u8((boost::format(_u8L("Increase %1%g filament and save %2% changes compared to optimal grouping."))
% number_format(delta_weight_to_best)
% std::abs(delta_change_to_best)).str());
else if (delta_weight_to_best < 0 && delta_change_to_best >= 0)
tip = from_u8((boost::format(_u8L("Reduce %1%g filament and increase %2% changes compared to optimal grouping."))
tip = from_u8((boost::format(_u8L("Save %1%g filament and increase %2% changes compared to optimal grouping."))
% number_format(std::abs(delta_weight_to_best))
% delta_change_to_best).str());
@ -4917,15 +4917,15 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
else if (any_less_to_single_ext) {
wxString tip;
if (delta_weight_to_single_ext >= 0 && delta_change_to_single_ext >= 0)
tip = from_u8((boost::format(_u8L("Save %1%g filament and %2% changes than one-nozzle printer."))
tip = from_u8((boost::format(_u8L("Save %1%g filament and %2% changes compared to a printer with one nozzle."))
% number_format(delta_weight_to_single_ext)
% delta_change_to_single_ext).str());
else if (delta_weight_to_single_ext >= 0 && delta_change_to_single_ext < 0)
tip = from_u8((boost::format(_u8L("Reduce %1%g filament and increase %2% changes compared to one-nozzle printer."))
tip = from_u8((boost::format(_u8L("Save %1%g filament and increase %2% changes compared to a printer with one nozzle."))
% number_format(delta_weight_to_single_ext)
% std::abs(delta_change_to_single_ext)).str());
else if (delta_weight_to_single_ext < 0 && delta_change_to_single_ext >= 0)
tip = from_u8((boost::format(_u8L("Increase %1%g filament and reduce %2% changes compared to one-nozzle printer."))
tip = from_u8((boost::format(_u8L("Increase %1%g filament and save %2% changes compared to a printer with one nozzle."))
% number_format(std::abs(delta_weight_to_single_ext))
% delta_change_to_single_ext).str());