mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-01 23:32:10 +00:00
Merge branch 'main' into dev/bbl-network-upd
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Slic3r { namespace GUI {
|
||||
|
||||
// ORCA standardize dialog buttons
|
||||
DialogButtons::DialogButtons(wxWindow* parent, std::vector<wxString> non_translated_labels, const wxString& primary_btn_translated_label)
|
||||
: wxWindow(parent, wxID_ANY)
|
||||
: wxPanel(parent, wxID_ANY)
|
||||
{
|
||||
m_parent = parent;
|
||||
m_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
@@ -73,8 +73,8 @@ Button* DialogButtons::GetAPPLY() {return GetButtonFromID(wxID_APPLY) ;}
|
||||
Button* DialogButtons::GetCONFIRM(){return GetButtonFromID(wxID_APPLY) ;}
|
||||
Button* DialogButtons::GetNO() {return GetButtonFromID(wxID_NO) ;}
|
||||
Button* DialogButtons::GetCANCEL() {return GetButtonFromID(wxID_CANCEL) ;}
|
||||
Button* DialogButtons::GetBACK() {return GetButtonFromID(wxID_BACKWARD);}
|
||||
Button* DialogButtons::GetFORWARD(){return GetButtonFromID(wxID_FORWARD) ;}
|
||||
Button* DialogButtons::GetRETURN() {return GetButtonFromID(wxID_BACKWARD);} // gets Return button
|
||||
Button* DialogButtons::GetNEXT() {return GetButtonFromID(wxID_FORWARD) ;}
|
||||
|
||||
void DialogButtons::SetPrimaryButton(wxString translated_label) {
|
||||
// use _L("Create") translated text for custom buttons
|
||||
@@ -92,8 +92,12 @@ void DialogButtons::SetPrimaryButton(wxString translated_label) {
|
||||
|
||||
m_primary = translated_label;
|
||||
|
||||
btn->SetFocus();
|
||||
// apply focus only if there is no focused element exist. this prevents stealing focus from input boxes
|
||||
if(m_parent->FindFocus() == nullptr)
|
||||
btn->SetFocus();
|
||||
|
||||
// we won't need color definations after button style management
|
||||
bool is_dark = wxGetApp().dark_mode();
|
||||
StateColor clr_bg = StateColor(
|
||||
std::pair(wxColour("#009688"), (int)StateColor::NotHovered),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
@@ -105,7 +109,8 @@ void DialogButtons::SetPrimaryButton(wxString translated_label) {
|
||||
btn->SetBackgroundColor(clr_bg);
|
||||
StateColor clr_br = StateColor(
|
||||
std::pair(wxColour("#009688"), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour("#26A69A"), (int)StateColor::Focused)
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour(is_dark ? "#26A69A" : "#00FFD4"), (int)StateColor::Focused)
|
||||
);
|
||||
btn->SetBorderColor(clr_br);
|
||||
StateColor clr_tx = StateColor(
|
||||
@@ -143,6 +148,7 @@ void DialogButtons::SetAlertButton(wxString translated_label) {
|
||||
btn->SetBackgroundColor(clr_bg);
|
||||
StateColor clr_br = StateColor(
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#26A69A"), (int)StateColor::Focused)
|
||||
);
|
||||
btn->SetBorderColor(clr_br);
|
||||
@@ -171,6 +177,7 @@ void DialogButtons::UpdateButtons() {
|
||||
);
|
||||
StateColor clr_br = StateColor(
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#26A69A"), (int)StateColor::Focused)
|
||||
);
|
||||
StateColor clr_tx = StateColor(
|
||||
@@ -205,6 +212,9 @@ void DialogButtons::UpdateButtons() {
|
||||
|
||||
m_sizer->AddStretchSpacer();
|
||||
|
||||
if(m_sizer->IsEmpty()) // add left margin if no button on left. fixes no gap on small windows
|
||||
m_sizer->AddSpacer(btn_gap);
|
||||
|
||||
for (Button* btn : m_buttons) // Right aligned
|
||||
if(!on_left(btn->GetId()))
|
||||
m_sizer->Add(btn, 0, wxRIGHT | wxTOP | wxBOTTOM | wxALIGN_CENTER_VERTICAL, btn_gap);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
class DialogButtons : public wxWindow{
|
||||
class DialogButtons : public wxPanel{
|
||||
public:
|
||||
|
||||
DialogButtons(wxWindow* parent, std::vector<wxString> non_translated_labels, const wxString& primary_btn_label = "");
|
||||
@@ -30,8 +30,8 @@ public:
|
||||
Button* GetCONFIRM();
|
||||
Button* GetNO();
|
||||
Button* GetCANCEL();
|
||||
Button* GetBACK();
|
||||
Button* GetFORWARD();
|
||||
Button* GetRETURN();
|
||||
Button* GetNEXT();
|
||||
|
||||
void SetPrimaryButton(wxString label);
|
||||
|
||||
@@ -75,7 +75,7 @@ private:
|
||||
{"replace" , wxID_REPLACE},
|
||||
{"replace all", wxID_REPLACE_ALL},
|
||||
// Navigation
|
||||
{"back" , wxID_BACKWARD},
|
||||
{"return" , wxID_BACKWARD}, // use return instead back. back mostly used as side of object in translations
|
||||
{"next" , wxID_FORWARD},
|
||||
// Alert / Negative
|
||||
{"remove" , wxID_REMOVE},
|
||||
|
||||
Reference in New Issue
Block a user