mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-16 21:42:43 +00:00
Better safety if publish workflow crashes. Cleanup on Button
This commit is contained in:
@@ -80,7 +80,6 @@ bool Button::SetFont(const wxFont& font)
|
||||
|
||||
void Button::SetIcon(const wxString& icon)
|
||||
{
|
||||
custom_icon = wxNullBitmap;
|
||||
auto tmpBitmap = ScalableBitmap(this, icon.ToStdString(), this->active_icon.px_cnt());
|
||||
if (!icon.IsEmpty()) {
|
||||
//BBS set button icon default size to 20
|
||||
@@ -104,13 +103,6 @@ void Button::SetIcon(const wxBitmap& icon)
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void Button::SetBitmap(const wxBitmap& bitmap)
|
||||
{
|
||||
custom_icon = bitmap;
|
||||
messureSize();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void Button::SetMinSize(const wxSize& size)
|
||||
{
|
||||
minSize = size;
|
||||
@@ -310,8 +302,7 @@ void Button::render(wxDC& dc)
|
||||
}
|
||||
}
|
||||
auto szContent = textSize;
|
||||
const bool has_custom_icon = custom_icon.IsOk();
|
||||
if (has_custom_icon || icon.bmp().IsOk()) {
|
||||
if (icon.bmp().IsOk()) {
|
||||
if (szContent.y > 0) {
|
||||
//BBS norrow size between text and icon
|
||||
if (vertical)
|
||||
@@ -319,7 +310,7 @@ void Button::render(wxDC& dc)
|
||||
else
|
||||
szContent.x += spacing;
|
||||
}
|
||||
szIcon = has_custom_icon ? custom_icon.GetSize() : icon.GetBmpSize();
|
||||
szIcon = icon.GetBmpSize();
|
||||
if (vertical) {
|
||||
szContent.y += szIcon.y;
|
||||
if (szIcon.x > szContent.x) szContent.x = szIcon.x;
|
||||
@@ -342,12 +333,12 @@ void Button::render(wxDC& dc)
|
||||
}
|
||||
// start draw
|
||||
wxPoint pt = rcContent.GetLeftTop();
|
||||
if (has_custom_icon || icon.bmp().IsOk()) {
|
||||
if (icon.bmp().IsOk()) {
|
||||
if (vertical)
|
||||
pt.x += (rcContent.width - szIcon.x) / 2;
|
||||
else
|
||||
pt.y += (rcContent.height - szIcon.y) / 2;
|
||||
dc.DrawBitmap(has_custom_icon ? custom_icon : icon.bmp(), pt);
|
||||
dc.DrawBitmap(icon.bmp(), pt);
|
||||
//BBS norrow size between text and icon
|
||||
if (vertical) {
|
||||
pt.y += szIcon.y + spacing;
|
||||
@@ -380,7 +371,7 @@ void Button::messureSize()
|
||||
wxClientDC dc(this);
|
||||
dc.GetTextExtent(GetLabel(), &textSize.width, &textSize.height, &textSize.x, &textSize.y);
|
||||
wxSize szContent = textSize.GetSize();
|
||||
if (custom_icon.IsOk() || this->active_icon.bmp().IsOk()) {
|
||||
if (this->active_icon.bmp().IsOk()) {
|
||||
if (szContent.y > 0) {
|
||||
//BBS norrow size between text and icon
|
||||
if (vertical)
|
||||
@@ -388,7 +379,7 @@ void Button::messureSize()
|
||||
else
|
||||
szContent.x += 5;
|
||||
}
|
||||
wxSize szIcon = custom_icon.IsOk() ? custom_icon.GetSize() : this->active_icon.GetBmpSize();
|
||||
wxSize szIcon = this->active_icon.GetBmpSize();
|
||||
if (vertical) {
|
||||
szContent.y += szIcon.y;
|
||||
if (szIcon.x > szContent.x) szContent.x = szIcon.x;
|
||||
|
||||
Reference in New Issue
Block a user