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
(cherry picked from commit 98dad923f8ee3001add10837a9b0a6c1507b47e0)
This commit is contained in:
xun.zhang
2025-03-13 11:12:53 +08:00
committed by Noisyfox
parent 9cdabfbd59
commit 5880625b9c
5 changed files with 27 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

@@ -336,6 +336,7 @@ wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_
replaces["\"#909090\""] = "\"#FFFFFF\"";
replaces["\"#00FF00\""] = "\"#FF0000\"";
replaces["\"#009688\""] = "\"#00675b\"";
replaces["\"#F1F1F1\""] = "\"#36363B\"";
replaces["#DBDBDB"] = "#4A4A51"; // ORCA border color
replaces["#F0F0F1"] = "#333337"; // ORCA disabled background color
replaces["#262E30"] = "#EFEFF0"; // ORCA

View File

@@ -46,6 +46,14 @@ static void set_prefered_map_mode(FilamentMapMode mode)
app_config->set("prefered_filament_map_mode", mode_str);
}
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)
{
@@ -81,12 +89,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);
@@ -190,10 +193,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);
@@ -319,7 +327,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

@@ -29,6 +29,8 @@ private:
void OnTimer(wxTimerEvent &event);
void Dismiss();
void CreateBmps();
void Init();
void UpdateButtonStatus(int hover_idx = -1);
void DrawRoundedCorner(int radius);
@@ -50,7 +52,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

@@ -4531,12 +4531,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
@@ -4630,15 +4630,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());
@@ -4648,15 +4648,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());