This commit is contained in:
yw4z
2026-10-02 14:39:05 +03:00
parent d1d14329d9
commit e7f5d7be30
8 changed files with 89 additions and 70 deletions
+1 -3
View File
@@ -1,3 +1 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.2992 1.42627C10.7774 1.42627 8.73315 3.47056 8.73315 5.99231C8.73315 8.51406 10.7774 10.5583 13.2992 10.5583C13.3609 10.5583 13.4223 10.5571 13.4834 10.5547C15.9197 10.4581 17.8652 8.45238 17.8652 5.99231C17.8652 3.47056 15.8209 1.42627 13.2992 1.42627ZM15.6185 11.0536C17.5346 10.1741 18.8652 8.23861 18.8652 5.99231C18.8652 2.91827 16.3732 0.42627 13.2992 0.42627C11.5793 0.42627 10.0417 1.2063 9.02067 2.43188H2.31853C1.93193 2.43188 1.61853 2.74528 1.61853 3.13188V12.4712C1.61853 12.6313 1.6723 12.7789 1.76278 12.8968C1.76671 13.0046 1.79621 13.1144 1.85576 13.2185L3.48408 16.0649C3.60875 16.2829 3.8406 16.4173 4.09168 16.4173H6.75859L7.97903 19.1586C8.22556 19.7123 9.01148 19.7123 9.25801 19.1586L10.4784 16.4173H13.1454C13.3965 16.4173 13.6283 16.2829 13.753 16.0649L15.3813 13.2185C15.4409 13.1144 15.4704 13.0046 15.4743 12.8968C15.5648 12.7789 15.6185 12.6313 15.6185 12.4712V11.0536ZM13.4429 11.5565C13.8469 11.5463 14.2403 11.493 14.6185 11.4011V12.1709H2.61853V3.43188H8.35573C7.95792 4.19837 7.73315 5.06909 7.73315 5.99231C7.73315 9.06635 10.2252 11.5583 13.2992 11.5583C13.3472 11.5583 13.3951 11.5577 13.4429 11.5565ZM2.98076 13.1712H14.2563L12.9714 15.4173H9.85194L9.84578 15.4173H7.39126L7.3851 15.4173H4.26569L2.98076 13.1712ZM9.38381 16.4173L8.61852 18.1363L7.85322 16.4173H9.38381ZM12.2021 3.36422C12.3973 3.55948 12.3973 3.87606 12.2021 4.07133L11.743 4.53041H16.0625C16.3386 4.53041 16.5625 4.75426 16.5625 5.03041C16.5625 5.30655 16.3386 5.53041 16.0625 5.53041H10.7773C10.2428 5.53041 9.97507 4.88412 10.353 4.50614L11.495 3.36422C11.6902 3.16896 12.0068 3.16896 12.2021 3.36422ZM14.3963 7.91305C14.2011 8.10831 14.2011 8.42489 14.3963 8.62015C14.5916 8.81542 14.9082 8.81542 15.1034 8.62015L16.2453 7.47823C16.6233 7.10026 16.3556 6.45397 15.8211 6.45397L10.5359 6.45397C10.2597 6.45397 10.0359 6.67783 10.0359 6.95397C10.0359 7.23011 10.2597 7.45397 10.5359 7.45397L14.8554 7.45397L14.3963 7.91305Z" fill="#262E30"/>
</svg>
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M3.5,11.5v1l2,2,2-2v-1" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><circle cx="10.5" cy="4.5" r="4" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><polyline points="11.5 2.5 12.5 3.5 8.5 3.5" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><polyline points="12.5 5.5 8.5 5.5 9.5 6.5" style="fill:none; stroke:#009688; stroke-linecap:square; stroke-linejoin:round;"/><path d="M5.5.5H1.5C.95.5.5.95.5,1.5v9c0,.55.45,1,1,1h8c.55,0,1-.45,1-1" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/></svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 747 B

