FIX:use scalablebitmap replace wxbitmap

Change-Id: I4ca885051f309be4a7d9a6e08de097fe75847257
This commit is contained in:
tao wang 2022-07-27 17:40:07 +08:00 committed by Lane.Wei
parent 00ba515783
commit 9fc010512c
22 changed files with 187 additions and 186 deletions

View File

@ -17,8 +17,8 @@ AboutDialogLogo::AboutDialogLogo(wxWindow* parent)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
{
this->SetBackgroundColour(*wxWHITE);
this->logo = wxBitmap(from_u8(Slic3r::var("BambuStudio_192px.png")), wxBITMAP_TYPE_PNG);
this->SetMinSize(this->logo.GetSize());
this->logo = ScalableBitmap(this, Slic3r::var("BambuStudio_192px.png"), wxBITMAP_TYPE_PNG);
this->SetMinSize(this->logo.GetBmpSize());
this->Bind(wxEVT_PAINT, &AboutDialogLogo::onRepaint, this);
}
@ -29,9 +29,9 @@ void AboutDialogLogo::onRepaint(wxEvent &event)
dc.SetBackgroundMode(wxTRANSPARENT);
wxSize size = this->GetSize();
int logo_w = this->logo.GetWidth();
int logo_h = this->logo.GetHeight();
dc.DrawBitmap(this->logo, (size.GetWidth() - logo_w)/2, (size.GetHeight() - logo_h)/2, true);
int logo_w = this->logo.GetBmpWidth();
int logo_h = this->logo.GetBmpHeight();
dc.DrawBitmap(this->logo.bmp(), (size.GetWidth() - logo_w)/2, (size.GetHeight() - logo_h)/2, true);
event.Skip();
}

View File

@ -17,7 +17,7 @@ public:
AboutDialogLogo(wxWindow* parent);
private:
wxBitmap logo;
ScalableBitmap logo;
void onRepaint(wxEvent &event);
};

View File

