FIX: something

Change-Id: I2923786337f97f4297b0444522c620891aa2ad90
Jira: STUDIO-9725 filament menu delete icon
Jira: STUDIO-9785 StaticGroup border color
Jira: STUDIO-9716 update badge icon
Jira: STUDIO-9815 click printer/bed panel for combobox
Jira: STUDIO-9867 label with for single noozle
Jira: STUDIO-9739 ams page up/down
This commit is contained in:
chunmao.guo 2025-01-15 15:40:27 +08:00 committed by lane.wei
parent e563b30b4d
commit 1cde0b844a
12 changed files with 117 additions and 52 deletions

View File

@ -1,4 +1,4 @@
<svg width="19" height="18" viewBox="0 0 19 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0.410156 0H18.4102V18L9.09255 8.93403L0.410156 0Z" fill="#00AE42"/>
<path d="M16.7686 3.1416C16.9574 3.3304 16.9574 3.63568 16.7686 3.82247L11.4662 9.12687C11.2774 9.31567 10.9721 9.31567 10.7853 9.12687L8.05175 6.39534C7.86296 6.20654 7.86296 5.90125 8.05175 5.71446C8.24055 5.52767 8.54584 5.52566 8.73263 5.71446L11.1227 8.10455L16.0857 3.1416C16.2745 2.9528 16.5798 2.9528 16.7666 3.1416H16.7686Z" fill="white"/>
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H14C16.2091 0 18 1.79086 18 4V18L8.2784 8.45085L0 0Z" fill="#ACACAC"/>
<path d="M16.3579 3.1416C16.5467 3.3304 16.5467 3.63568 16.3579 3.82247L11.0555 9.12687C10.8667 9.31567 10.5614 9.31567 10.3747 9.12687L7.64111 6.39534C7.45231 6.20654 7.45231 5.90125 7.64111 5.71446C7.82991 5.52767 8.1352 5.52566 8.32198 5.71446L10.7121 8.10455L15.675 3.1416C15.8638 2.9528 16.1691 2.9528 16.3559 3.1416H16.3579Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 530 B

After

Width:  |  Height:  |  Size: 534 B

View File

