ENH: dark mode of StateColor
Change-Id: I5928898c50280c7f2eedbb9389032230c7e251c4
This commit is contained in:
parent
faec57d263
commit
b209243b27
|
@ -322,10 +322,13 @@ wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_
|
|||
|
||||
// map of color replaces
|
||||
std::map<std::string, std::string> replaces;
|
||||
if (dark_mode)
|
||||
replaces["\"#808080\""] = "\"#FFFFFF\"";
|
||||
if (!new_color.empty())
|
||||
replaces["\"#ED6B21\""] = "\"" + new_color + "\"";
|
||||
if (dark_mode) {
|
||||
replaces["\"#262E30\""] = "\"#EFEFF0\"";
|
||||
replaces["\"#323A3D\""] = "\"#B3B3B5\"";
|
||||
replaces["\"#808080\""] = "\"#818183\"";
|
||||
}
|
||||
//if (!new_color.empty())
|
||||
// replaces["\"#ED6B21\""] = "\"" + new_color + "\"";
|
||||
|
||||
NSVGimage *image = nsvgParseFromFileWithReplace(Slic3r::var(bitmap_name + ".svg").c_str(), "px", 96.0f, replaces);
|
||||
if (image == nullptr)
|
||||
|
|
|
@ -730,7 +730,7 @@ void CheckBox::BUILD() {
|
|||
// BBS: use ::CheckBox
|
||||
auto temp = new ::CheckBox(m_parent);
|
||||
if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
temp->SetBackgroundColour(*wxWHITE);
|
||||
//temp->SetBackgroundColour(*wxWHITE);
|
||||
temp->SetValue(check_value);
|
||||
|
||||
temp->Bind(wxEVT_TOGGLEBUTTON, ([this](wxCommandEvent & e) {
|
||||
|
|
|
@ -2616,10 +2616,10 @@ const wxColour GUI_App::get_label_default_clr_modified()
|
|||
|
||||
void GUI_App::init_label_colours()
|
||||
{
|
||||
m_color_label_modified = wxColour("#F1754E");
|
||||
m_color_label_sys = wxColour("#323A3D");
|
||||
|
||||
bool is_dark_mode = dark_mode();
|
||||
m_color_label_modified = is_dark_mode ? wxColour("#F1754E") : wxColour("#F1754E");
|
||||
m_color_label_sys = is_dark_mode ? wxColour("#B2B3B5") : wxColour("#363636");
|
||||
|
||||
#ifdef _WIN32
|
||||
m_color_label_default = is_dark_mode ? wxColour(250, 250, 250) : m_color_label_sys; // wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
|
||||
m_color_highlight_label_default = is_dark_mode ? wxColour(230, 230, 230): wxSystemSettings::GetColour(/*wxSYS_COLOUR_HIGHLIGHTTEXT*/wxSYS_COLOUR_WINDOWTEXT);
|
||||
|
@ -2630,6 +2630,7 @@ void GUI_App::init_label_colours()
|
|||
m_color_label_default = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
|
||||
#endif
|
||||
m_color_window_default = is_dark_mode ? wxColour(43, 43, 43) : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||
StateColor::SetDarkMode(is_dark_mode);
|
||||
}
|
||||
|
||||
void GUI_App::update_label_colours_from_appconfig()
|
||||
|
@ -2645,8 +2646,10 @@ void GUI_App::update_label_colours()
|
|||
|
||||
void GUI_App::UpdateDarkUI(wxWindow* window, bool highlited/* = false*/, bool just_font/* = false*/)
|
||||
{
|
||||
//BBS disable DarkUI mode
|
||||
if (wxButton *btn = dynamic_cast<wxButton *>(window)) {
|
||||
if (btn->GetWindowStyleFlag() & wxBU_AUTODRAW)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (wxButton* btn = dynamic_cast<wxButton*>(window)) {
|
||||
|
|
|
@ -168,7 +168,7 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
|
|||
btn->SetToolTip(_(L("Reset parameter")));
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
btn->SetBackgroundColour(*wxWHITE);
|
||||
btn->SetBackgroundColour(parent->GetBackgroundColour());
|
||||
#endif // DEBUG
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ ImageGrid::ImageGrid(wxWindow * parent)
|
|||
{
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
SetBackgroundColour(0xEEEEEE);
|
||||
SetForegroundColour(*wxWHITE); // time text color
|
||||
SetFont(Label::Head_20);
|
||||
|
||||
m_timer.Bind(wxEVT_TIMER, [this](auto & e) { Refresh(); });
|
||||
|
@ -558,6 +557,7 @@ void ImageGrid::render(wxDC& dc)
|
|||
dc.DrawBitmap(file.IsSelect() ? m_checked_icon.bmp() : m_unchecked_icon.bmp(),
|
||||
pt + wxPoint{10, m_image_size.GetHeight() - m_checked_icon.GetBmpHeight() - 10});
|
||||
} else {
|
||||
dc.SetTextForeground(*wxWHITE); // time text color
|
||||
auto date = wxDateTime((time_t) file.time).Format(_L(formats[m_file_sys->GetGroupMode()]));
|
||||
dc.DrawText(date, pt + wxPoint{24, 16});
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ void ImageGrid::render(wxDC& dc)
|
|||
auto date1 = wxDateTime((time_t) file1.time).Format(_L(formats[m_file_sys->GetGroupMode()]));
|
||||
auto date2 = wxDateTime((time_t) file2.time).Format(_L(formats[m_file_sys->GetGroupMode()]));
|
||||
dc.SetFont(Label::Head_16);
|
||||
dc.SetTextForeground(wxColor("#262E30"));
|
||||
dc.SetTextForeground(StateColor::darkModeColorFor("#262E30"));
|
||||
dc.DrawText(date1 + " - " + date2, wxPoint{off.x, 2});
|
||||
}
|
||||
// Draw bottom background
|
||||
|
@ -627,13 +627,12 @@ void Slic3r::GUI::ImageGrid::renderButtons(wxDC &dc, wxStringList const &texts,
|
|||
rect.Inflate(10, 5);
|
||||
rect.Offset(rect.GetWidth(), 0);
|
||||
}
|
||||
dc.SetTextForeground(*wxWHITE); // time text color
|
||||
dc.SetFont(GetFont());
|
||||
}
|
||||
|
||||
void Slic3r::GUI::ImageGrid::renderText(wxDC &dc, wxString const &text, wxRect const &rect, int states)
|
||||
{
|
||||
dc.SetTextForeground(m_buttonTextColor.colorForStates(states));
|
||||
dc.SetTextForeground(m_buttonTextColor.colorForStatesNoDark(states));
|
||||
wxRect rc({0, 0}, dc.GetTextExtent(text));
|
||||
rc = rc.CenterIn(rect);
|
||||
dc.DrawText(text, rc.GetTopLeft());
|
||||
|
|
|
@ -1770,6 +1770,7 @@ void MainFrame::on_sys_color_changed()
|
|||
|
||||
// BBS
|
||||
m_tabpanel->Rescale();
|
||||
m_param_panel->msw_rescale();
|
||||
|
||||
// update Plater
|
||||
wxGetApp().plater()->sys_color_changed();
|
||||
|
|
|
@ -48,6 +48,7 @@ OG_CustomCtrl::OG_CustomCtrl( wxWindow* parent,
|
|||
{
|
||||
if (!wxOSX)
|
||||
SetDoubleBuffered(true);// SetDoubleBuffered exists on Win and Linux/GTK, but is missing on OSX
|
||||
SetBackgroundColour(parent->GetBackgroundColour());
|
||||
|
||||
// BBS: new font
|
||||
m_font = Label::Body_14;
|
||||
|
@ -332,7 +333,7 @@ void OG_CustomCtrl::OnPaint(wxPaintEvent&)
|
|||
// BBS: new layout
|
||||
if (!GetLabel().IsEmpty()) {
|
||||
dc.SetFont(Label::Head_16);
|
||||
wxColour color("#283436");
|
||||
wxColour color = StateColor::darkModeColorFor("#283436");
|
||||
draw_title(dc, {0, v_pos}, GetLabel(), &color, h_pos);
|
||||
dc.SetFont(m_font);
|
||||
}
|
||||
|
@ -759,10 +760,10 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord h_pos, wxCoord v_pos)
|
|||
const std::vector<Option>& option_set = og_line.get_options();
|
||||
|
||||
wxString label = og_line.label;
|
||||
wxColour blink_color("#00AE42");
|
||||
wxColour blink_color = StateColor::darkModeColorFor("#00AE42");
|
||||
bool is_url_string = false;
|
||||
if (ctrl->opt_group->label_width != 0 && !label.IsEmpty()) {
|
||||
const wxColour* text_clr = (option_set.size() == 1 && field ? field->label_color() : og_line.full_Label_color);
|
||||
const wxColour* text_clr = field ? field->label_color() : og_line.full_Label_color;
|
||||
for (const Option& opt : option_set) {
|
||||
Field* field = ctrl->opt_group->get_field(opt.opt_id);
|
||||
if (field && field->blink()) {
|
||||
|
@ -850,7 +851,7 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord h_pos, wxCoord v_pos)
|
|||
is_url_string = false;
|
||||
else if(opt == option_set.front())
|
||||
is_url_string = !suppress_hyperlinks && !og_line.label_path.empty();
|
||||
static wxColor c("#6B6B6B");
|
||||
wxColor c = StateColor::darkModeColorFor("#6B6B6B");
|
||||
h_pos = draw_text(dc, wxPoint(h_pos, v_pos), label, field ? (field->blink() ? &blink_color : &c) : nullptr, ctrl->opt_group->sublabel_width * ctrl->m_em_unit, is_url_string);
|
||||
h_pos += 8;
|
||||
}
|
||||
|
@ -905,7 +906,7 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_text(wxDC &dc, wxPoint pos, const wxString
|
|||
|
||||
wxColour old_clr = dc.GetTextForeground();
|
||||
wxFont old_font = dc.GetFont();
|
||||
static wxColor clr_url("#00AE42");
|
||||
wxColor clr_url = StateColor::darkModeColorFor("#00AE42");
|
||||
if (is_focused && is_url) {
|
||||
// temporary workaround for the OSX because of strange Bold font behavior on BigSerf
|
||||
#ifdef __APPLE__
|
||||
|
|
|
@ -453,6 +453,7 @@ bool OptionsGroup::activate(std::function<void()> throw_if_canceled/* = [](){}*/
|
|||
if (staticbox) {
|
||||
wxStaticBox * stb = new wxStaticBox(m_parent, wxID_ANY, _(title));
|
||||
if (!wxOSX) stb->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
stb->SetBackgroundColour(m_parent->GetBackgroundColour());
|
||||
stb->SetFont(wxOSX ? wxGetApp().normal_font() : wxGetApp().bold_font());
|
||||
wxGetApp().UpdateDarkUI(stb);
|
||||
// BBS: new layout
|
||||
|
|
|
@ -1137,8 +1137,16 @@ void Sidebar::sys_color_changed()
|
|||
for (wxWindow* win : std::vector<wxWindow*>{ p->scrolled, p->presets_panel })
|
||||
wxGetApp().UpdateAllStaticTextDarkUI(win);
|
||||
#endif
|
||||
for (wxWindow* btn : std::vector<wxWindow*>{ p->btn_reslice, p->btn_export_gcode })
|
||||
wxGetApp().UpdateDarkUI(btn, true);
|
||||
//for (wxWindow* btn : std::vector<wxWindow*>{ p->btn_reslice, p->btn_export_gcode })
|
||||
// wxGetApp().UpdateDarkUI(btn, true);
|
||||
p->m_printer_icon->msw_rescale();
|
||||
p->m_printer_setting->msw_rescale();
|
||||
p->m_filament_icon->msw_rescale();
|
||||
p->m_bpButton_add_filament->msw_rescale();
|
||||
p->m_bpButton_del_filament->msw_rescale();
|
||||
p->m_bpButton_ams_filament->msw_rescale();
|
||||
p->m_bpButton_set_filament->msw_rescale();
|
||||
p->m_flushing_volume_btn->Rescale();
|
||||
|
||||
// BBS
|
||||
#if 0
|
||||
|
@ -10211,7 +10219,6 @@ void Plater::sys_color_changed()
|
|||
{
|
||||
p->preview->sys_color_changed();
|
||||
p->sidebar->sys_color_changed();
|
||||
|
||||
p->menus.sys_color_changed();
|
||||
|
||||
Layout();
|
||||
|
|
|
@ -670,7 +670,7 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
|
|||
// BBS
|
||||
if (m_type == Preset::TYPE_FILAMENT) {
|
||||
int em = wxGetApp().em_unit();
|
||||
clr_picker = new wxButton(parent, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(20), FromDIP(20)), wxBU_EXACTFIT | wxBORDER_NONE);
|
||||
clr_picker = new wxButton(parent, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(20), FromDIP(20)), wxBU_EXACTFIT | wxBU_AUTODRAW | wxBORDER_NONE);
|
||||
clr_picker->SetToolTip(_L("Click to pick filament color"));
|
||||
clr_picker->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
|
||||
m_clrData.SetColour(clr_picker->GetBackgroundColour());
|
||||
|
|
|
@ -719,7 +719,7 @@ void Tab::update_label_colours()
|
|||
(m_type < Preset::TYPE_COUNT ? &m_default_text_clr : &m_modified_label_clr);
|
||||
|
||||
m_tabctrl->SetItemTextColour(cur_item, clr == &m_modified_label_clr ? *clr : StateColor(
|
||||
std::make_pair(0x6B6B6B, (int) StateColor::NotChecked),
|
||||
std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
|
||||
std::make_pair(*clr, (int) StateColor::Normal)));
|
||||
break;
|
||||
}
|
||||
|
@ -972,7 +972,7 @@ void Tab::update_changed_tree_ui()
|
|||
|
||||
if (page->set_item_colour(clr))
|
||||
m_tabctrl->SetItemTextColour(cur_item, clr == &m_modified_label_clr ? *clr : StateColor(
|
||||
std::make_pair(0x6B6B6B, (int) StateColor::NotChecked),
|
||||
std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
|
||||
std::make_pair(*clr, (int) StateColor::Normal)));
|
||||
|
||||
page->m_is_nonsys_values = !sys_page;
|
||||
|
@ -3657,7 +3657,7 @@ void Tab::rebuild_page_tree()
|
|||
continue;
|
||||
auto itemId = m_tabctrl->AppendItem(translate_category(p->title(), m_type), p->iconID());
|
||||
m_tabctrl->SetItemTextColour(itemId, p->get_item_colour() == m_modified_label_clr ? p->get_item_colour() : StateColor(
|
||||
std::make_pair(0x6B6B6B, (int) StateColor::NotChecked),
|
||||
std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
|
||||
std::make_pair(p->get_item_colour(), (int) StateColor::Normal)));
|
||||
if (translate_category(p->title(), m_type) == selected)
|
||||
item = itemId;
|
||||
|
|
|
@ -75,7 +75,7 @@ void TabButtonsListCtrl::OnPaint(wxPaintEvent &)
|
|||
|
||||
wxPoint pos = btn->GetPosition();
|
||||
wxSize size = btn->GetSize();
|
||||
const wxColour &clr = idx == m_selection ? btn_marker_color : TAB_BUTTON_BG;
|
||||
const wxColour &clr = StateColor::darkModeColorFor(idx == m_selection ? btn_marker_color : TAB_BUTTON_BG);
|
||||
dc.SetPen(clr);
|
||||
dc.SetBrush(clr);
|
||||
dc.DrawRectangle(pos.x, pos.y + size.y, size.x, sz.y - size.y);
|
||||
|
|
|
@ -189,7 +189,7 @@ void DropDown::render(wxDC &dc)
|
|||
if (texts.size() == 0) return;
|
||||
int states = state_handler.states();
|
||||
dc.SetPen(wxPen(border_color.colorForStates(states)));
|
||||
dc.SetBrush(wxBrush(GetBackgroundColour()));
|
||||
dc.SetBrush(wxBrush(StateColor::darkModeColorFor(GetBackgroundColour())));
|
||||
// if (GetWindowStyle() & wxBORDER_NONE)
|
||||
// dc.SetPen(wxNullPen);
|
||||
|
||||
|
|
|
@ -1,5 +1,73 @@
|
|||
#include "StateColor.hpp"
|
||||
|
||||
static bool gDarkMode = false;
|
||||
|
||||
static bool operator<(wxColour const &l, wxColour const &r) { return l.GetRGBA() < r.GetRGBA(); }
|
||||
|
||||
static std::map<wxColour, wxColour> gDarkColors{
|
||||
{"#00AE42", "#21A452"},
|
||||
{"#1F8EEA", "#2778D2"},
|
||||
{"#FF6F00", "#D15B00"},
|
||||
{"#D01B1B", "#BB2A3A"},
|
||||
{"#262E30", "#EFEFF0"},
|
||||
{"#2C2C2E", "#B3B3B4"},
|
||||
{"#6B6B6B", "#818183"},
|
||||
{"#ACACAC", "#54545A"},
|
||||
{"#EEEEEE", "#4C4C55"},
|
||||
{"#E8E8E8", "#3E3E45"},
|
||||
{"#323A3D", "#E5E5E4"},
|
||||
{"#FFFFFF", "#2D2D31"},
|
||||
{"#F8F8F8", "#36363C"},
|
||||
{"#F1F1F1", "#36363B"},
|
||||
{"#3B4446", "#2D2D30"},
|
||||
{"#CECECE", "#54545B"},
|
||||
{"#DBFDD5", "#3B3B40"},
|
||||
{"#000000", "#FFFFFE"},
|
||||
{"#F4F4F4", "#36363D"},
|
||||
{"#DBDBDB", "#4A4A51"},
|
||||
{"#EDFAF2", "#283232"},
|
||||
{"#323A3C", "#E5E5E6"},
|
||||
{"#6B6B6A", "#B3B3B5"},
|
||||
{"#303A3C", "#E5E5E5"},
|
||||
{"#FEFFFF", "#242428"},
|
||||
{"#A6A9AA", "#2D2D29"},
|
||||
{"#363636", "#B2B3B5"},
|
||||
};
|
||||
std::map<wxColour, wxColour> const & StateColor::GetDarkMap()
|
||||
{
|
||||
return gDarkColors;
|
||||
}
|
||||
|
||||
void StateColor::SetDarkMode(bool dark) { gDarkMode = dark; }
|
||||
|
||||
inline wxColour darkModeColorFor2(wxColour const &color)
|
||||
{
|
||||
if (!gDarkMode)
|
||||
return color;
|
||||
auto iter = gDarkColors.find(color);
|
||||
wxFAIL(iter != gDarkColors.end());
|
||||
if (iter != gDarkColors.end()) return iter->second;
|
||||
return color;
|
||||
}
|
||||
|
||||
std::map<wxColour, wxColour> revert(std::map<wxColour, wxColour> const & map)
|
||||
{
|
||||
std::map<wxColour, wxColour> map2;
|
||||
for (auto &p : map) map2.emplace(p.second, p.first);
|
||||
return map2;
|
||||
}
|
||||
|
||||
wxColour StateColor::lightModeColorFor(wxColour const &color)
|
||||
{
|
||||
static std::map<wxColour, wxColour> gLightColors = revert(gDarkColors);
|
||||
auto iter = gLightColors.find(color);
|
||||
wxFAIL(iter != gLightColors.end());
|
||||
if (iter != gLightColors.end()) return iter->second;
|
||||
return *wxRED;
|
||||
}
|
||||
|
||||
wxColour StateColor::darkModeColorFor(wxColour const &color) { return darkModeColorFor2(color); }
|
||||
|
||||
StateColor::StateColor(wxColour const &color) { append(color, 0); }
|
||||
|
||||
StateColor::StateColor(wxString const &color) { append(color, 0); }
|
||||
|
@ -47,6 +115,27 @@ wxColour StateColor::defaultColor() {
|
|||
}
|
||||
|
||||
wxColour StateColor::colorForStates(int states)
|
||||
{
|
||||
bool focused = takeFocusedAsHovered_ && (states & Focused);
|
||||
for (int i = 0; i < statesList_.size(); ++i) {
|
||||
int s = statesList_[i];
|
||||
int on = s & 0xffff;
|
||||
int off = s >> 16;
|
||||
if ((on & states) == on && (off & ~states) == off) {
|
||||
return darkModeColorFor2(colors_[i]);
|
||||
}
|
||||
if (focused && (on & Hovered)) {
|
||||
on |= Focused;
|
||||
on &= ~Hovered;
|
||||
if ((on & states) == on && (off & ~states) == off) {
|
||||
return darkModeColorFor2(colors_[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return wxColour(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
wxColour StateColor::colorForStatesNoDark(int states)
|
||||
{
|
||||
bool focused = takeFocusedAsHovered_ && (states & Focused);
|
||||
for (int i = 0; i < statesList_.size(); ++i) {
|
||||
|
@ -90,4 +179,3 @@ bool StateColor::setColorForStates(wxColour const &color, int states)
|
|||
}
|
||||
|
||||
void StateColor::setTakeFocusedAsHovered(bool set) { takeFocusedAsHovered_ = set; }
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <wx/colour.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
class StateColor
|
||||
{
|
||||
public:
|
||||
|
@ -20,6 +22,13 @@ public:
|
|||
NotPressed = 16 << 16,
|
||||
};
|
||||
|
||||
public:
|
||||
static void SetDarkMode(bool dark);
|
||||
|
||||
static std::map<wxColour, wxColour> const & GetDarkMap();
|
||||
static wxColour darkModeColorFor(wxColour const &color);
|
||||
static wxColour lightModeColorFor(wxColour const &color);
|
||||
|
||||
public:
|
||||
template<typename ...Colors>
|
||||
StateColor(std::pair<Colors, int>... colors) {
|
||||
|
@ -54,6 +63,8 @@ public:
|
|||
|
||||
wxColour colorForStates(int states);
|
||||
|
||||
wxColour colorForStatesNoDark(int states);
|
||||
|
||||
int colorIndexForStates(int states);
|
||||
|
||||
bool setColorForStates(wxColour const & color, int states);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "StaticLine.hpp"
|
||||
#include "Label.hpp"
|
||||
#include "StateColor.hpp"
|
||||
|
||||
#include <wx/dcgraph.h>
|
||||
|
||||
|
@ -15,7 +16,7 @@ StaticLine::StaticLine(wxWindow *parent, bool vertical, const wxString &label, c
|
|||
, vertical(vertical)
|
||||
{
|
||||
wxWindow::SetBackgroundColour(parent->GetBackgroundColour());
|
||||
this->pen = wxPen(wxColour("#EEEEEE"));
|
||||
this->lineColor = wxColour("#EEEEEE");
|
||||
DisableFocusFromKeyboard();
|
||||
SetFont(Label::Body_14);
|
||||
wxWindow::SetLabel(label);
|
||||
|
@ -39,7 +40,7 @@ void StaticLine::SetIcon(const wxString &icon)
|
|||
|
||||
void StaticLine::SetLineColour(wxColour color)
|
||||
{
|
||||
this->pen = wxPen(color);
|
||||
this->lineColor = color;
|
||||
}
|
||||
|
||||
void StaticLine::Rescale()
|
||||
|
@ -98,10 +99,11 @@ void StaticLine::render(wxDC& dc)
|
|||
titleRect.x += icon.GetBmpWidth() + 5;
|
||||
}
|
||||
if (!label.IsEmpty()) {
|
||||
dc.SetTextForeground(StateColor::darkModeColorFor(GetForegroundColour()));
|
||||
dc.DrawText(label, titleRect.x, (size.GetHeight() - textSize.GetHeight()) / 2);
|
||||
titleRect.x += textSize.GetWidth() + 5;
|
||||
}
|
||||
dc.SetPen(pen);
|
||||
dc.SetPen(wxPen(StateColor::darkModeColorFor(lineColor)));
|
||||
if (vertical) {
|
||||
size.x /= 2;
|
||||
if (titleRect.y > 0) titleRect.y += 5;
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
void Rescale();
|
||||
|
||||
private:
|
||||
wxPen pen;
|
||||
wxColour lineColor;
|
||||
bool vertical;
|
||||
ScalableBitmap icon;
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ void SwitchButton::Rescale()
|
|||
m_off.msw_rescale();
|
||||
}
|
||||
else {
|
||||
SetBackgroundColour(StaticBox::GetParentBackgroundColor(GetParent()));
|
||||
#ifdef __WXOSX__
|
||||
auto scale = Slic3r::GUI::mac_max_scaling_factor();
|
||||
int BS = (int) scale;
|
||||
|
|
|
@ -99,9 +99,9 @@ int TabCtrl::AppendItem(const wxString &item,
|
|||
btn->Create(this, item, "", wxBORDER_NONE);
|
||||
btn->SetFont(GetFont());
|
||||
btn->SetTextColor(StateColor(
|
||||
std::make_pair(0x6B6B6B, (int) StateColor::NotChecked),
|
||||
std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
|
||||
std::make_pair(*wxLIGHT_GREY, (int) StateColor::Normal)));
|
||||
btn->SetBackgroundColor(GetBackgroundColour());
|
||||
btn->SetBackgroundColor(StateColor());
|
||||
btn->SetCornerRadius(0);
|
||||
btn->SetPaddingSize({TAB_BUTTON_PADDING});
|
||||
btns.push_back(btn);
|
||||
|
|
|
@ -194,7 +194,7 @@ void WipingPanel::create_panels(wxWindow* parent, const int num) {
|
|||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
panel->SetSizer(sizer);
|
||||
|
||||
wxButton* icon = new wxButton(panel, wxID_ANY, wxString("") << i + 1, wxDefaultPosition, ICON_SIZE, wxBORDER_NONE);
|
||||
wxButton *icon = new wxButton(panel, wxID_ANY, wxString("") << i + 1, wxDefaultPosition, ICON_SIZE, wxBORDER_NONE | wxBU_AUTODRAW);
|
||||
icon->SetBackgroundColour(m_colours[i]);
|
||||
//auto icon_style = icon->GetWindowStyle() & ~(wxBORDER_NONE | wxBORDER_SIMPLE);
|
||||
//icon->SetWindowStyle(m_colours[i].Red() > 224 && m_colours[i].Blue() > 224 && m_colours[i].Green() > 224 ? (icon_style | wxBORDER_SIMPLE) : (icon_style | wxBORDER_NONE));
|
||||
|
@ -307,7 +307,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
|||
|
||||
header_line_sizer->AddSpacer(HEADER_BEG_PADDING);
|
||||
for (unsigned int i = 0; i < m_number_of_extruders; ++i) {
|
||||
wxButton* icon = new wxButton(header_line_panel, wxID_ANY, wxString("") << i + 1, wxDefaultPosition, ICON_SIZE, wxBORDER_NONE);
|
||||
wxButton* icon = new wxButton(header_line_panel, wxID_ANY, wxString("") << i + 1, wxDefaultPosition, ICON_SIZE, wxBORDER_NONE | wxBU_AUTODRAW);
|
||||
icon->SetBackgroundColour(m_colours[i]);
|
||||
//auto icon_style = icon->GetWindowStyle() & ~(wxBORDER_NONE | wxBORDER_SIMPLE);
|
||||
//icon->SetWindowStyle(m_colours[i].Red() > 224 && m_colours[i].Blue() > 224 && m_colours[i].Green() > 224 ? (icon_style | wxBORDER_SIMPLE) : (icon_style | wxBORDER_NONE));
|
||||
|
|
Loading…
Reference in New Issue