mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
ENH: update the size control of print option item
jira: [STUDIO-11972] Change-Id: Ie45c0493098e233a3c45ae037c8a2d475a04ddf9 (cherry picked from commit 11989e6af095564f7375e99b2ed88f66f6ca6985)
This commit is contained in:
@@ -4691,7 +4691,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)
|
||||||
{
|
{
|
||||||
@@ -4699,20 +4698,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)
|
||||||
@@ -4804,8 +4801,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);
|
||||||
|
|
||||||
@@ -4817,7 +4813,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);
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,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:
|
||||||
@@ -151,7 +152,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));
|
||||||
|
|||||||
Reference in New Issue
Block a user