@ -1,3 +1,3 @@
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.48881 14.3817C7.05222 14.3817 5.67447 13.811 4.65865 12.7952C3.64283 11.7793 3.07214 10.4016 3.07214 8.96501C3.07214 7.52842 3.64283 6.15067 4.65865 5.13484C5.67447 4.11902 7.05222 3.54834 8.48881 3.54834C9.9254 3.54834 11.3032 4.11902 12.319 5.13484C13.3348 6.15067 13.9055 7.52842 13.9055 8.96501C13.9055 10.4016 13.3348 11.7793 12.319 12.7952C11.3032 13.811 9.9254 14.3817 8.48881 14.3817ZM8.48881 2.29834C6.7207 2.29834 5.02501 3.00072 3.77477 4.25096C2.52452 5.5012 1.82214 7.1969 1.82214 8.96501C1.82214 10.7331 2.52452 12.4288 3.77477 13.6791C5.02501 14.9293 6.7207 15.6317 8.48881 15.6317C10.2569 15.6317 11.9526 14.9293 13.2029 13.6791C14.4531 12.4288 15.1555 10.7331 15.1555 8.96501C15.1555 7.1969 14.4531 5.5012 13.2029 4.25096C11.9526 3.00072 10.2569 2.29834 8.48881 2.29834ZM5.33777 8.57438L8.0461 11.2827C8.29089 11.5275 8.68673 11.5275 8.92891 11.2827L11.6399 8.57438C11.8846 8.32959 11.8846 7.93376 11.6399 7.69157C11.3951 7.44938 10.9992 7.44678 10.757 7.69157L8.49141 9.95719L6.22579 7.69157C5.981 7.44678 5.58516 7.44678 5.34298 7.69157C5.10079 7.93636 5.09819 8.33219 5.34298 8.57438H5.33777Z" fill="#6B6B6B"/>
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.99984 11.7394C5.74282 11.7394 4.53729 11.2401 3.64845 10.3512C2.7596 9.46238 2.26025 8.25685 2.26025 6.99984C2.26025 5.74282 2.7596 4.53729 3.64845 3.64845C4.53729 2.7596 5.74282 2.26025 6.99984 2.26025C8.25685 2.26025 9.46238 2.7596 10.3512 3.64845C11.2401 4.53729 11.7394 5.74282 11.7394 6.99984C11.7394 8.25685 11.2401 9.46238 10.3512 10.3512C9.46238 11.2401 8.25685 11.7394 6.99984 11.7394ZM6.99984 1.1665C5.45274 1.1665 3.96901 1.78109 2.87505 2.87505C1.78109 3.96901 1.1665 5.45274 1.1665 6.99984C1.1665 8.54693 1.78109 10.0307 2.87505 11.1246C3.96901 12.2186 5.45274 12.8332 6.99984 12.8332C8.54693 12.8332 10.0307 12.2186 11.1246 11.1246C12.2186 10.0307 12.8332 8.54693 12.8332 6.99984C12.8332 5.45274 12.2186 3.96901 11.1246 2.87505C10.0307 1.78109 8.54693 1.1665 6.99984 1.1665ZM4.24268 6.65804L6.61247 9.02783C6.82666 9.24202 7.17301 9.24202 7.38493 9.02783L9.757 6.65804C9.97119 6.44385 9.97119 6.09749 9.757 5.88558C9.54281 5.67367 9.19645 5.67139 8.98454 5.88558L7.00212 7.868L5.01969 5.88558C4.8055 5.67139 4.45915 5.67139 4.24723 5.88558C4.03532 6.09977 4.03304 6.44613 4.24723 6.65804H4.24268Z" fill="#6B6B6B"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,3 +1,3 @@
<svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.00016 3.2666C9.43675 3.2666 10.8145 3.83728 11.8303 4.85311C12.8461 5.86893 13.4168 7.24668 13.4168 8.68327C13.4168 10.1199 12.8461 11.4976 11.8303 12.5134C10.8145 13.5293 9.43675 14.0999 8.00016 14.0999C6.56357 14.0999 5.18582 13.5293 4.17 12.5134C3.15418 11.4976 2.5835 10.1199 2.5835 8.68327C2.5835 7.24668 3.15418 5.86893 4.17 4.85311C5.18582 3.83728 6.56357 3.2666 8.00016 3.2666ZM8.00016 15.3499C9.76827 15.3499 11.464 14.6476 12.7142 13.3973C13.9645 12.1471 14.6668 10.4514 14.6668 8.68327C14.6668 6.91516 13.9645 5.21947 12.7142 3.96922C11.464 2.71898 9.76827 2.0166 8.00016 2.0166C6.23205 2.0166 4.53636 2.71898 3.28612 3.96922C2.03588 5.21947 1.3335 6.91516 1.3335 8.68327C1.3335 10.4514 2.03588 12.1471 3.28612 13.3973C4.53636 14.6476 6.23205 15.3499 8.00016 15.3499ZM11.1512 9.07389L8.44287 6.36556C8.19808 6.12077 7.80225 6.12077 7.56006 6.36556L4.84912 9.07389C4.60433 9.31869 4.60433 9.71452 4.84912 9.95671C5.09391 10.1989 5.48975 10.2015 5.73193 9.95671L7.99756 7.69108L10.2632 9.95671C10.508 10.2015 10.9038 10.2015 11.146 9.95671C11.3882 9.71191 11.3908 9.31608 11.146 9.07389H11.1512Z" fill="#6B6B6B"/>
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.99984 2.26025C8.25685 2.26025 9.46238 2.7596 10.3512 3.64845C11.2401 4.53729 11.7394 5.74282 11.7394 6.99984C11.7394 8.25685 11.2401 9.46238 10.3512 10.3512C9.46238 11.2401 8.25685 11.7394 6.99984 11.7394C5.74282 11.7394 4.53729 11.2401 3.64845 10.3512C2.7596 9.46238 2.26025 8.25685 2.26025 6.99984C2.26025 5.74282 2.7596 4.53729 3.64845 3.64845C4.53729 2.7596 5.74282 2.26025 6.99984 2.26025ZM6.99984 12.8332C8.54693 12.8332 10.0307 12.2186 11.1246 11.1246C12.2186 10.0307 12.8332 8.54693 12.8332 6.99984C12.8332 5.45274 12.2186 3.96901 11.1246 2.87505C10.0307 1.78109 8.54693 1.1665 6.99984 1.1665C5.45274 1.1665 3.96901 1.78109 2.87505 2.87505C1.78109 3.96901 1.1665 5.45274 1.1665 6.99984C1.1665 8.54693 1.78109 10.0307 2.87505 11.1246C3.96901 12.2186 5.45274 12.8332 6.99984 12.8332ZM9.757 7.34163L7.38721 4.97184C7.17301 4.75765 6.82666 4.75765 6.61475 4.97184L4.24268 7.34163C4.02848 7.55583 4.02848 7.90218 4.24268 8.11409C4.45687 8.32601 4.80322 8.32829 5.01514 8.11409L6.99756 6.13167L8.97998 8.11409C9.19417 8.32829 9.54053 8.32829 9.75244 8.11409C9.96436 7.8999 9.96663 7.55355 9.75244 7.34163H9.757Z" fill="#6B6B6B"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1031,9 +1031,9 @@ static void generic_exception_handle()
std::terminate();
//throw;
} catch (const std::exception& ex) {
wxLogError(format_wxstr(_L("BambuStudio got an unhandled exception: %1%"), ex.what()));
BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what();
flush_logs();
wxLogError(format_wxstr(_L("BambuStudio got an unhandled exception: %1%"), ex.what()));
throw;
}
//#endif

