mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-29 01:33:15 +08:00
ENH: update the size control of print option item
jira: [STUDIO-11972] Change-Id: Ie45c0493098e233a3c45ae037c8a2d475a04ddf9
This commit is contained in:
parent
e8abfcea8e
commit
11989e6af0
@ -4705,7 +4705,6 @@ int PrintOption::getValueInt()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PRINT_OPT_WIDTH FromDIP(44)
|
|
||||||
PrintOptionItem::PrintOptionItem(wxWindow* parent, std::vector<POItem> ops, std::string param)
|
PrintOptionItem::PrintOptionItem(wxWindow* parent, std::vector<POItem> ops, std::string param)
|
||||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|
||||||
{
|
{
|
||||||
@ -4713,20 +4712,18 @@ PrintOptionItem::PrintOptionItem(wxWindow* parent, std::vector<POItem> ops, std:
|
|||||||
SetDoubleBuffered(true);
|
SetDoubleBuffered(true);
|
||||||
#endif //__WINDOWS__
|
#endif //__WINDOWS__
|
||||||
|
|
||||||
m_ops = ops;
|
|
||||||
m_param = param;
|
m_param = param;
|
||||||
SetBackgroundColour(PRINT_OPT_ITEM_BG_GRAY);
|
SetBackgroundColour(PRINT_OPT_ITEM_BG_GRAY);
|
||||||
|
|
||||||
Bind(wxEVT_PAINT, &PrintOptionItem::OnPaint, this);
|
Bind(wxEVT_PAINT, &PrintOptionItem::OnPaint, this);
|
||||||
auto width = ops.size() * PRINT_OPT_WIDTH + FromDIP(8);
|
|
||||||
auto height = FromDIP(22) + FromDIP(8);
|
|
||||||
SetMinSize(wxSize(width, height));
|
|
||||||
SetMaxSize(wxSize(width, height));
|
|
||||||
Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_HAND); });
|
Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_HAND); });
|
||||||
Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); });
|
Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); });
|
||||||
Bind(wxEVT_LEFT_DOWN, &PrintOptionItem::on_left_down, this);
|
Bind(wxEVT_LEFT_DOWN, &PrintOptionItem::on_left_down, this);
|
||||||
|
|
||||||
m_selected_bk = ScalableBitmap(this, "print_options_bg", 22);
|
m_selected_bk = ScalableBitmap(this, "print_options_bg", 22);
|
||||||
|
|
||||||
|
// update the options
|
||||||
|
update_options(ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintOptionItem::OnPaint(wxPaintEvent& event)
|
void PrintOptionItem::OnPaint(wxPaintEvent& event)
|
||||||
@ -4818,8 +4815,7 @@ void PrintOptionItem::doRender(wxDC& dc)
|
|||||||
|
|
||||||
if (text_key == selected_key)
|
if (text_key == selected_key)
|
||||||
{
|
{
|
||||||
|
const wxColour& clr = m_enable ? StateColor::darkModeColorFor("#00AE42") : StateColor::darkModeColorFor(wxColour(144, 144, 144));
|
||||||
const wxColour& clr = wxGetApp().dark_mode() ? StateColor::darkModeColorFor("#00AE42") : "#00AE42";
|
|
||||||
dc.SetPen(wxPen(clr));
|
dc.SetPen(wxPen(clr));
|
||||||
dc.SetTextForeground(clr);
|
dc.SetTextForeground(clr);
|
||||||
|
|
||||||
@ -4831,7 +4827,7 @@ void PrintOptionItem::doRender(wxDC& dc)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const wxColour& clr = wxGetApp().dark_mode() ? StateColor::darkModeColorFor(*wxBLACK) : *wxBLACK;
|
const wxColour& clr = m_enable ? StateColor::darkModeColorFor(*wxBLACK) : StateColor::darkModeColorFor(wxColour(144, 144, 144));
|
||||||
dc.SetPen(wxPen(clr));
|
dc.SetPen(wxPen(clr));
|
||||||
dc.SetTextForeground(clr);
|
dc.SetTextForeground(clr);
|
||||||
|
|
||||||
|
@ -134,6 +134,7 @@ struct POItem
|
|||||||
bool operator==(const POItem &other) const { return key == other.key && value == other.value; }
|
bool operator==(const POItem &other) const { return key == other.key && value == other.value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PRINT_OPT_WIDTH FromDIP(44)
|
||||||
class PrintOptionItem : public wxPanel
|
class PrintOptionItem : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -148,7 +149,8 @@ public:
|
|||||||
{
|
{
|
||||||
m_ops = ops;
|
m_ops = ops;
|
||||||
selected_key = "";
|
selected_key = "";
|
||||||
auto width = ops.size() * FromDIP(56) + FromDIP(8);
|
|
||||||
|
auto width = ops.size() * PRINT_OPT_WIDTH + FromDIP(8);
|
||||||
auto height = FromDIP(22) + FromDIP(8);
|
auto height = FromDIP(22) + FromDIP(8);
|
||||||
SetMinSize(wxSize(width, height));
|
SetMinSize(wxSize(width, height));
|
||||||
SetMaxSize(wxSize(width, height));
|
SetMaxSize(wxSize(width, height));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user