@ -94,9 +94,9 @@ AuFile::AuFile(wxWindow *parent, fs::path file_path, wxString file_name, Auxilia
cover_text_right = _L("Rename");
cover_text_cover = _L("Cover");
m_file_cover = create_scaled_bitmap("auxiliary_cover", this, 50);
m_file_edit_mask = create_scaled_bitmap("auxiliary_edit_mask", this, 43);
m_file_delete = create_scaled_bitmap("auxiliary_delete", this, 28);
m_file_cover = ScalableBitmap(this, "auxiliary_cover", 50);
m_file_edit_mask = ScalableBitmap(this, "auxiliary_edit_mask", 43);
m_file_delete = ScalableBitmap(this, "auxiliary_delete", 28);
auto m_text_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(300), FromDIP(40)), wxTAB_TRAVERSAL);
m_text_panel->SetBackgroundColour(AUFILE_GREY300);
@ -183,7 +183,7 @@ void AuFile::PaintForeground(wxDC &dc)
wxSize size = wxSize(FromDIP(300), FromDIP(300));
if (m_hover) {
dc.DrawBitmap(m_file_edit_mask, 0, size.y - m_file_edit_mask.GetSize().y);
dc.DrawBitmap(m_file_edit_mask.bmp(), 0, size.y - m_file_edit_mask.GetBmpSize().y);
dc.SetFont(Label::Body_14);
dc.SetTextForeground(*wxWHITE);
if (m_type == MODEL_PICTURE) {
@ -191,14 +191,14 @@ void AuFile::PaintForeground(wxDC &dc)
auto sizet = dc.GetTextExtent(cover_text_left);
auto pos = wxPoint(0, 0);
pos.x = (size.x / 2 - sizet.x) / 2;
pos.y = (size.y - (m_file_edit_mask.GetSize().y + sizet.y) / 2);
pos.y = (size.y - (m_file_edit_mask.GetBmpSize().y + sizet.y) / 2);
dc.DrawText(cover_text_left, pos);
// right text
sizet = dc.GetTextExtent(cover_text_right);
pos = wxPoint(0, 0);
pos.x = size.x / 2 + (size.x / 2 - sizet.x) / 2;
pos.y = (size.y - (m_file_edit_mask.GetSize().y + sizet.y) / 2);
pos.y = (size.y - (m_file_edit_mask.GetBmpSize().y + sizet.y) / 2);
dc.DrawText(cover_text_right, pos);
// Split
@ -206,21 +206,21 @@ void AuFile::PaintForeground(wxDC &dc)
dc.SetBrush(AUFILE_GREY700);
pos = wxPoint(0, 0);
pos.x = size.x / 2 - 1;
pos.y = size.y - FromDIP(30) - (m_file_edit_mask.GetSize().y - FromDIP(30)) / 2;
pos.y = size.y - FromDIP(30) - (m_file_edit_mask.GetBmpSize().y - FromDIP(30)) / 2;
dc.DrawRectangle(pos.x, pos.y, 2, FromDIP(30));
} else {
// right text
auto sizet = dc.GetTextExtent(cover_text_right);
auto pos = wxPoint(0, 0);
pos.x = (size.x - sizet.x) / 2;
pos.y = (size.y - (m_file_edit_mask.GetSize().y + sizet.y) / 2);
pos.y = (size.y - (m_file_edit_mask.GetBmpSize().y + sizet.y) / 2);
dc.DrawText(cover_text_right, pos);
}
}
if (m_cover) {
dc.SetTextForeground(*wxWHITE);
dc.DrawBitmap(m_file_cover, size.x - m_file_cover.GetSize().x, 0);
dc.DrawBitmap(m_file_cover.bmp(), size.x - m_file_cover.GetBmpSize().x, 0);
dc.SetFont(Label::Body_12);
auto sizet = dc.GetTextExtent(cover_text_cover);
auto pos = wxPoint(0, 0);
@ -229,7 +229,7 @@ void AuFile::PaintForeground(wxDC &dc)
dc.DrawText(cover_text_cover, pos);
}
if (m_hover) { dc.DrawBitmap(m_file_delete, size.x - m_file_delete.GetSize().x - FromDIP(15), FromDIP(15)); }
if (m_hover) { dc.DrawBitmap(m_file_delete.bmp(), size.x - m_file_delete.GetBmpSize().x - FromDIP(15), FromDIP(15)); }
}
void AuFile::on_mouse_enter(wxMouseEvent &evt)
@ -337,7 +337,7 @@ void AuFile::on_mouse_left_up(wxMouseEvent &evt)
auto pos = evt.GetPosition();
// set cover
auto mask_size = m_file_edit_mask.GetSize();
auto mask_size = m_file_edit_mask.GetBmpSize();
auto cover_left = 0;
auto cover_top = size.y - mask_size.y;
auto cover_right = mask_size.x / 2;
@ -353,10 +353,10 @@ void AuFile::on_mouse_left_up(wxMouseEvent &evt)
if (pos.x > rename_left && pos.x < rename_right && pos.y > rename_top && pos.y < rename_bottom) { on_set_rename(); }
// close
auto close_left = size.x - m_file_delete.GetSize().x - FromDIP(15);
auto close_left = size.x - m_file_delete.GetBmpSize().x - FromDIP(15);
auto close_top = FromDIP(15);
auto close_right = size.x - FromDIP(15);
auto close_bottom = m_file_delete.GetSize().y + FromDIP(15);
auto close_bottom = m_file_delete.GetBmpSize().y + FromDIP(15);
if (pos.x > close_left && pos.x < close_right && pos.y > close_top && pos.y < close_bottom) { on_set_delete(); }
}
@ -449,9 +449,9 @@ AuFile::~AuFile() {}
void AuFile::msw_rescale()
{
m_file_cover = create_scaled_bitmap("auxiliary_cover", this, 50);
m_file_edit_mask = create_scaled_bitmap("auxiliary_edit_mask", this, 43);
m_file_delete = create_scaled_bitmap("auxiliary_delete", this, 28);
m_file_cover = ScalableBitmap(this, "auxiliary_cover", 50);
m_file_edit_mask = ScalableBitmap(this, "auxiliary_edit_mask", 43);
m_file_delete = ScalableBitmap(this, "auxiliary_delete", 28);
if (m_type == MODEL_PICTURE) {
if (m_file_path.empty()) { return;}

View File

@ -81,9 +81,9 @@ public:
wxString cover_text_right;
wxString cover_text_cover;
wxBitmap m_file_bitmap;
wxBitmap m_file_cover;
wxBitmap m_file_edit_mask;
wxBitmap m_file_delete;
ScalableBitmap m_file_cover;
ScalableBitmap m_file_edit_mask;
ScalableBitmap m_file_delete;
wxBitmap m_bitmap_excel;
wxBitmap m_bitmap_pdf;

View File

@ -139,10 +139,10 @@ CameraItem::CameraItem(wxWindow *parent,std::string off_normal, std::string on_n
SetDoubleBuffered(true);
#endif //__WINDOWS__
m_bitmap_on_normal = create_scaled_bitmap(on_normal, nullptr, 20);
m_bitmap_off_normal = create_scaled_bitmap(off_normal, nullptr, 20);
m_bitmap_on_hover = create_scaled_bitmap(on_hover, nullptr, 20);
m_bitmap_off_hover = create_scaled_bitmap(off_hover, nullptr, 20);
m_bitmap_on_normal = ScalableBitmap(this, on_normal, 20);
m_bitmap_off_normal = ScalableBitmap(this, off_normal, 20);
m_bitmap_on_hover = ScalableBitmap(this, on_hover, 20);
m_bitmap_off_hover = ScalableBitmap(this, off_hover, 20);
SetSize(wxSize(FromDIP(20), FromDIP(20)));
SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
@ -208,16 +208,16 @@ void CameraItem::doRender(wxDC &dc)
{
if (m_on) {
if (m_hover) {
dc.DrawBitmap(m_bitmap_on_hover, wxPoint((GetSize().x - m_bitmap_on_hover.GetSize().x) / 2, (GetSize().y - m_bitmap_on_hover.GetSize().y) / 2));
dc.DrawBitmap(m_bitmap_on_hover.bmp(), wxPoint((GetSize().x - m_bitmap_on_hover.GetBmpSize().x) / 2, (GetSize().y - m_bitmap_on_hover.GetBmpSize().y) / 2));
} else {
dc.DrawBitmap(m_bitmap_on_normal, wxPoint((GetSize().x - m_bitmap_on_normal.GetSize().x) / 2, (GetSize().y - m_bitmap_on_normal.GetSize().y) / 2));
dc.DrawBitmap(m_bitmap_on_normal.bmp(), wxPoint((GetSize().x - m_bitmap_on_normal.GetBmpSize().x) / 2, (GetSize().y - m_bitmap_on_normal.GetBmpSize().y) / 2));
}
} else {
if (m_hover) {
dc.DrawBitmap(m_bitmap_off_hover, wxPoint((GetSize().x - m_bitmap_off_hover.GetSize().x) / 2, (GetSize().y - m_bitmap_off_hover.GetSize().y) / 2));
dc.DrawBitmap(m_bitmap_off_hover.bmp(), wxPoint((GetSize().x - m_bitmap_off_hover.GetBmpSize().x) / 2, (GetSize().y - m_bitmap_off_hover.GetBmpSize().y) / 2));
} else {
dc.DrawBitmap(m_bitmap_off_normal, wxPoint((GetSize().x - m_bitmap_off_normal.GetSize().x) / 2, (GetSize().y - m_bitmap_off_normal.GetSize().y) / 2));
dc.DrawBitmap(m_bitmap_off_normal.bmp(), wxPoint((GetSize().x - m_bitmap_off_normal.GetBmpSize().x) / 2, (GetSize().y - m_bitmap_off_normal.GetBmpSize().y) / 2));
}
}
}

View File

@ -59,10 +59,10 @@ public:
MachineObject *m_obj{nullptr};
bool m_on{false};
bool m_hover{false};
wxBitmap m_bitmap_on_normal;
wxBitmap m_bitmap_on_hover;
wxBitmap m_bitmap_off_normal;
wxBitmap m_bitmap_off_hover;
ScalableBitmap m_bitmap_on_normal;
ScalableBitmap m_bitmap_on_hover;
ScalableBitmap m_bitmap_off_normal;
ScalableBitmap m_bitmap_off_hover;
void msw_rescale();
void set_switch(bool is_on);

View File

@ -102,15 +102,15 @@ MachineObjectPanel::MachineObjectPanel(wxWindow *parent, wxWindowID id, const wx
SetBackgroundColour(*wxWHITE);
m_unbind_img = create_scaled_bitmap("unbind", nullptr, 18);
m_edit_name_img = create_scaled_bitmap("edit_button", nullptr, 18);
m_select_unbind_img = create_scaled_bitmap("unbind_selected", nullptr, 18);
m_unbind_img = ScalableBitmap(this, "unbind", 18);
m_edit_name_img = ScalableBitmap(this, "edit_button", 18);
m_select_unbind_img = ScalableBitmap(this, "unbind_selected", 18);
m_printer_status_offline = create_scaled_bitmap("printer_status_offline", nullptr, 12);
m_printer_status_busy = create_scaled_bitmap("printer_status_busy", nullptr, 12);
m_printer_status_idle = create_scaled_bitmap("printer_status_idle", nullptr, 12);
m_printer_status_lock = create_scaled_bitmap("printer_status_lock", nullptr, 16);
m_printer_in_lan = create_scaled_bitmap("printer_in_lan", nullptr, 16);
m_printer_status_offline = ScalableBitmap(this, "printer_status_offline", 12);
m_printer_status_busy = ScalableBitmap(this, "printer_status_busy", 12);
m_printer_status_idle = ScalableBitmap(this, "printer_status_idle", 12);
m_printer_status_lock = ScalableBitmap(this, "printer_status_lock", 16);
m_printer_in_lan = ScalableBitmap(this, "printer_in_lan", 16);
this->Bind(wxEVT_ENTER_WINDOW, &MachineObjectPanel::on_mouse_enter, this);
this->Bind(wxEVT_LEAVE_WINDOW, &MachineObjectPanel::on_mouse_leave, this);
@ -188,9 +188,9 @@ void MachineObjectPanel::doRender(wxDC &dc)
if (m_state == PrinterState::IN_LAN) { dwbitmap = m_printer_in_lan; }
// dc.DrawCircle(left, size.y / 2, 3);
dc.DrawBitmap(dwbitmap, wxPoint(left, (size.y - dwbitmap.GetSize().y) / 2));
dc.DrawBitmap(dwbitmap.bmp(), wxPoint(left, (size.y - dwbitmap.GetBmpSize().y) / 2));
left += dwbitmap.GetSize().x + 8;
left += dwbitmap.GetBmpSize().x + 8;
dc.SetFont(Label::Body_13);
dc.SetBackgroundMode(wxTRANSPARENT);
dc.SetTextForeground(SELECT_MACHINE_GREY900);
@ -199,7 +199,7 @@ void MachineObjectPanel::doRender(wxDC &dc)
dev_name = from_u8(m_info->dev_name);
}
auto sizet = dc.GetTextExtent(dev_name);
auto text_end = size.x - m_unbind_img.GetSize().x - 30;
auto text_end = size.x - m_unbind_img.GetBmpSize().x - 30;
wxString finally_name = dev_name;
if (sizet.x > (text_end - left)) {
auto limit_width = text_end - left - dc.GetTextExtent("...").x - 15;
@ -221,13 +221,14 @@ void MachineObjectPanel::doRender(wxDC &dc)
if (m_show_bind) {
if (m_bind_state == ALLOW_UNBIND) {
left = size.x - m_unbind_img.GetSize().x - 6;
dc.DrawBitmap(m_select_unbind_img, left, (size.y - m_unbind_img.GetSize().y) / 2); }
left = size.x - m_unbind_img.GetBmpSize().x - 6;
dc.DrawBitmap(m_select_unbind_img.bmp(), left, (size.y - m_unbind_img.GetBmpSize().y) / 2);
}
}
if (m_show_edit) {
left = size.x - m_unbind_img.GetSize().x - 6 - m_edit_name_img.GetSize().x - 6;
dc.DrawBitmap(m_edit_name_img, left, (size.y - m_edit_name_img.GetSize().y) / 2);
left = size.x - m_unbind_img.GetBmpSize().x - 6 - m_edit_name_img.GetBmpSize().x - 6;
dc.DrawBitmap(m_edit_name_img.bmp(), left, (size.y - m_edit_name_img.GetBmpSize().y) / 2);
}
}
}
@ -256,10 +257,10 @@ void MachineObjectPanel::on_mouse_left_up(wxMouseEvent &evt)
if (m_is_my_devices) {
// show edit
if (m_show_edit) {
auto edit_left = GetSize().x - m_unbind_img.GetSize().x - 6 - m_edit_name_img.GetSize().x - 6;
auto edit_right = edit_left + m_edit_name_img.GetSize().x;
auto edit_top = (GetSize().y - m_edit_name_img.GetSize().y) / 2;
auto edit_bottom = (GetSize().y - m_edit_name_img.GetSize().y) / 2 + m_edit_name_img.GetSize().y;
auto edit_left = GetSize().x - m_unbind_img.GetBmpSize().x - 6 - m_edit_name_img.GetBmpSize().x - 6;
auto edit_right = edit_left + m_edit_name_img.GetBmpSize().x;
auto edit_top = (GetSize().y - m_edit_name_img.GetBmpSize().y) / 2;
auto edit_bottom = (GetSize().y - m_edit_name_img.GetBmpSize().y) / 2 + m_edit_name_img.GetBmpSize().y;
if ((evt.GetPosition().x >= edit_left && evt.GetPosition().x <= edit_right) && evt.GetPosition().y >= edit_top && evt.GetPosition().y <= edit_bottom) {
wxCommandEvent event(EVT_EDIT_PRINT_NAME);
event.SetEventObject(this);
@ -268,10 +269,10 @@ void MachineObjectPanel::on_mouse_left_up(wxMouseEvent &evt)
}
}
if (m_show_bind) {
auto left = GetSize().x - m_unbind_img.GetSize().x - 6;
auto right = left + m_unbind_img.GetSize().x;
auto top = (GetSize().y - m_unbind_img.GetSize().y) / 2;
auto bottom = (GetSize().y - m_unbind_img.GetSize().y) / 2 + m_unbind_img.GetSize().y;
auto left = GetSize().x - m_unbind_img.GetBmpSize().x - 6;
auto right = left + m_unbind_img.GetBmpSize().x;
auto top = (GetSize().y - m_unbind_img.GetBmpSize().y) / 2;
auto bottom = (GetSize().y - m_unbind_img.GetBmpSize().y) / 2 + m_unbind_img.GetBmpSize().y;
if ((evt.GetPosition().x >= left && evt.GetPosition().x <= right) && evt.GetPosition().y >= top && evt.GetPosition().y <= bottom) {
wxCommandEvent event(EVT_UNBIND_MACHINE, GetId());

View File

@ -114,20 +114,19 @@ private:
PrinterBindState m_bind_state;
PrinterState m_state;
wxBitmap m_unbind_img;
wxBitmap m_edit_name_img;
wxBitmap m_select_unbind_img;
ScalableBitmap m_unbind_img;
ScalableBitmap m_edit_name_img;
ScalableBitmap m_select_unbind_img;
wxBitmap m_printer_status_offline;
wxBitmap m_printer_status_busy;
wxBitmap m_printer_status_idle;
wxBitmap m_printer_status_lock;
wxBitmap m_printer_in_lan;
ScalableBitmap m_printer_status_offline;
ScalableBitmap m_printer_status_busy;
ScalableBitmap m_printer_status_idle;
ScalableBitmap m_printer_status_lock;
ScalableBitmap m_printer_in_lan;
MachineObject *m_info;
protected:
wxBitmap m_bitmap_type;
wxStaticBitmap *m_bitmap_info;
wxStaticBitmap *m_bitmap_bind;

View File

@ -159,13 +159,13 @@ void StatusBasePanel::init_bitmaps()
m_bitmap_item_prediction = create_scaled_bitmap("monitor_item_prediction", nullptr, 16);
m_bitmap_item_cost = create_scaled_bitmap("monitor_item_cost", nullptr, 16);
m_bitmap_item_print = create_scaled_bitmap("monitor_item_print", nullptr, 18);
m_bitmap_axis_home = create_scaled_bitmap("monitor_axis_home", nullptr, 32);
m_bitmap_lamp_on = create_scaled_bitmap("monitor_lamp_on", nullptr, 24);
m_bitmap_lamp_off = create_scaled_bitmap("monitor_lamp_off", nullptr, 24);
m_bitmap_fan_on = create_scaled_bitmap("monitor_fan_on", nullptr, 24);
m_bitmap_fan_off = create_scaled_bitmap("monitor_fan_off", nullptr, 24);
m_bitmap_speed = create_scaled_bitmap("monitor_speed", nullptr, 24);
m_bitmap_speed_active = create_scaled_bitmap("monitor_speed_active", nullptr, 24);
m_bitmap_axis_home = ScalableBitmap(this, "monitor_axis_home", 32);
m_bitmap_lamp_on = ScalableBitmap(this, "monitor_lamp_on", 24);
m_bitmap_lamp_off = ScalableBitmap(this, "monitor_lamp_off", 24);
m_bitmap_fan_on = ScalableBitmap(this, "monitor_fan_on", 24);
m_bitmap_fan_off = ScalableBitmap(this, "monitor_fan_off", 24);
m_bitmap_speed = ScalableBitmap(this, "monitor_speed", 24);
m_bitmap_speed_active = ScalableBitmap(this, "monitor_speed_active", 24);
m_thumbnail_placeholder = create_scaled_bitmap("monitor_placeholder", nullptr, 120);
m_thumbnail_sdcard = create_scaled_bitmap("monitor_sdcard_thumbnail", nullptr, 120);
//m_bitmap_camera = create_scaled_bitmap("monitor_camera", nullptr, 18);

View File

@ -70,13 +70,13 @@ protected:
wxBitmap m_bitmap_item_prediction;
wxBitmap m_bitmap_item_cost;
wxBitmap m_bitmap_item_print;
wxBitmap m_bitmap_speed;
wxBitmap m_bitmap_speed_active;
wxBitmap m_bitmap_axis_home;
wxBitmap m_bitmap_lamp_on;
wxBitmap m_bitmap_lamp_off;
wxBitmap m_bitmap_fan_on;
wxBitmap m_bitmap_fan_off;
ScalableBitmap m_bitmap_speed;
ScalableBitmap m_bitmap_speed_active;
ScalableBitmap m_bitmap_axis_home;
ScalableBitmap m_bitmap_lamp_on;
ScalableBitmap m_bitmap_lamp_off;
ScalableBitmap m_bitmap_fan_on;
ScalableBitmap m_bitmap_fan_off;
wxBitmap m_bitmap_extruder;
CameraRecordingStatus m_state_recording{CameraRecordingStatus::RECORDING_NONE};

View File

@ -33,13 +33,13 @@ TabButton::TabButton()
std::make_pair(*wxWHITE, (int) StateColor::Normal));
}
TabButton::TabButton(wxWindow *parent, wxString text, wxBitmap &bmp, long style, int iconSize)
TabButton::TabButton(wxWindow *parent, wxString text, ScalableBitmap &bmp, long style, int iconSize)
: TabButton()
{
Create(parent, text, bmp, style, iconSize);
}
bool TabButton::Create(wxWindow *parent, wxString text, wxBitmap &bmp, long style, int iconSize)
bool TabButton::Create(wxWindow *parent, wxString text, ScalableBitmap &bmp, long style, int iconSize)
{
StaticBox::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style);
state_handler.attach({&text_color, &border_color});
@ -47,7 +47,7 @@ bool TabButton::Create(wxWindow *parent, wxString text, wxBitmap &bmp, long styl
//BBS set default font
SetFont(Label::Body_14);
wxWindow::SetLabel(text);
this->icon = bmp.GetSubBitmap(wxRect(0, 0, bmp.GetWidth(), bmp.GetHeight()));
this->icon = bmp;
messureSize();
return true;
}
@ -92,9 +92,9 @@ void TabButton::SetBGColor(StateColor const &color)
Refresh();
}
void TabButton::SetBitmap(wxBitmap &bitmap)
void TabButton::SetBitmap(ScalableBitmap &bitmap)
{
this->icon = bitmap.GetSubBitmap(wxRect(0, 0, bitmap.GetWidth(), bitmap.GetHeight()));
this->icon = bitmap;
}
bool TabButton::Enable(bool enable)
@ -138,12 +138,12 @@ void TabButton::render(wxDC &dc)
// calc content size
wxSize szIcon;
wxSize szContent = textSize;
if (icon.IsOk()) {
if (icon.bmp().IsOk()) {
if (szContent.y > 0) {
// BBS norrow size between text and icon
szContent.x += 5;
}
szIcon = icon.GetSize();
szIcon = icon.GetBmpSize();
szContent.x += szIcon.x;
if (szIcon.y > szContent.y) szContent.y = szIcon.y;
}
@ -163,10 +163,10 @@ void TabButton::render(wxDC &dc)
dc.DrawText(text, pt);
}
if (icon.IsOk()) {
pt.x = size.x - icon.GetWidth() - paddingSize.y;
pt.y = (size.y - icon.GetHeight()) / 2;
dc.DrawBitmap(icon, pt);
if (icon.bmp().IsOk()) {
pt.x = size.x - icon.GetBmpWidth() - paddingSize.y;
pt.y = (size.y - icon.GetBmpHeight()) / 2;
dc.DrawBitmap(icon.bmp(), pt);
}
}
@ -179,12 +179,12 @@ void TabButton::messureSize()
return;
}
wxSize szContent = textSize;
if (this->icon.IsOk()) {
if (this->icon.bmp().IsOk()) {
if (szContent.y > 0) {
// BBS norrow size between text and icon
szContent.x += 5;
}
wxSize szIcon = this->icon.GetSize();
wxSize szIcon = this->icon.GetBmpSize();
szContent.x += szIcon.x;
if (szIcon.y > szContent.y) szContent.y = szIcon.y;
}

View File

@ -9,7 +9,7 @@ class TabButton : public StaticBox
wxSize textSize;
wxSize minSize;
wxSize paddingSize;
wxBitmap icon;
ScalableBitmap icon;
StateColor text_color;
StateColor border_color;
@ -18,9 +18,9 @@ class TabButton : public StaticBox
public:
TabButton();
TabButton(wxWindow *parent, wxString text, wxBitmap &icon, long style = 0, int iconSize = 0);
TabButton(wxWindow *parent, wxString text, ScalableBitmap &icon, long style = 0, int iconSize = 0);
bool Create(wxWindow *parent, wxString text, wxBitmap &icon, long style = 0, int iconSize = 0);
bool Create(wxWindow *parent, wxString text, ScalableBitmap &icon, long style = 0, int iconSize = 0);
void SetLabel(const wxString& label) override;
@ -34,7 +34,7 @@ public:
void SetBGColor(StateColor const &color);
void SetBitmap(wxBitmap &bitmap);
void SetBitmap(ScalableBitmap &bitmap);
bool Enable(bool enable = true);

View File

@ -38,7 +38,7 @@ TabButtonsListCtrl::TabButtonsListCtrl(wxWindow *parent, wxBoxSizer *side_tools)
m_btn_margin = 0;
m_line_margin = std::lround(0.1 * em);
m_arrow_img = create_scaled_bitmap("monitor_arrow", nullptr, 14);
m_arrow_img = ScalableBitmap(this, "monitor_arrow", 14);
m_sizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(m_sizer);
@ -87,7 +87,7 @@ void TabButtonsListCtrl::OnPaint(wxPaintEvent &)
void TabButtonsListCtrl::Rescale()
{
m_arrow_img = create_scaled_bitmap("monitor_arrow", nullptr, 14);
m_arrow_img = ScalableBitmap(this, "monitor_arrow", 14);
int em = em_unit(this);
for (TabButton *btn : m_pageButtons) {

View File

@ -5,6 +5,7 @@
#include <wx/bookctrl.h>
#include <wx/sizer.h>
#include "wxExtensions.hpp"
class ScalableButton;
@ -33,8 +34,8 @@ private:
wxWindow* m_parent;
wxFlexGridSizer* m_buttons_sizer;
wxBoxSizer* m_sizer;
wxBitmap m_arrow_img;
std::vector<TabButton*> m_pageButtons;
ScalableBitmap m_arrow_img;
std::vector<TabButton*> m_pageButtons;
int m_selection {-1};
int m_btn_margin;
int m_line_margin;

View File

@ -133,8 +133,8 @@ void AMSrefresh::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, con
Bind(wxEVT_LEAVE_WINDOW, &AMSrefresh::OnLeaveWindow, this);
Bind(wxEVT_LEFT_DOWN, &AMSrefresh::OnClick, this);
m_bitmap_normal = create_scaled_bitmap("ams_refresh_normal", this, 26);
m_bitmap_selected = create_scaled_bitmap("ams_refresh_selected", this, 26);
m_bitmap_normal = ScalableBitmap(this, "ams_refresh_normal", 26);
m_bitmap_selected = ScalableBitmap(this, "ams_refresh_selected", 26);
/* m_animationCtrl = new wxAnimationCtrl(this, wxID_ANY, wxNullAnimation, wxDefaultPosition, AMS_REFRESH_SIZE);
auto path = (boost::format("%1%/images/refresh.gif") % resources_dir()).str();
@ -213,17 +213,18 @@ void AMSrefresh::paintEvent(wxPaintEvent &evt)
auto colour = AMS_CONTROL_GRAY700;
if (!wxWindow::IsEnabled()) { colour = AMS_CONTROL_GRAY500; }
auto pot = wxPoint((size.x - m_bitmap_selected.GetSize().x) / 2, (size.y - m_bitmap_selected.GetSize().y) / 2);
auto pot = wxPoint((size.x - m_bitmap_selected.GetBmpSize().x) / 2, (size.y - m_bitmap_selected.GetBmpSize().y) / 2);
if (!m_play_loading) {
dc.DrawBitmap(m_selected ? m_bitmap_selected : m_bitmap_normal, pot);
dc.DrawBitmap(m_selected ? m_bitmap_selected.bmp() : m_bitmap_normal.bmp(), pot);
} else {
m_bitmap_rotation = create_scaled_bitmap("ams_refresh_normal", this, 26);
auto image = m_bitmap_rotation.ConvertToImage();
m_bitmap_rotation = ScalableBitmap(this, "ams_refresh_normal", 26);
auto image = m_bitmap_rotation.bmp().ConvertToImage();
wxPoint offset;
auto loading_img = image.Rotate(m_rotation_angle, wxPoint(image.GetWidth() / 2, image.GetHeight() / 2), true, &offset);
auto loading_bitmap = wxBitmap(loading_img);
dc.DrawBitmap( loading_bitmap, offset.x , offset.y);
ScalableBitmap loading_bitmap;
loading_bitmap.bmp() = wxBitmap(loading_img);
dc.DrawBitmap(loading_bitmap.bmp(), offset.x , offset.y);
}
dc.SetPen(wxPen(colour));
@ -246,8 +247,8 @@ void AMSrefresh::msw_rescale() { }
void AMSrefresh::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
m_bitmap_normal = create_scaled_bitmap("ams_refresh_normal", this, 26);
m_bitmap_selected = create_scaled_bitmap("ams_refresh_selected", this, 26);
m_bitmap_normal = ScalableBitmap(this, "ams_refresh_normal", 26);
m_bitmap_selected = ScalableBitmap(this, "ams_refresh_selected", 26);
}
/*************************************************
@ -269,7 +270,7 @@ void AMSextruderImage::msw_rescale()
{
//m_ams_extruder.SetSize(AMS_EXTRUDER_BITMAP_SIZE);
//auto image = m_ams_extruder.ConvertToImage();
m_ams_extruder = create_scaled_bitmap("monitor_ams_extruder", nullptr, 55);
m_ams_extruder = ScalableBitmap(this, "monitor_ams_extruder", 55);
Refresh();
}
@ -306,7 +307,7 @@ void AMSextruderImage::doRender(wxDC &dc)
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(m_colour);
dc.DrawRectangle(0, 0, size.x, size.y - FromDIP(5));
dc.DrawBitmap(m_ams_extruder, wxPoint( (size.x - m_ams_extruder.GetSize().x) / 2, (size.y - m_ams_extruder.GetSize().y) / 2 ));
dc.DrawBitmap(m_ams_extruder.bmp(), wxPoint((size.x - m_ams_extruder.GetBmpSize().x) / 2, (size.y - m_ams_extruder.GetBmpSize().y) / 2));
}
@ -315,7 +316,7 @@ AMSextruderImage::AMSextruderImage(wxWindow *parent, wxWindowID id, const wxPoin
wxWindow::Create(parent, id, pos, AMS_EXTRUDER_BITMAP_SIZE);
SetBackgroundColour(*wxWHITE);
m_ams_extruder = create_scaled_bitmap("monitor_ams_extruder", nullptr,55);
m_ams_extruder = ScalableBitmap(this, "monitor_ams_extruder",55);
SetSize(AMS_EXTRUDER_BITMAP_SIZE);
SetMinSize(AMS_EXTRUDER_BITMAP_SIZE);
@ -404,8 +405,8 @@ void AMSLib::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const w
wxBoxSizer *m_sizer_edit = new wxBoxSizer(wxHORIZONTAL);
m_bitmap_editable = create_scaled_bitmap("ams_editable", this, 14);
m_bitmap_editable_lifht = create_scaled_bitmap("ams_editable_light", this, 14);
m_bitmap_editable = ScalableBitmap(this, "ams_editable", 14);
m_bitmap_editable_lifht = ScalableBitmap(this, "ams_editable_light", 14);
m_sizer_body->Add(0, 0, 1, wxEXPAND, 0);
m_sizer_body->Add(m_sizer_edit, 0, wxALIGN_CENTER, 0);
@ -434,7 +435,7 @@ void AMSLib::on_left_down(wxMouseEvent &evt)
auto size = GetSize();
auto pos = evt.GetPosition();
auto left = FromDIP(20);
auto top = (size.y - FromDIP(10) - m_bitmap_editable_lifht.GetSize().y);
auto top = (size.y - FromDIP(10) - m_bitmap_editable_lifht.GetBmpSize().y);
auto right = size.x - FromDIP(20);
auto bottom = size.y - FromDIP(10);
@ -590,7 +591,7 @@ void AMSLib::doRender(wxDC &dc)
// edit icon
if (m_info.material_state != AMSCanType::AMS_CAN_TYPE_EMPTY && m_info.material_state != AMSCanType::AMS_CAN_TYPE_NONE
&& m_info.material_state == AMSCanType::AMS_CAN_TYPE_THIRDBRAND ) {
dc.DrawBitmap(temp_bitmap, (size.x - m_bitmap_editable.GetSize().x) / 2, ( size.y - FromDIP(10) - temp_bitmap.GetSize().y) );
dc.DrawBitmap(temp_bitmap.bmp(), (size.x - m_bitmap_editable.GetBmpSize().x) / 2, (size.y - FromDIP(10) - temp_bitmap.GetBmpSize().y));
}
}

View File

@ -160,9 +160,9 @@ protected:
bool m_play_loading = {false};
bool m_selected = {false};
wxBitmap m_bitmap_rotation;
wxBitmap m_bitmap_normal;
wxBitmap m_bitmap_selected;
ScalableBitmap m_bitmap_rotation;
ScalableBitmap m_bitmap_normal;
ScalableBitmap m_bitmap_selected;
wxString m_text;
wxBoxSizer * m_size_body;
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
@ -182,7 +182,7 @@ public:
void render(wxDC &dc);
bool m_turn_on = {false};
wxColour m_colour;
wxBitmap m_ams_extruder;
ScalableBitmap m_ams_extruder;
void doRender(wxDC &dc);
AMSextruderImage(wxWindow *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
~AMSextruderImage();
@ -200,7 +200,7 @@ public:
wxBoxSizer * m_bitmap_sizer{nullptr};
wxPanel * m_bitmap_panel{nullptr};
AMSextruderImage *m_amsSextruder{nullptr};
wxBitmap monitor_ams_extruder;
ScalableBitmap monitor_ams_extruder;
AMSextruder(wxWindow *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
~AMSextruder();
};
@ -228,8 +228,8 @@ public:
protected:
wxStaticBitmap *m_edit_bitmp = {nullptr};
wxStaticBitmap *m_edit_bitmp_light = {nullptr};
wxBitmap m_bitmap_editable;
wxBitmap m_bitmap_editable_lifht;
ScalableBitmap m_bitmap_editable;
ScalableBitmap m_bitmap_editable_lifht;
bool m_unable_selected = {false};
bool m_enable = {false};
bool m_selected = {false};

View File

@ -24,7 +24,7 @@ END_EVENT_TABLE()
#define BLANK_SIZE FromDIP(23)
#define GAP_SIZE FromDIP(4)
AxisCtrlButton::AxisCtrlButton(wxWindow *parent, wxBitmap &icon, long stlye)
AxisCtrlButton::AxisCtrlButton(wxWindow *parent, ScalableBitmap &icon, long stlye)
: wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, stlye)
, r_outer(OUTER_SIZE)
, r_inner(INNER_SIZE)
@ -36,7 +36,7 @@ AxisCtrlButton::AxisCtrlButton(wxWindow *parent, wxBitmap &icon, long stlye)
, text_color(std::make_pair(0x6B6B6B, (int) StateColor::Disabled), std::make_pair(*wxBLACK, (int) StateColor::Normal))
, state_handler(this)
{
m_icon = icon.GetSubBitmap(wxRect(0, 0, icon.GetWidth(), icon.GetHeight()));
m_icon = icon;
wxWindow::SetBackgroundColour(parent->GetBackgroundColour());
border_color.append(bd, StateColor::Hovered);
@ -119,9 +119,9 @@ void AxisCtrlButton::SetInnerBackgroundColor(StateColor const& color)
Refresh();
}
void AxisCtrlButton::SetBitmap(wxBitmap &bmp)
void AxisCtrlButton::SetBitmap(ScalableBitmap &bmp)
{
m_icon = bmp.GetSubBitmap(wxRect(0, 0, bmp.GetWidth(), bmp.GetHeight()));
m_icon = bmp;
}
void AxisCtrlButton::Rescale() {
@ -210,8 +210,8 @@ void AxisCtrlButton::render(wxDC& dc)
}
gc->DrawPath(home_path);
if (m_icon.IsOk()) {
gc->DrawBitmap(m_icon, -1 * m_icon.GetWidth() / 2, -1 * m_icon.GetHeight() / 2, m_icon.GetWidth(), m_icon.GetHeight());
if (m_icon.bmp().IsOk()) {
gc->DrawBitmap(m_icon.bmp(), -1 * m_icon.GetBmpWidth() / 2, -1 * m_icon.GetBmpHeight() / 2, m_icon.GetBmpWidth(), m_icon.GetBmpHeight());
}
gc->PopState();

View File

@ -25,7 +25,7 @@ class AxisCtrlButton : public wxWindow
StateColor background_color;
StateColor inner_background_color;
wxBitmap m_icon;
ScalableBitmap m_icon;
bool pressedDown = false;
@ -45,7 +45,7 @@ class AxisCtrlButton : public wxWindow
};
public:
AxisCtrlButton(wxWindow *parent, wxBitmap &icon, long style = 0);
AxisCtrlButton(wxWindow *parent, ScalableBitmap &icon, long style = 0);
void SetMinSize(const wxSize& size) override;
@ -57,7 +57,7 @@ public:
void SetInnerBackgroundColor(StateColor const& color);
void SetBitmap(wxBitmap &bmp);
void SetBitmap(ScalableBitmap &bmp);
void Rescale();

View File

@ -18,13 +18,13 @@ END_EVENT_TABLE()
static const wxColour DEFAULT_HOVER_COL = wxColour(0, 174, 66);
static const wxColour DEFAULT_PRESS_COL = wxColour(238, 238, 238);
ImageSwitchButton::ImageSwitchButton(wxWindow *parent, wxBitmap &img_on, wxBitmap &img_off, long style)
ImageSwitchButton::ImageSwitchButton(wxWindow *parent, ScalableBitmap &img_on, ScalableBitmap &img_off, long style)
: text_color(std::make_pair(0x6B6B6B, (int) StateColor::Disabled), std::make_pair(*wxBLACK, (int) StateColor::Normal))
, state_handler(this)
{
m_padding = 0;
m_on = img_on.GetSubBitmap(wxRect(0, 0, img_on.GetWidth(), img_on.GetHeight()));
m_off = img_off.GetSubBitmap(wxRect(0, 0, img_off.GetWidth(), img_off.GetHeight()));
m_on = img_on;
m_off = img_off;
bg_color = StateColor(std::make_pair(DEFAULT_PRESS_COL, (int) StateColor::Pressed),
std::make_pair(*wxWHITE, (int) StateColor::Normal));
border_color = StateColor(std::make_pair(DEFAULT_HOVER_COL, (int) StateColor::Hovered));
@ -46,7 +46,7 @@ void ImageSwitchButton::SetLabels(wxString const &lbl_on, wxString const &lbl_of
Refresh();
}
void ImageSwitchButton::SetImages(wxBitmap &img_on, wxBitmap &img_off)
void ImageSwitchButton::SetImages(ScalableBitmap &img_on, ScalableBitmap &img_off)
{
m_on = img_on;
m_off = img_off;
@ -120,14 +120,14 @@ void ImageSwitchButton::render(wxDC& dc)
wxSize szIcon;
wxSize szContent = textSize;
wxBitmap &icon = GetValue() ? m_on: m_off;
ScalableBitmap &icon = GetValue() ? m_on : m_off;
int content_height = icon.GetHeight() + textSize.y + m_padding;
int content_height = icon.GetBmpHeight() + textSize.y + m_padding;
wxPoint pt = wxPoint((size.x - icon.GetWidth()) / 2, (size.y - content_height) / 2);
if (icon.IsOk()) {
dc.DrawBitmap(icon, pt);
pt.y += m_padding + icon.GetHeight();
wxPoint pt = wxPoint((size.x - icon.GetBmpWidth()) / 2, (size.y - content_height) / 2);
if (icon.bmp().IsOk()) {
dc.DrawBitmap(icon.bmp(), pt);
pt.y += m_padding + icon.GetBmpHeight();
}
pt.x = (size.x - textSize.x) / 2;
dc.SetFont(GetFont());

View File

@ -12,10 +12,10 @@
class ImageSwitchButton : public StaticBox
{
public:
ImageSwitchButton(wxWindow *parent, wxBitmap &img_on, wxBitmap &img_off, long style = 0);
ImageSwitchButton(wxWindow *parent, ScalableBitmap &img_on, ScalableBitmap &img_off, long style = 0);
void SetLabels(wxString const & lbl_on, wxString const & lbl_off);
void SetImages(wxBitmap &img_on, wxBitmap &img_off);
void SetImages(ScalableBitmap &img_on, ScalableBitmap &img_off);
void SetTextColor(StateColor const &color);
void SetBorderColor(StateColor const &color);
void SetBgColor(StateColor const &color);
@ -38,8 +38,8 @@ private:
DECLARE_EVENT_TABLE()
private:
wxBitmap m_on;
wxBitmap m_off;
ScalableBitmap m_on;
ScalableBitmap m_off;
bool m_on_off;
int m_padding; // size between icon and text
bool pressedDown = false;

View File

@ -14,17 +14,17 @@ namespace Slic3r { namespace GUI {
SetBackgroundColour(*wxWHITE);
m_printing_img = create_scaled_bitmap("printer", nullptr, 16);
m_arrow_img = create_scaled_bitmap("monitor_arrow", nullptr, 14);
m_printing_img = ScalableBitmap(this, "printer", 16);
m_arrow_img = ScalableBitmap(this, "monitor_arrow", 14);
m_none_printing_img = create_scaled_bitmap("tab_monitor_active", nullptr, 24);
m_none_arrow_img = create_scaled_bitmap("monitor_none_arrow", nullptr, 14);
m_none_add_img = create_scaled_bitmap("monitor_none_add", nullptr, 14);
m_none_printing_img = ScalableBitmap(this, "tab_monitor_active", 24);
m_none_arrow_img = ScalableBitmap(this, "monitor_none_arrow", 14);
m_none_add_img = ScalableBitmap(this, "monitor_none_add", 14);
m_wifi_none_img = create_scaled_bitmap("monitor_signal_no", nullptr, 18);
m_wifi_weak_img = create_scaled_bitmap("monitor_signal_weak", nullptr, 18);
m_wifi_middle_img = create_scaled_bitmap("monitor_signal_middle", nullptr, 18);
m_wifi_strong_img = create_scaled_bitmap("monitor_signal_strong", nullptr, 18);
m_wifi_none_img = ScalableBitmap(this, "monitor_signal_no", 18);
m_wifi_weak_img = ScalableBitmap(this, "monitor_signal_weak", 18);
m_wifi_middle_img = ScalableBitmap(this, "monitor_signal_middle", 18);
m_wifi_strong_img = ScalableBitmap(this, "monitor_signal_strong", 18);
m_intetval_timer = new wxTimer();
m_intetval_timer->SetOwner(this);
@ -131,12 +131,12 @@ void SideTools::doRender(wxDC &dc)
dc.SetBrush(SIDE_TOOLS_BRAND);
dc.DrawRectangle(0, 0, size.x, size.y);
dc.DrawBitmap(m_none_printing_img, left, (size.y - m_none_printing_img.GetSize().y) / 2);
dc.DrawBitmap(m_none_printing_img.bmp(), left, (size.y - m_none_printing_img.GetBmpSize().y) / 2);
left += (m_none_printing_img.GetSize().x + FromDIP(15));
dc.DrawBitmap(m_none_arrow_img, left, (size.y - m_none_arrow_img.GetSize().y) / 2);
left += (m_none_printing_img.GetBmpSize().x + FromDIP(15));
dc.DrawBitmap(m_none_arrow_img.bmp(), left, (size.y - m_none_arrow_img.GetBmpSize().y) / 2);
left += (m_none_arrow_img.GetSize().x + FromDIP(6));
left += (m_none_arrow_img.GetBmpSize().x + FromDIP(6));
dc.SetFont(::Label::Body_14);
dc.SetBackgroundMode(wxTRANSPARENT);
dc.SetTextForeground(*wxWHITE);
@ -144,21 +144,21 @@ void SideTools::doRender(wxDC &dc)
auto sizet = dc.GetTextExtent(_L("No printer"));
dc.DrawText(_L("No printer"), wxPoint(left, (size.y - sizet.y) / 2));
left = size.x - FromDIP(30) - m_wifi_none_img.GetSize().x;
dc.DrawBitmap(m_none_add_img, left, (size.y - m_none_add_img.GetSize().y) / 2);
left = size.x - FromDIP(30) - m_wifi_none_img.GetBmpSize().x;
dc.DrawBitmap(m_none_add_img.bmp(), left, (size.y - m_none_add_img.GetBmpSize().y) / 2);
} else {
dc.DrawBitmap(m_printing_img, left, (size.y - m_printing_img.GetSize().y) / 2);
dc.DrawBitmap(m_printing_img.bmp(), left, (size.y - m_printing_img.GetBmpSize().y) / 2);
left += (m_printing_img.GetSize().x + FromDIP(5));
dc.DrawBitmap(m_arrow_img, left, (size.y - m_arrow_img.GetSize().y) / 2);
left += (m_printing_img.GetBmpSize().x + FromDIP(5));
dc.DrawBitmap(m_arrow_img.bmp(), left, (size.y - m_arrow_img.GetBmpSize().y) / 2);
left += (m_arrow_img.GetSize().x + FromDIP(6));
left += (m_arrow_img.GetBmpSize().x + FromDIP(6));
dc.SetFont(::Label::Body_14);
dc.SetBackgroundMode(wxTRANSPARENT);
dc.SetTextForeground(SIDE_TOOLS_GREY900);
auto sizet = dc.GetTextExtent(m_dev_name);
auto text_end = size.x - m_wifi_none_img.GetSize().x - 20;
auto text_end = size.x - m_wifi_none_img.GetBmpSize().x - 20;
std::string finally_name = m_dev_name.ToStdString();
if (sizet.x > (text_end - left)) {
@ -175,11 +175,11 @@ void SideTools::doRender(wxDC &dc)
dc.DrawText(finally_name, wxPoint(left, (size.y - sizet.y) / 2));
left = size.x - FromDIP(18) - m_wifi_none_img.GetSize().x;
if (m_wifi_type == WifiSignal::NONE) dc.DrawBitmap(m_wifi_none_img, left, (size.y - m_wifi_none_img.GetSize().y) / 2);
if (m_wifi_type == WifiSignal::WEAK) dc.DrawBitmap(m_wifi_weak_img, left, (size.y - m_wifi_weak_img.GetSize().y) / 2);
if (m_wifi_type == WifiSignal::MIDDLE) dc.DrawBitmap(m_wifi_middle_img, left, (size.y - m_wifi_middle_img.GetSize().y) / 2);
if (m_wifi_type == WifiSignal::STRONG) dc.DrawBitmap(m_wifi_strong_img, left, (size.y - m_wifi_strong_img.GetSize().y) / 2);
left = size.x - FromDIP(18) - m_wifi_none_img.GetBmpSize().x;
if (m_wifi_type == WifiSignal::NONE) dc.DrawBitmap(m_wifi_none_img.bmp(), left, (size.y - m_wifi_none_img.GetBmpSize().y) / 2);
if (m_wifi_type == WifiSignal::WEAK) dc.DrawBitmap(m_wifi_weak_img.bmp(), left, (size.y - m_wifi_weak_img.GetBmpSize().y) / 2);
if (m_wifi_type == WifiSignal::MIDDLE) dc.DrawBitmap(m_wifi_middle_img.bmp(), left, (size.y - m_wifi_middle_img.GetBmpSize().y) / 2);
if (m_wifi_type == WifiSignal::STRONG) dc.DrawBitmap(m_wifi_strong_img.bmp(), left, (size.y - m_wifi_strong_img.GetBmpSize().y) / 2);
}
if (m_hover) {

View File

@ -33,20 +33,19 @@ private:
bool m_none_printer{true};
int last_printer_signal = 0;
wxBitmap m_printing_img;
wxBitmap m_arrow_img;
ScalableBitmap m_printing_img;
ScalableBitmap m_arrow_img;
wxBitmap m_none_printing_img;
wxBitmap m_none_arrow_img;
wxBitmap m_none_add_img;
ScalableBitmap m_none_printing_img;
ScalableBitmap m_none_arrow_img;
ScalableBitmap m_none_add_img;
wxBitmap m_wifi_none_img;
wxBitmap m_wifi_weak_img;
wxBitmap m_wifi_middle_img;
wxBitmap m_wifi_strong_img;
ScalableBitmap m_wifi_none_img;
ScalableBitmap m_wifi_weak_img;
ScalableBitmap m_wifi_middle_img;
ScalableBitmap m_wifi_strong_img;
protected:
wxBitmap m_bitmap_type;
wxStaticBitmap *m_bitmap_info;
wxStaticBitmap *m_bitmap_bind;
wxTimer * m_intetval_timer{nullptr};