View File

@ -1375,7 +1375,7 @@ void MenuFactory::create_filament_action_menu(bool init, int active_filament_men
if (init) {
append_menu_item(
menu, wxID_ANY, _L("Delete"), _L("Delete this filament"), [](wxCommandEvent&) {
plater()->sidebar().delete_filament(-2); }, "menu_delete", nullptr,
plater()->sidebar().delete_filament(-2); }, "", nullptr,
[]() { return plater()->sidebar().combos_filament().size() > 1; }, m_parent);
}

View File

@ -238,7 +238,7 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
m_remote_proto = 0;
m_model_download_support = false;
}
Enable(obj && obj->is_connected() && obj->m_push_count > 0);
Enable(obj && obj->is_info_ready() && obj->m_push_count > 0);
if (machine == m_machine) {
if ((m_waiting_enable && IsEnabled()) || (m_waiting_support && (m_local_proto || m_remote_proto))) {
auto fs = m_image_grid->GetFileSystem();

View File

@ -173,7 +173,7 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
m_remote_proto = 0;
m_device_busy = false;
}
Enable(obj && obj->is_connected() && obj->m_push_count > 0);
Enable(obj && obj->is_info_ready() && obj->m_push_count > 0);
if (machine == m_machine) {
if (m_last_state == MEDIASTATE_IDLE && IsEnabled())
Play();

View File

@ -352,12 +352,14 @@ struct ExtruderGroup : StaticGroup
wxStaticBoxSizer *sizer = nullptr;
ScalableButton * btn_edit = nullptr;
ComboBox * combo_diameter = nullptr;
ComboBox * combo_nozzle = nullptr;
ComboBox * combo_flow = nullptr;
AMSPreview * ams[4] = {nullptr};
wxStaticText *ams_not_installed_msg{nullptr};
ScalableButton *up_down_btn{nullptr};
ScalableButton * btn_up{nullptr};
ScalableButton * btn_down{nullptr};
wxBoxSizer *hsizer_ams { nullptr };
bool is_upward{false};
int page_cur{0};
int page_num{3};
int ams_n4 = 0;
int ams_n1 = 0;
wxString diameter;
@ -376,8 +378,10 @@ struct ExtruderGroup : StaticGroup
{
if (btn_edit)
btn_edit->msw_rescale();
btn_up->msw_rescale();
btn_down->msw_rescale();
combo_diameter->Rescale();
combo_nozzle->Rescale();
combo_flow->Rescale();
}
};
@ -872,29 +876,28 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
: StaticGroup(parent, wxID_ANY, title)
{
SetFont(Label::Body_10);
SetForegroundColour("#909090");
ShowBadge(true);
// Nozzle
wxStaticText *label_diameter = new wxStaticText(this, wxID_ANY, _L("Diameter"));
label_diameter->SetFont(Label::Body_14);
label_diameter->SetForegroundColour("#262E30");
label_diameter->SetMinSize({FromDIP(80), -1});
if (index >= 0) label_diameter->SetMinSize({FromDIP(80), -1});
auto combo_diameter = new ComboBox(this, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
this->combo_diameter = combo_diameter;
wxStaticText *label_nozzle = new wxStaticText(this, wxID_ANY, _L("Flow"));
label_nozzle->SetFont(Label::Body_14);
label_nozzle->SetForegroundColour("#262E30");
label_nozzle->SetMinSize({FromDIP(80), -1});
auto combo_nozzle = new ComboBox(this, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
combo_nozzle->GetDropDown().SetUseContentWidth(true);
combo_nozzle->Bind(wxEVT_COMBOBOX, [this, index, combo_nozzle](wxCommandEvent &evt) {
wxStaticText *label_flow = new wxStaticText(this, wxID_ANY, _L("Flow"));
label_flow->SetFont(Label::Body_14);
label_flow->SetForegroundColour("#262E30");
if (index >= 0) label_flow->SetMinSize({FromDIP(80), -1});
auto combo_flow = new ComboBox(this, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
combo_flow->GetDropDown().SetUseContentWidth(true);
combo_flow->Bind(wxEVT_COMBOBOX, [this, index, combo_flow](wxCommandEvent &evt) {
auto printer_tab = dynamic_cast<TabPrinter *>(wxGetApp().get_tab(Preset::TYPE_PRINTER));
printer_tab->set_extruder_volume_type(index, NozzleVolumeType(intptr_t(combo_nozzle->GetClientData(evt.GetInt()))));
printer_tab->set_extruder_volume_type(index, NozzleVolumeType(intptr_t(combo_flow->GetClientData(evt.GetInt()))));
if (GUI::wxGetApp().plater())
GUI::wxGetApp().plater()->update_machine_sync_status();
});
this->combo_nozzle = combo_nozzle;
this->combo_flow = combo_flow;
// AMS
wxStaticText *label_ams = new wxStaticText(this, wxID_ANY, _L("AMS"));
@ -915,7 +918,7 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
});
auto hovered = std::make_shared<wxWindow *>();
for (wxWindow *w : std::initializer_list<wxWindow *>{this, label_diameter, combo_diameter, label_nozzle, combo_nozzle, btn_edit, label_ams}) {
for (wxWindow *w : std::initializer_list<wxWindow *>{this, label_diameter, combo_diameter, label_flow, combo_flow, btn_edit, label_ams}) {
w->Bind(wxEVT_ENTER_WINDOW, [w, hovered, this](wxMouseEvent &evt) { *hovered = w; btn_edit->SetBitmap_("edit"); });
w->Bind(wxEVT_LEAVE_WINDOW, [w, hovered, this](wxMouseEvent &evt) { if (*hovered == w) { btn_edit->SetBitmap_("dot"); *hovered = nullptr; } });
}
@ -938,19 +941,28 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
if (btn_edit)
hsizer_ams->Add(btn_edit, 0, wxLEFT | wxALIGN_CENTER, FromDIP(2));
up_down_btn = new ScalableButton(this, wxID_ANY, "dot");
up_down_btn->SetBackgroundColour(*wxWHITE);
up_down_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) {
is_upward = !is_upward;
btn_up = new ScalableButton(this, wxID_ANY, "page_up", "", {-1, FromDIP(14)});
btn_up->SetBackgroundColour(*wxWHITE);
btn_up->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) {
if (page_cur > 0)
--page_cur;
update_ams();
});
btn_down = new ScalableButton(this, wxID_ANY, "page_down", "", {-1, FromDIP(14)});
btn_down->SetBackgroundColour(*wxWHITE);
btn_down->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) {
if (page_cur + 1 < page_num)
++page_cur;
update_ams();
});
wxBoxSizer *hsizer_diameter = new wxBoxSizer(wxHORIZONTAL);
hsizer_diameter->Add(label_diameter, 0, wxALIGN_CENTER);
hsizer_diameter->Add(combo_diameter, 1, wxEXPAND);
hsizer_diameter->Add(combo_diameter, 1, wxEXPAND | wxLEFT, FromDIP(2));
wxBoxSizer * hsizer_nozzle = new wxBoxSizer(wxHORIZONTAL);
hsizer_nozzle->Add(label_nozzle, 0, wxALIGN_CENTER);
hsizer_nozzle->Add(combo_nozzle, 1, wxEXPAND);
hsizer_nozzle->Add(label_flow, 0, wxALIGN_CENTER);
hsizer_nozzle->Add(combo_flow, 1, wxEXPAND | wxLEFT, FromDIP(2));
if (index < 0) {
label_ams->Hide();
ams_not_installed_msg->Hide();
@ -973,8 +985,8 @@ void ExtruderGroup::update_ams()
{
int display_capacity = 8;
if (ams_n4 * 4 + ams_n1 * 2 <= 8)
is_upward = false;
//if (ams_n4 * 4 + ams_n1 * 2 <= 8)
// is_upward = false;
std::vector<wxColour> colors = {
wxColour(255, 110, 100),
@ -983,7 +995,7 @@ void ExtruderGroup::update_ams()
wxColour(170, 111, 252)
};
bool display_front_ams = !is_upward;
bool display_front_ams = false; //!is_upward;
size_t i = 0;
for (; i < ams_n4 && i < 4; ++i) {
display_capacity -= 4;
@ -1025,7 +1037,7 @@ void ExtruderGroup::update_ams()
if (i == 0) {
ams_not_installed_msg->Show();
up_down_btn->Hide();
btn_up->Hide();
for (AMSPreview *a : ams) {
a->Close();
}
@ -1033,15 +1045,15 @@ void ExtruderGroup::update_ams()
ams_not_installed_msg->Hide();
for (; i < 4; ++i) { ams[i]->Close(); }
if (display_capacity < 0) {
up_down_btn->Show();
static ScalableBitmap down(this, "page_down", 16);
static ScalableBitmap up(this, "page_up", 16);
up_down_btn->SetBitmap(is_upward ? up.bmp() : down.bmp());
btn_up->Show();
} else {
up_down_btn->Hide();
btn_up->Hide();
}
}
btn_up->Show(page_cur > 0);
btn_down->Show(page_cur + 1 < page_num);
while (hsizer_ams->GetItemCount() > 2)
hsizer_ams->Remove(2);
if (ams_not_installed_msg->IsShown()) {
@ -1053,10 +1065,20 @@ void ExtruderGroup::update_ams()
if (ams[i]->IsShown())
hsizer_ams->Add(this->ams[i], 0, wxLEFT, FromDIP(2));
}
if (up_down_btn->IsShown()) {
if (btn_up->IsShown() || btn_down->IsShown()) {
if (btn_edit)
hsizer_ams->AddStretchSpacer(1);
hsizer_ams->Add(up_down_btn, 0, wxALIGN_CENTER | wxLEFT, FromDIP(2));
if (btn_up->IsShown() && btn_down->IsShown()) {
auto vsizer_btn = new wxBoxSizer(wxVERTICAL);
auto size = btn_up->GetSize();
vsizer_btn->Add(btn_up, 0);
vsizer_btn->Add(btn_down, 0);
hsizer_ams->Add(vsizer_btn, 0, wxALIGN_CENTER | wxLEFT, FromDIP(2));
} else if (btn_up->IsShown()) {
hsizer_ams->Add(btn_up, 0, wxALIGN_CENTER | wxLEFT, FromDIP(2));
} else {
hsizer_ams->Add(btn_down, 0, wxALIGN_CENTER | wxLEFT, FromDIP(2));
}
}
sizer->Layout();
@ -1205,7 +1227,7 @@ void Sidebar::priv::update_sync_status(const MachineObject *obj)
auto clear_all_sync_status = [this]() {
panel_printer_preset->ShowBadge(false);
panel_printer_bed->ShowBadge(false);
left_extruder->ShowBadge(false);
//left_extruder->ShowBadge(false);
right_extruder->ShowBadge(false);
single_extruder->ShowBadge(false);
};
@ -1454,6 +1476,9 @@ Sidebar::Sidebar(Plater *parent)
p->panel_printer_preset->SetCornerRadius(8);
p->panel_printer_preset->SetBorderColor(wxColour("#CECECE"));
p->panel_printer_preset->SetMinSize(PRINTER_PANEL_SIZE_SMALL);
p->panel_printer_preset->Bind(wxEVT_LEFT_DOWN, [this](auto & evt) {
p->combo_printer->wxEvtHandler::ProcessEvent(evt);
});
ScalableButton *edit_btn = new ScalableButton(p->panel_printer_preset, wxID_ANY, "dot");
edit_btn->SetToolTip(_L("Click to edit preset"));
@ -1468,6 +1493,10 @@ Sidebar::Sidebar(Plater *parent)
ScalableBitmap bitmap_printer(p->panel_printer_preset, "printer_placeholder", 48);
p->image_printer = new wxStaticBitmap(p->panel_printer_preset, wxID_ANY, bitmap_printer.bmp(), wxDefaultPosition, PRINTER_THUMBNAIL_SIZE, 0);
p->image_printer->Bind(wxEVT_LEFT_DOWN, [this](auto &evt) {
p->combo_printer->wxEvtHandler::ProcessEvent(evt);
});
PlaterPresetComboBox *combo_printer = new PlaterPresetComboBox(p->panel_printer_preset, Preset::TYPE_PRINTER);
combo_printer->SetWindowStyle(combo_printer->GetWindowStyle() & ~wxALIGN_MASK | wxALIGN_CENTER_HORIZONTAL);
combo_printer->SetBorderWidth(0);
@ -1495,6 +1524,9 @@ Sidebar::Sidebar(Plater *parent)
p->panel_printer_bed->SetCornerRadius(8);
p->panel_printer_bed->SetBorderColor(wxColour("#CECECE"));
p->panel_printer_bed->SetMinSize(PRINTER_PANEL_SIZE_SMALL);
p->panel_printer_bed->Bind(wxEVT_LEFT_DOWN, [this](auto &evt) {
p->combo_printer_bed->wxEvtHandler::ProcessEvent(evt);
});
ScalableButton *wiki_bed = new ScalableButton(p->panel_printer_bed, wxID_ANY, "dot");
wiki_bed->Bind(wxEVT_BUTTON, [](wxCommandEvent) {
@ -1503,6 +1535,9 @@ Sidebar::Sidebar(Plater *parent)
ScalableBitmap bitmap_bed(p->panel_printer_bed, "printer_placeholder", 32);
p->image_printer_bed = new wxStaticBitmap(p->panel_printer_bed, wxID_ANY, bitmap_bed.bmp(), wxDefaultPosition, wxDefaultSize, 0);
p->image_printer_bed->Bind(wxEVT_LEFT_DOWN, [this](auto &evt) {
p->combo_printer_bed->wxEvtHandler::ProcessEvent(evt);
});
p->combo_printer_bed = new ComboBox(p->panel_printer_bed, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY | wxALIGN_CENTER_HORIZONTAL);
p->combo_printer_bed->SetBorderWidth(0);
@ -2164,17 +2199,17 @@ void Sidebar::update_presets(Preset::Type preset_type)
auto nozzle_volumes_def = wxGetApp().preset_bundle->project_config.def()->get("nozzle_volume_type");
auto nozzle_volumes = wxGetApp().preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
auto update_extruder_variant = [extruders_def, extruders, nozzle_volumes_def, nozzle_volumes, extruder_variants](ExtruderGroup & extruder, int index) {
extruder.combo_nozzle->Clear();
extruder.combo_flow->Clear();
auto type = extruders_def->enum_labels[extruders->values[index]];
int select = -1;
for (size_t i = 0; i < nozzle_volumes_def->enum_labels.size(); ++i) {
if (boost::algorithm::contains(extruder_variants->values[index], type + " " + nozzle_volumes_def->enum_labels[i])) {
if (nozzle_volumes->values[index] == i)
select = extruder.combo_nozzle->GetCount();
extruder.combo_nozzle->Append(_L(nozzle_volumes_def->enum_labels[i]), {}, (void*)i);
select = extruder.combo_flow->GetCount();
extruder.combo_flow->Append(_L(nozzle_volumes_def->enum_labels[i]), {}, (void*)i);
}
}
extruder.combo_nozzle->SetSelection(select);
extruder.combo_flow->SetSelection(select);
};
auto diameters = wxGetApp().preset_bundle->printers.diameters_of_selected_printer();
auto diameter = printer_preset.config.opt_string("printer_variant");

View File

@ -194,7 +194,9 @@ void PresetComboBox::update_selection()
* there is no presets added to the list.
* So, select last combobox item ("Add/Remove preset")
*/
validate_selection();
//validate_selection();
if (m_last_selected == INT_MAX)
m_last_selected == 1;
SetSelection(m_last_selected);
#ifdef __WXMSW__

View File

@ -23,7 +23,7 @@ StaticBox::StaticBox()
{
border_color = StateColor(
std::make_pair(0xF0F0F1, (int) StateColor::Disabled),
std::make_pair(0x303A3C, (int) StateColor::Normal));
std::make_pair(0xCECECE, (int) StateColor::Normal));
}
StaticBox::StaticBox(wxWindow* parent,

View File

@ -3,6 +3,8 @@
StaticGroup::StaticGroup(wxWindow *parent, wxWindowID id, const wxString &label)
: wxStaticBox(parent, id, label)
{
SetBackgroundColour(*wxWHITE);
SetForegroundColour("#CECECE");
#ifdef __WXMSW__
Bind(wxEVT_PAINT, &StaticGroup::OnPaint, this);
#else
@ -30,4 +32,29 @@ void StaticGroup::OnPaint(wxPaintEvent &evt)
}
}
void StaticGroup::PaintForeground(wxDC &dc, const struct tagRECT &rc)
{
wxStaticBox::PaintForeground(dc, rc);
auto mdc = dynamic_cast<wxMemoryDC *>(&dc);
auto image = mdc->GetSelectedBitmap().ConvertToImage();
// Found border coords
int top = 0;
int left = 0;
int right = rc.right - 1;
int bottom = rc.bottom - 1;
auto blue = GetBackgroundColour().Blue();
while (image.GetBlue(0, top) == blue) ++top;
while (image.GetBlue(left, top) != blue) ++left; // --left; // fix start
while (image.GetBlue(right, top) != blue) --right; ++right;
while (image.GetBlue(0, bottom) == blue) --bottom;
// Draw border with foreground color
wxPoint polygon[] = { {left, top}, {0, top}, {0, bottom}, {rc.right - 1, bottom}, {rc.right - 1, top}, {right, top} };
dc.SetPen(wxPen(GetForegroundColour(), 1));
for (int i = 1; i < 6; ++i) {
if (i == 4) // fix bottom right corner
++polygon[i - 1].y;
dc.DrawLine(polygon[i - 1], polygon[i]);
}
}
#endif

View File

@ -16,6 +16,7 @@ public:
private:
#ifdef __WXMSW__
void OnPaint(wxPaintEvent &evt);
void PaintForeground(wxDC &dc, const struct tagRECT &rc) override;
#endif
private: