mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 14:23:13 +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)
|
||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|
||||
{
|
||||
@ -4713,20 +4712,18 @@ PrintOptionItem::PrintOptionItem(wxWindow* parent, std::vector<POItem> ops, std:
|
||||
SetDoubleBuffered(true);
|
||||
#endif //__WINDOWS__
|
||||
|
||||
m_ops = ops;
|
||||
m_param = param;
|
||||
SetBackgroundColour(PRINT_OPT_ITEM_BG_GRAY);
|
||||
|
||||
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_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); });
|
||||
Bind(wxEVT_LEFT_DOWN, &PrintOptionItem::on_left_down, this);
|
||||
|
||||
m_selected_bk = ScalableBitmap(this, "print_options_bg", 22);
|
||||
|
||||
// update the options
|
||||
update_options(ops);
|
||||
}
|
||||
|
||||
void PrintOptionItem::OnPaint(wxPaintEvent& event)
|
||||
@ -4818,8 +4815,7 @@ void PrintOptionItem::doRender(wxDC& dc)
|
||||
|
||||
if (text_key == selected_key)
|
||||
{
|
||||
|
||||
const wxColour& clr = wxGetApp().dark_mode() ? StateColor::darkModeColorFor("#00AE42") : "#00AE42";
|
||||
const wxColour& clr = m_enable ? StateColor::darkModeColorFor("#00AE42") : StateColor::darkModeColorFor(wxColour(144, 144, 144));
|
||||
dc.SetPen(wxPen(clr));
|
||||
dc.SetTextForeground(clr);
|
||||
|
||||
@ -4831,7 +4827,7 @@ void PrintOptionItem::doRender(wxDC& dc)
|
||||
}
|
||||
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.SetTextForeground(clr);
|
||||
|
||||
|
@ -134,6 +134,7 @@ struct POItem
|
||||
bool operator==(const POItem &other) const { return key == other.key && value == other.value; }
|
||||
};
|
||||
|
||||
#define PRINT_OPT_WIDTH FromDIP(44)
|
||||
class PrintOptionItem : public wxPanel
|
||||
{
|
||||
public:
|
||||
@ -148,7 +149,8 @@ public:
|
||||
{
|
||||
m_ops = ops;
|
||||
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);
|
||||
SetMinSize(wxSize(width, height));
|
||||
SetMaxSize(wxSize(width, height));
|
||||
|
Loading…
x
Reference in New Issue
Block a user