ENH: add global map mode tag for pop up
1. Add tag to mark the global map mode 2. Fix some wrong usage of bmp in code 3. Fix display error in dark mode jira:STUDIO-9729 Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Idb36a5022c403e02c26d7fe23a95dd6877deca90
This commit is contained in:
parent
a4f7280e42
commit
5a2abf7e21
|
@ -0,0 +1,7 @@
|
|||
<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.07262 4.61082C3.35049 5.95191 2.88086 7.8561 2.88086 10.0005C2.88086 12.1449 3.35049 14.0491 4.07262 15.3902C4.8112 16.7618 5.70585 17.3755 6.50586 17.3755C7.30587 17.3755 8.20052 16.7618 8.9391 15.3902C9.66123 14.0491 10.1309 12.1449 10.1309 10.0005C10.1309 7.8561 9.66123 5.95191 8.9391 4.61082C8.20052 3.23918 7.30587 2.62549 6.50586 2.62549C5.70585 2.62549 4.8112 3.23918 4.07262 4.61082ZM2.75191 3.89967C3.59678 2.33064 4.88962 1.12549 6.50586 1.12549C8.1221 1.12549 9.41494 2.33064 10.2598 3.89967C11.1211 5.49925 11.6309 7.65756 11.6309 10.0005C11.6309 12.3434 11.1211 14.5017 10.2598 16.1013C9.41494 17.6703 8.1221 18.8755 6.50586 18.8755C4.88962 18.8755 3.59678 17.6703 2.75191 16.1013C1.8906 14.5017 1.38086 12.3434 1.38086 10.0005C1.38086 7.65756 1.8906 5.49925 2.75191 3.89967Z" fill="#262E30"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.8071 5H7.13086C6.09533 5 5.25586 6.84409 5.25586 10C5.25586 13.1559 6.09533 15 7.13086 15H11.8071C11.2267 13.6213 10.8809 11.8857 10.8809 10C10.8809 8.11434 11.2267 6.37871 11.8071 5Z" fill="#D9D9D9"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.0988 4.375H7.13086C6.19757 4.375 5.58064 5.18705 5.22406 6.08611C4.84543 7.04076 4.63086 8.37669 4.63086 10C4.63086 11.6233 4.84543 12.9592 5.22406 13.9139C5.58064 14.813 6.19757 15.625 7.13086 15.625H12.0988C11.9011 15.2423 11.7233 14.8237 11.5686 14.375H7.13086C7.02862 14.375 6.70804 14.265 6.38601 13.453C6.08602 12.6967 5.88086 11.5326 5.88086 10C5.88086 8.46739 6.08602 7.30333 6.38601 6.54696C6.70804 5.73499 7.02862 5.625 7.13086 5.625H11.5686C11.7233 5.1763 11.9011 4.75771 12.0988 4.375Z" fill="#262E30"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.8226 4.61082C12.1005 5.95191 11.6309 7.8561 11.6309 10.0005C11.6309 12.1449 12.1005 14.0491 12.8226 15.3902C13.5612 16.7618 14.4558 17.3755 15.2559 17.3755C16.0559 17.3755 16.9505 16.7618 17.6891 15.3902C18.4112 14.0491 18.8809 12.1449 18.8809 10.0005C18.8809 7.8561 18.4112 5.95191 17.6891 4.61082C16.9505 3.23918 16.0559 2.62549 15.2559 2.62549C14.4558 2.62549 13.5612 3.23918 12.8226 4.61082ZM11.5019 3.89967C12.3468 2.33064 13.6396 1.12549 15.2559 1.12549C16.8721 1.12549 18.1649 2.33064 19.0098 3.89967C19.8711 5.49925 20.3809 7.65756 20.3809 10.0005C20.3809 12.3434 19.8711 14.5017 19.0098 16.1013C18.1649 17.6703 16.8721 18.8755 15.2559 18.8755C13.6396 18.8755 12.3468 17.6703 11.5019 16.1013C10.6406 14.5017 10.1309 12.3434 10.1309 10.0005C10.1309 7.65756 10.6406 5.49925 11.5019 3.89967Z" fill="#262E30"/>
|
||||
<ellipse cx="15.2559" cy="10" rx="1.25" ry="2.5" fill="#D9D9D9" stroke="#262E30" stroke-width="0.6" stroke-linejoin="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -0,0 +1,4 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1.80954 5.50422L7.72079 8.46156C7.80268 8.50279 7.89272 8.52526 7.98438 8.52734C8.08282 8.52734 8.1486 8.49453 8.24704 8.46156L14.1575 5.50422C14.3545 5.40625 14.4531 5.20844 14.4531 5.01125C14.4531 4.81406 14.3217 4.61703 14.1575 4.51844L8.24626 1.56094C8.16823 1.52845 8.08454 1.51172 8.00001 1.51172C7.91548 1.51172 7.83179 1.52845 7.75376 1.56094L1.84251 4.51844C1.64548 4.61703 1.54688 4.81422 1.54688 5.01125C1.54688 5.20828 1.64548 5.40625 1.80954 5.50422ZM7.98438 2.67828L12.6469 5.01125L7.98438 7.34375L3.32032 5.01125L7.98438 2.67828ZM13.6127 10.4516L7.97001 13.2741L2.3272 10.4516C2.0647 10.3203 1.73673 10.4188 1.57266 10.7141C1.44141 10.9767 1.53985 11.3048 1.83516 11.4689L7.74032 14.422C7.8219 14.463 7.91155 14.4854 8.00282 14.4877C8.10126 14.4877 8.16688 14.4548 8.26516 14.422L14.1705 11.4688C14.433 11.3375 14.5641 11.0094 14.433 10.7139C14.2361 10.4188 13.908 10.3203 13.6127 10.4516Z" fill="#6B6B6B"/>
|
||||
<path d="M1.83516 8.49998L7.74032 11.4531C7.8219 11.4941 7.91155 11.5165 8.00282 11.5187C8.10126 11.5187 8.16688 11.4859 8.26516 11.4531L14.1705 8.49998C14.433 8.36873 14.5641 8.04061 14.433 7.74514C14.2361 7.44983 13.908 7.35139 13.6127 7.48264L7.97001 10.3053L2.3272 7.48279C2.0647 7.35154 1.73673 7.44998 1.57266 7.74529C1.44141 8.00795 1.53985 8.33608 1.83516 8.49998Z" fill="#6B6B6B"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
|
@ -24,10 +24,10 @@ CapsuleButton::CapsuleButton(wxWindow *parent, wxWindowID id, const wxString &la
|
|||
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
std::string icon_name = selected ? "capsule_tag_on" : "capsule_tag_off";
|
||||
auto bmp = create_scaled_bitmap(icon_name, nullptr, FromDIP(16));
|
||||
tag_on_bmp = create_scaled_bitmap("capsule_tag_on", nullptr, FromDIP(16));
|
||||
tag_off_bmp = create_scaled_bitmap("capsule_tag_off", nullptr, FromDIP(16));
|
||||
|
||||
m_btn = new wxBitmapButton(this, wxID_ANY, bmp, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
|
||||
m_btn = new wxBitmapButton(this, wxID_ANY, selected?tag_on_bmp:tag_off_bmp, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
|
||||
m_btn->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
m_label = new Label(this, label);
|
||||
|
@ -109,15 +109,13 @@ void CapsuleButton::OnLeaveWindow(wxMouseEvent &event)
|
|||
|
||||
void CapsuleButton::UpdateStatus()
|
||||
{
|
||||
std::string icon_name = m_selected ? "capsule_tag_on" : "capsule_tag_off";
|
||||
auto bmp = create_scaled_bitmap(icon_name, nullptr, FromDIP(16));
|
||||
m_btn->SetBitmap(bmp);
|
||||
|
||||
if (m_selected) {
|
||||
m_btn->SetBitmap(tag_on_bmp);
|
||||
m_label->SetForegroundColour(TextSelectColor);
|
||||
m_label->SetBackgroundColour(BgSelectColor);
|
||||
m_btn->SetBackgroundColour(BgSelectColor);
|
||||
} else {
|
||||
m_btn->SetBitmap(tag_off_bmp);
|
||||
m_label->SetForegroundColour(TextNormalColor);
|
||||
m_label->SetBackgroundColour(BgNormalColor);
|
||||
m_btn->SetBackgroundColour(BgNormalColor);
|
||||
|
|
|
@ -21,6 +21,9 @@ private:
|
|||
wxBitmapButton *m_btn;
|
||||
Label *m_label;
|
||||
|
||||
wxBitmap tag_on_bmp;
|
||||
wxBitmap tag_off_bmp;
|
||||
|
||||
bool m_hovered;
|
||||
bool m_selected;
|
||||
};
|
||||
|
|
|
@ -78,18 +78,23 @@ FilamentGroupPopup::FilamentGroupPopup(wxWindow *parent) : PopupWindow(parent, w
|
|||
button_labels.resize(ButtonType::btCount);
|
||||
button_desps.resize(ButtonType::btCount);
|
||||
detail_infos.resize(ButtonType::btCount);
|
||||
global_mode_tags.resize(ButtonType::btCount);
|
||||
|
||||
std::vector<wxString> btn_texts = {AutoForFlushLabel, AutoForMatchLabel, ManualLabel};
|
||||
std::vector<wxString> btn_desps = {AutoForFlushDesp, AutoForMatchDesp, ManualDesp};
|
||||
std::vector<wxString> mode_details = {AutoForFlushDetail, AutoForMatchDetail, ManualDetail};
|
||||
|
||||
top_sizer->AddSpacer(vertical_margin);
|
||||
|
||||
auto checked_bmp = create_scaled_bitmap("map_mode_on", nullptr, 16);
|
||||
auto unchecked_bmp = create_scaled_bitmap("map_mode_off", nullptr, 16);
|
||||
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);
|
||||
|
||||
for (size_t idx = 0; idx < ButtonType::btCount; ++idx) {
|
||||
wxBoxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
radio_btns[idx] = new wxBitmapButton(this, idx, unchecked_bmp, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
|
||||
radio_btns[idx] = new wxBitmapButton(this, wxID_ANY, unchecked_bmp, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
|
||||
radio_btns[idx]->SetBackgroundColour(BackGroundColor);
|
||||
|
||||
button_labels[idx] = new Label(this, btn_texts[idx]);
|
||||
|
@ -102,10 +107,16 @@ FilamentGroupPopup::FilamentGroupPopup(wxWindow *parent) : PopupWindow(parent, w
|
|||
button_desps[idx]->SetForegroundColour(LabelEnableColor);
|
||||
button_desps[idx]->SetFont(Label::Body_14);
|
||||
|
||||
button_sizer->Add(radio_btns[idx], 0, wxALIGN_CENTER_VERTICAL);
|
||||
global_mode_tags[idx] = new wxBitmapButton(this, wxID_ANY, global_tag_bmp, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
|
||||
global_mode_tags[idx]->SetBackgroundColour(BackGroundColor);
|
||||
global_mode_tags[idx]->SetToolTip(_L("Global settings"));
|
||||
|
||||
button_sizer->Add(radio_btns[idx], 0, wxALIGN_CENTER);
|
||||
button_sizer->AddSpacer(ratio_spacing);
|
||||
button_sizer->Add(button_labels[idx], 0, wxALIGN_CENTER_VERTICAL);
|
||||
button_sizer->Add(button_desps[idx], 0, wxALIGN_CENTER_VERTICAL);
|
||||
button_sizer->Add(button_labels[idx], 0, wxALIGN_CENTER);
|
||||
button_sizer->Add(button_desps[idx], 0, wxALIGN_CENTER);
|
||||
button_sizer->AddSpacer(ratio_spacing);
|
||||
button_sizer->Add(global_mode_tags[idx], 0, wxALIGN_CENTER);
|
||||
|
||||
wxBoxSizer *label_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
|
@ -170,23 +181,11 @@ void FilamentGroupPopup::DrawRoundedCorner(int radius)
|
|||
HWND hwnd = GetHWND();
|
||||
if (hwnd) {
|
||||
HRGN hrgn = CreateRoundRectRgn(0, 0, GetRect().GetWidth(), GetRect().GetHeight(), radius, radius);
|
||||
SetWindowRgn(hwnd, hrgn, TRUE);
|
||||
SetWindowRgn(hwnd, hrgn, FALSE);
|
||||
|
||||
SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||
SetLayeredWindowAttributes(hwnd, 0, 0, LWA_COLORKEY);
|
||||
}
|
||||
#else
|
||||
wxClientDC dc(this);
|
||||
wxGraphicsContext *gc = wxGraphicsContext::Create(dc);
|
||||
if (gc) {
|
||||
gc->SetBrush(*wxWHITE_BRUSH);
|
||||
gc->SetPen(*wxTRANSPARENT_PEN);
|
||||
wxRect rect(0, 0, GetSize().GetWidth(), GetSize().GetHeight());
|
||||
wxGraphicsPath path = wxGraphicsRenderer::GetDefaultRenderer()->CreatePath();
|
||||
path.AddRoundedRectangle(0, 0, rect.width, rect.height, radius);
|
||||
gc->DrawPath(path);
|
||||
delete gc;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -195,8 +194,6 @@ void FilamentGroupPopup::Init()
|
|||
const wxString AutoForMatchDesp = _L("(Arrange before slicing)");
|
||||
const wxString MachineSyncTip = _L("(Please sync printer)");
|
||||
|
||||
auto disabled_bmp = create_scaled_bitmap("map_mode_disabled", nullptr, 16);
|
||||
auto unchecked_bmp = create_scaled_bitmap("map_mode_off", nullptr, 16);
|
||||
radio_btns[ButtonType::btForMatch]->Enable(m_connected);
|
||||
if (m_connected) {
|
||||
button_labels[ButtonType::btForMatch]->SetForegroundColour(LabelEnableColor);
|
||||
|
@ -239,6 +236,7 @@ void FilamentGroupPopup::tryPopup(Plater* plater,PartPlate* partplate,bool skip_
|
|||
m_active = true;
|
||||
Init();
|
||||
ResetTimer();
|
||||
DrawRoundedCorner(16);
|
||||
PopupWindow::Popup();
|
||||
}
|
||||
}
|
||||
|
@ -308,13 +306,12 @@ void FilamentGroupPopup::OnEnterWindow(wxMouseEvent &) { ResetTimer(); }
|
|||
|
||||
void FilamentGroupPopup::UpdateButtonStatus(int hover_idx)
|
||||
{
|
||||
auto checked_bmp = create_scaled_bitmap("map_mode_on", nullptr, 16);
|
||||
auto unchecked_bmp = create_scaled_bitmap("map_mode_off", nullptr, 16);
|
||||
auto checked_hover_bmp = create_scaled_bitmap("map_mode_on_hovered", nullptr, 16);
|
||||
auto unchecked_hover_bmp = create_scaled_bitmap("map_mode_off_hovered", nullptr, 16);
|
||||
|
||||
|
||||
auto global_mode = plater_ref->get_global_filament_map_mode();
|
||||
for (int i = 0; i < ButtonType::btCount; ++i) {
|
||||
if (mode_list.at(i) == global_mode)
|
||||
global_mode_tags[i]->Show();
|
||||
else
|
||||
global_mode_tags[i]->Hide();
|
||||
if (ButtonType::btForMatch == i && !m_connected) {
|
||||
button_labels[i]->SetFont(Label::Body_14);
|
||||
continue;
|
||||
|
|
|
@ -48,11 +48,20 @@ private:
|
|||
FilamentMapMode m_mode;
|
||||
wxTimer *m_timer;
|
||||
|
||||
std::vector<wxBitmapButton *> radio_btns;
|
||||
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;
|
||||
|
||||
wxBitmap checked_bmp;
|
||||
wxBitmap unchecked_bmp;
|
||||
wxBitmap disabled_bmp;
|
||||
wxBitmap checked_hover_bmp;
|
||||
wxBitmap unchecked_hover_bmp;
|
||||
wxBitmap global_tag_bmp;
|
||||
|
||||
|
||||
wxStaticText *wiki_link;
|
||||
|
||||
PartPlate* partplate_ref{ nullptr };
|
||||
|
|
|
@ -91,8 +91,6 @@ bool try_pop_up_before_slice(bool skip_plate_sync, Plater* plater_ref, PartPlate
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static const StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
||||
|
|
|
@ -115,9 +115,10 @@ GUI::FilamentMapBtnPanel::FilamentMapBtnPanel(wxWindow *parent, const wxString &
|
|||
|
||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_icon_path = icon;
|
||||
auto bmp = create_scaled_bitmap(icon, nullptr, 20);
|
||||
m_btn = new wxBitmapButton(this, wxID_ANY, bmp, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
|
||||
icon_enabled = create_scaled_bitmap(icon, nullptr, 20);
|
||||
icon_disabled = create_scaled_bitmap(icon + "_disabled", nullptr, 20);
|
||||
|
||||
m_btn = new wxBitmapButton(this, wxID_ANY, icon_enabled, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
|
||||
m_btn->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
m_label = new wxStaticText(this, wxID_ANY, label);
|
||||
|
@ -204,13 +205,13 @@ void FilamentMapBtnPanel::UpdateStatus()
|
|||
m_detail->SetBackgroundColour(BgNormalColor);
|
||||
}
|
||||
if (!m_enabled) {
|
||||
m_btn->SetBitmap(create_scaled_bitmap(m_icon_path + "_disabled", nullptr, 20));
|
||||
m_btn->SetBitmap(icon_disabled);
|
||||
m_btn->SetForegroundColour(BgDisableColor);
|
||||
m_label->SetForegroundColour(TextDisableColor);
|
||||
m_detail->SetForegroundColour(TextDisableColor);
|
||||
}
|
||||
else {
|
||||
m_btn->SetBitmap(create_scaled_bitmap(m_icon_path, nullptr, 20));
|
||||
m_btn->SetBitmap(icon_enabled);
|
||||
m_btn->SetForegroundColour(BgNormalColor);
|
||||
m_label->SetForegroundColour(TextNormalBlackColor);
|
||||
m_detail->SetForegroundColour(TextNormalGreyColor);
|
||||
|
|
|
@ -52,6 +52,9 @@ private:
|
|||
|
||||
void UpdateStatus();
|
||||
|
||||
wxBitmap icon_enabled;
|
||||
wxBitmap icon_disabled;
|
||||
|
||||
wxBitmapButton *m_btn;
|
||||
wxStaticText *m_label;
|
||||
Label *m_detail;
|
||||
|
|
Loading…
Reference in New Issue