+1 -10
View File
@@ -1,10 +1 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1.73486" y="1" width="10.53" height="5.12169" fill="#C2C2C2"/>
<rect x="1.73486" y="1" width="10.53" height="0.497608" fill="#858585"/>
<rect x="1.73486" y="2.70703" width="10.53" height="0.497608" fill="#858585"/>
<rect x="1.73486" y="4.41602" width="10.53" height="0.497608" fill="#858585"/>
<rect x="1.73486" y="6.12305" width="10.53" height="0.497608" fill="#858585"/>
<path d="M6.10107 11.9961H7.77047L7.30675 12.9991H6.61117L6.10107 11.9961Z" fill="#8C8C8C"/>
<rect x="4.1748" y="6.62109" width="5.65026" height="5.3765" fill="#646464"/>
<rect x="6.61475" y="6.62109" width="0.642075" height="5.35947" fill="#1D1D1D"/>
</svg>
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M3.5,3.5h8M3.5,5.5h8M3.5,1.5h8M6.5,5.5v7l1,1,1-1v-7" style="fill:none; opacity:.8; stroke:#a848bc; stroke-linecap:square; stroke-linejoin:round;"/></svg>

Before

Width:  |  Height:  |  Size: 737 B

After

Width:  |  Height:  |  Size: 267 B

+1 -1
View File
@@ -808,7 +808,7 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord h_pos, wxCoord v_pos)
wxCoord icon_pos = h_pos;
if (is_multi_extruder) {
static ScalableBitmap multi_extruder(ctrl, "multi_extruder");
h_pos = draw_act_bmps(dc, wxPoint(h_pos, v_pos), multi_extruder.bmp(), multi_extruder.bmp(), false, 0, true).x;
h_pos = draw_act_bmps(dc, wxPoint(h_pos - multi_extruder.bmp().GetWidth() - ctrl->m_h_gap, v_pos), multi_extruder.bmp(), multi_extruder.bmp(), false, 0, true).x + ctrl->m_h_gap;
}
is_url_string = !suppress_hyperlinks && !og_line.label_path.empty();
// BBS
+12 -12
View File
@@ -637,8 +637,8 @@ static void use_nozzle_row_font(ComboBox *combo)
{
// A read-only combo draws its value with the font of the TextInput it is built on, and its
// dropped list carries a font of its own.
combo->SetFont(Label::Body_10);
combo->GetDropDown().SetFont(Label::Body_10);
combo->SetFont(Label::Body_13);
combo->GetDropDown().SetFont(Label::Body_13);
// A row is as tall as the tags of the variant switch: a line of Body_10 text plus the 3 points of
// padding they put above and below it. TextInput::messureSize() instead sizes a combo as its
@@ -648,7 +648,7 @@ static void use_nozzle_row_font(ComboBox *combo)
// arithmetic landing on the small box however often it re-measures.
const int row_height = combo->GetTextExtent("0.4 mm").y + 2 * combo->FromDIP(3);
auto *text_ctrl = combo->GetTextCtrl();
text_ctrl->SetFont(Label::Body_10);
text_ctrl->SetFont(Label::Body_13);
text_ctrl->SetInitialSize(wxSize(text_ctrl->GetBestSize().x, row_height - 8));
combo->SetMinSize(wxSize(combo->GetMinSize().x, row_height));
@@ -1442,12 +1442,12 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
ams_panel->SetBackgroundColour(*wxWHITE);
ams_label = new wxStaticText(ams_panel, wxID_ANY, _L("AMS"));
ams_label->SetFont(Label::Body_14);
ams_label->SetFont(Label::Body_13);
ams_label->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
// AMS not installed message
ams_not_installed_msg = new wxStaticText(ams_panel, wxID_ANY, _L("Not installed"));
ams_not_installed_msg->SetFont(Label::Body_14);
ams_not_installed_msg->SetFont(Label::Body_13);
ams_not_installed_msg->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#6B6B6B")));
if (index >= 0) {
@@ -1537,9 +1537,9 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
auto rows_sizer = new wxBoxSizer(wxHORIZONTAL);
for (wxBoxSizer *&column : row_columns) {
column = new wxBoxSizer(wxVERTICAL);
rows_sizer->Add(column, 1, wxEXPAND);
rows_sizer->Add(column, 1, wxEXPAND | wxLEFT , FromDIP(5));
}
vsizer->Add(rows_sizer, 0, wxEXPAND);
vsizer->Add(rows_sizer, 0, wxEXPAND | wxRIGHT, FromDIP(5));
sizer = vsizer; // the floating filament-switch icon positions itself against this card
SetSizer(vsizer);
SetNozzleRowCount(1);
@@ -1554,12 +1554,12 @@ ExtruderGroup::NozzleRow ExtruderGroup::create_nozzle_row()
const size_t row_index = rows.size();
NozzleRow row;
row.prefix = new Label(this, Label::Body_10.Bold());
row.prefix = new Label(this, Label::Body_12.Bold());
row.prefix->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
row.prefix->SetLabelText(wxString::Format("T%d", int(row_index) + 1));
row.prefix->Hide();
row.diameter_label = new Label(this, Label::Body_10);
row.diameter_label = new Label(this, Label::Body_12);
row.diameter_label->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
row.diameter_label->Hide();
@@ -1591,7 +1591,7 @@ ExtruderGroup::NozzleRow ExtruderGroup::create_nozzle_row()
row_sizer->Add(row.diameter_label, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(5));
row_sizer->Add(row.flow, 1);
// Row-major: T1 T2 on the first line, T3 T4 on the second, and so on.
row_columns[row_index % 2]->Add(row_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
row_columns[row_index % 2]->Add(row_sizer, 0, wxEXPAND | wxBOTTOM, FromDIP(5));
return row;
}
@@ -1618,9 +1618,9 @@ void ExtruderGroup::SetRowDiameters(const std::vector<double> &diameters)
{
for (size_t i = 0; i < std::min(nozzle_row_count, diameters.size()); ++i) {
// Spelled like the calibration dialogs spell a nozzle diameter, "0.4 mm".
const wxString text = from_u8(get_diameter_string(diameters[i])) + " mm";
const wxString text = from_u8(get_diameter_string(diameters[i]));
rows[i].diameter_label->SetLabelText(text);
rows[i].diameter_label->SetToolTip(text);
rows[i].diameter_label->SetToolTip(text + " mm");
}
update_row_widths();
Layout();
+48 -39
View File
@@ -506,6 +506,7 @@ void Tab::create_preset_tab()
if (dynamic_cast<TabPrinter *>(this) || dynamic_cast<TabPrint *>(this)) {
m_extruder_switch = new MultiSwitchButton(panel);
m_extruder_switch->SetFont(Label::Body_11);
m_extruder_switch->SetFitToOptions();
m_extruder_switch->Bind(wxCUSTOMEVT_MULTISWITCH_SELECTION, [this](auto &evt) {
evt.Skip();
@@ -531,23 +532,32 @@ void Tab::create_preset_tab()
sync_excluder();
});
static ScalableBitmap multi_extruder;
add_scaled_bitmap(panel, multi_extruder, "multi_extruder");
auto icon = new wxStaticBitmap(panel, wxID_ANY, multi_extruder.bmp());
icon->SetToolTip(_L("Parameters with this icon can be configurable per nozzle."));
auto sync_box_sizer = new wxBoxSizer(wxHORIZONTAL);
sync_box_sizer->Add(m_extruder_sync, 1, wxEXPAND);
m_extruder_sync_box->SetSizer(sync_box_sizer);
m_variant_sizer = new wxBoxSizer(wxHORIZONTAL);
auto right_sizer = new wxBoxSizer(wxHORIZONTAL);
auto left_sizer = new wxBoxSizer(wxHORIZONTAL);
m_variant_sizer->Add(left_sizer, 0, wxALIGN_CENTER);
m_variant_sizer->AddStretchSpacer(1);
// Orca: proportion 1 lets a narrow row squeeze the switch, which then scrolls its buttons.
m_variant_sizer->Add(m_extruder_switch, 1, wxALIGN_CENTER, 0);
m_variant_sizer->Add(right_sizer, 1, wxALIGN_CENTER);
right_sizer->AddStretchSpacer(1);
m_variant_sizer->AddStretchSpacer(1);
m_variant_sizer->Add(right_sizer, 0, wxALIGN_CENTER);
left_sizer->Add(icon , 0, wxALIGN_CENTER | wxLEFT , m_em_unit);
right_sizer->Add(m_extruder_sync_box, 0, wxALIGN_CENTER | wxRIGHT, m_em_unit);
m_main_sizer->Add(m_variant_sizer, 0, wxEXPAND | wxTOP, m_em_unit);
} else if (dynamic_cast<TabFilament *>(this)) {
m_variant_combo = new MultiSwitchButton(panel);
m_variant_combo->SetFont(Label::Body_11);
m_variant_combo->Bind(wxCUSTOMEVT_MULTISWITCH_SELECTION, [this](auto &evt) {
evt.Skip();
switch_excluder(evt.GetInt());
@@ -559,11 +569,17 @@ void Tab::create_preset_tab()
m_page_view->GetParent()->Layout();
});
static ScalableBitmap multi_extruder;
add_scaled_bitmap(panel, multi_extruder, "multi_extruder");
auto icon = new wxStaticBitmap(panel, wxID_ANY, multi_extruder.bmp());
icon->SetToolTip(_L("Parameters with this icon can be configurable per nozzle."));
wxBoxSizer *combo_sizer = new wxBoxSizer(wxHORIZONTAL);
combo_sizer->Add(m_variant_combo, 1, wxEXPAND);
wxBoxSizer *top_sizer = new wxBoxSizer(wxHORIZONTAL);
top_sizer->Add(combo_sizer, 1, wxEXPAND | wxLEFT, m_em_unit);
top_sizer->Add(icon , 0, wxALIGN_CENTER);
top_sizer->Add(combo_sizer, 1, wxEXPAND | wxLEFT, FromDIP(2));
m_variant_sizer = new wxBoxSizer(wxVERTICAL);
m_variant_sizer->Add(top_sizer, 0, wxLEFT, m_em_unit);
m_main_sizer->Add(m_variant_sizer, 0, wxEXPAND | wxTOP, m_em_unit);
@@ -762,7 +778,7 @@ wxString Tab::translate_category(const wxString& title, Preset::Type preset_type
if (title == "Extruder 1") return _("Left Extruder");
if (title == "Extruder 2") return _("Right Extruder");
}
return _("Extruder") + title.SubString(8, title.Last());
return _("T") + title.SubString(9, title.Last()); // ORCA use T1,T2... instead "Extruder 1" .. to make printer settings usable for toolchangers
}
return _(title);
}
@@ -1172,43 +1188,30 @@ void Tab::update_extruder_switch_colors()
}
auto options = generate_extruder_options();
auto extruders = m_preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnumsGeneric>("extruder_type");
for (size_t switch_index = 0; switch_index < options.size(); ++switch_index) {
int selection = m_extruder_switch ? m_extruder_switch->GetSelection() : (m_variant_combo ? m_variant_combo->GetSelection() : 0);
if (switch_index == selection) continue;
bool sys_extruder = true;
bool modified_extruder = false;
std::vector<PageShp> pages_to_check;
if (m_active_page) {
if (m_active_page->title() == "Speed" || m_active_page->title() == "Motion ability" || m_active_page->title() == "Filament" ||
m_active_page->title() == "Setting Overrides" || m_active_page->title() == "Multimaterial") {
for (auto page_ptr : m_pages) {
if (page_ptr.get() == m_active_page) {
pages_to_check.push_back(page_ptr);
break;
}
std::vector<PageShp> pages_to_check;
if (m_active_page) {
const wxString t = m_active_page->title();
if (t == "Speed" || t == "Motion ability" || t == "Filament" ||
t == "Setting Overrides" || t == "Multimaterial") {
for (auto &p : m_pages){
if (p.get() == m_active_page) {
pages_to_check.push_back(p);
break;
}
}
}
if (pages_to_check.empty()) {
continue;
}
check_extruder_options_status(switch_index, sys_extruder, modified_extruder, pages_to_check);
}
StateColor default_color(std::make_pair(0x6B6B6B, (int) StateColor::NotChecked), std::make_pair(0xFFFFFE, (int) StateColor::Normal));
StateColor color = modified_extruder ? StateColor(m_modified_label_clr) : default_color;
for (size_t switch_index = 0; switch_index < options.size(); ++switch_index) {
bool sys_extruder = true;
bool modified_extruder = false;
if (!pages_to_check.empty())
check_extruder_options_status((int) switch_index, sys_extruder, modified_extruder, pages_to_check);
// no matching page: clear the flag so the tag doesn't keep a stale color
if (m_extruder_switch)
m_extruder_switch->SetButtonTextColor(switch_index, color);
if (m_variant_combo) {
Button *btn = m_variant_combo->GetButton(switch_index);
if (btn) {
m_variant_combo->SetButtonTextColor(switch_index, color);
}
}
if (m_extruder_switch) m_extruder_switch->SetModified(switch_index, modified_extruder);
if (m_variant_combo) m_variant_combo->SetModified(switch_index, modified_extruder);
}
}
@@ -8182,6 +8185,9 @@ void Tab::update_extruder_variants(int extruder_id, bool reload)
if (extruder_nums >= 2 && m_preset_bundle->support_different_extruders()) {
auto options = generate_extruder_options();
m_extruder_switch->SetOptions(options);
int item_n = options.empty() ? 0 : options.size();
int h_pad = item_n > 6 ? 6 : (item_n > 4 ? 8 : (item_n > 2 ? 10 : 16));
m_extruder_switch->SetButtonPadding(FromDIP(wxSize(h_pad,3)));
int selection_index;
if (extruder_id >= 0) {
@@ -8208,6 +8214,9 @@ void Tab::update_extruder_variants(int extruder_id, bool reload)
const int selection = m_variant_combo->GetSelection();
auto options = generate_extruder_options();
m_variant_combo->SetOptions(options);
int item_n = options.empty() ? 0 : options.size();
int h_pad = item_n > 6 ? 6 : (item_n > 4 ? 8 : (item_n > 2 ? 10 : 16));
m_variant_combo->SetButtonPadding(FromDIP(wxSize(h_pad,3)));
if (!options.empty())
m_variant_combo->SetSelection(selection < 0 || selection >= (int) options.size() ? 0 : selection);
@@ -8285,7 +8294,7 @@ std::vector<wxString> Tab::generate_extruder_options()
nozzle = "";
}
}
options.push_back(wxString::Format(_L("%s: %s"), _L(drive), short_nozzle_volume_name(nozzle)));
options.push_back(wxString::Format(_L("%s %s"), _L(drive), short_nozzle_volume_name(nozzle)));
}
return options;
}
@@ -8310,10 +8319,10 @@ std::vector<wxString> Tab::generate_extruder_options()
NozzleVolumeType volume_type = NozzleVolumeType(nozzle_volumes->values[i]);
if (volume_type == NozzleVolumeType::nvtHybrid) {
options.push_back(wxString::Format(_L("%s: %s"), extruder_name, short_nozzle_volume_name(get_nozzle_volume_type_string(NozzleVolumeType::nvtStandard))));
options.push_back(wxString::Format(_L("%s: %s"), extruder_name, short_nozzle_volume_name(get_nozzle_volume_type_string(NozzleVolumeType::nvtHighFlow))));
options.push_back(wxString::Format(_L("%s %s"), extruder_name, short_nozzle_volume_name(get_nozzle_volume_type_string(NozzleVolumeType::nvtStandard))));
options.push_back(wxString::Format(_L("%s %s"), extruder_name, short_nozzle_volume_name(get_nozzle_volume_type_string(NozzleVolumeType::nvtHighFlow))));
} else {
options.push_back(wxString::Format(_L("%s: %s"), extruder_name,
options.push_back(wxString::Format(_L("%s %s"), extruder_name,
short_nozzle_volume_name(get_nozzle_volume_type_string(volume_type))));
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ static std::map<wxColour, wxColour> gDarkColors{
{"#2B3436", "#808080"}, // rgb(43, 52, 54) Not Used anymore // Leftover from BBS. Was used as main fill color of icons
{"#ABABAB", "#ABABAB"},
{"#D9D9D9", "#27272A"}, // rgb(217, 217, 217) Sidebar > Toggle button track color
{"#FFFEFE", "#D9D9D9"}, // rgb(255, 254, 254) Sidebar > Toggle button thumb color
{"#FFFEFE", "#D8D9D9"}, // rgb(255, 254, 254) Sidebar > Toggle button thumb color
{"#EBF9F0", "#293F34"},
//{"#F0F0F0", "#4C4C54"},
// ORCA
+21 -4
View File
@@ -616,11 +616,17 @@ bool SwitchBoard::Enable(bool enable /* = true */)
MultiSwitchButton::MultiSwitchButton(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style)
: StaticBox(parent, id, pos, size, style)
, m_bg_color(StateColor(
std::make_pair(0xE8E8E8, (int) StateColor::NotChecked),
std::make_pair(0xD9D9D9, (int) StateColor::NotChecked),
std::make_pair(0x009688, (int) StateColor::Normal)))
, m_text_color(StateColor(
std::make_pair(0x6B6B6B, (int) StateColor::NotChecked),
std::make_pair(0xFFFFFE, (int) StateColor::Normal)))
, m_br_color_modified(StateColor(
std::make_pair(0xD9D9D9, (int) StateColor::NotChecked),
std::make_pair(0xF1754F, (int) StateColor::Normal)))
, m_fg_color_modified(StateColor(
std::make_pair(0xF1754E, (int) StateColor::NotChecked),
std::make_pair(0xFFFFFE, (int) StateColor::Normal)))
, m_button_radius(10.0)
, m_button_padding(FromDIP(wxSize(11, 3)))
{
@@ -631,6 +637,7 @@ MultiSwitchButton::MultiSwitchButton(wxWindow *parent, wxWindowID id, const wxPo
// tool), so they live in a scrolled area: the caller caps the switch at its natural width and
// this scrolls horizontally instead of clipping the last buttons.
m_scroll = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxBORDER_NONE);
//m_scroll->SetBackgroundColour(wxColour("#D9D9D9"));
m_scroll->SetBackgroundColour(GetBackgroundColour());
// The buttons are a single row, so only the horizontal bar may ever appear: a vertical one would
// eat into the row's height.
@@ -738,15 +745,17 @@ void MultiSwitchButton::scroll_option_into_view(Button *btn)
int MultiSwitchButton::AppendOption(const wxString &option, void *clientData)
{
Button *btn = new Button();
btn->Create(m_scroll, option, "", wxBORDER_NONE);
btn->Create(m_scroll, option);
btn->SetFont(GetFont());
btn->SetBackgroundColor(m_bg_color);
btn->SetBorderColor(m_bg_color);
btn->SetTextColor(m_text_color);
btn->SetCornerRadius(m_button_radius);
btn->SetPaddingSize(m_button_padding);
btn->SetClientData(clientData);
btns.push_back(btn);
btns_modified.push_back(false);
sizer->Add(btn, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL);
return int(btns.size()) - 1;
@@ -771,6 +780,7 @@ void MultiSwitchButton::DeleteAllOptions()
btn->Destroy();
}
btns.clear();
btns_modified.clear();
if (sizer)
sizer->Clear();
}
@@ -832,8 +842,8 @@ void MultiSwitchButton::update_button_styles()
{
for (int i = 0; i < (int) btns.size(); ++i) {
btns[i]->SetValue(i == sel);
btns[i]->SetBackgroundColor(m_bg_color);
btns[i]->SetTextColor(m_text_color);
btns[i]->SetBorderColor(btns_modified[i] ? m_br_color_modified : m_bg_color );
btns[i]->SetTextColor( btns_modified[i] ? m_fg_color_modified : m_text_color);
btns[i]->Refresh();
}
}
@@ -870,6 +880,13 @@ void MultiSwitchButton::SetButtonPadding(const wxSize &padding)
Refresh();
}
void MultiSwitchButton::SetModified(int index, bool modified){
if(index < 0 || index >= btns_modified.size())
return;
btns_modified[index] = modified;
update_button_styles();
}
void MultiSwitchButton::Rescale()
{
for (auto *btn : btns)
+4
View File
@@ -162,6 +162,7 @@ public:
btns[index]->SetTextColor(color);
btns[index]->Refresh();
}
void SetModified(int index, bool modified);
void SetButtonCornerRadius(double radius);
void SetButtonPadding(const wxSize &padding);
@@ -186,6 +187,7 @@ private:
void on_size(wxSizeEvent &evt);
std::vector<Button *> btns;
std::vector<bool> btns_modified;
// The buttons are laid out inside this scrolled area so that a switch holding more options than
// the layout has room for scrolls instead of clipping its tail.
wxScrolledWindow *m_scroll = nullptr;
@@ -195,6 +197,8 @@ private:
StateColor m_bg_color;
StateColor m_text_color;
StateColor m_br_color_modified;
StateColor m_fg_color_modified;
double m_button_radius;
wxSize m_button_padding;
};