mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-11 16:00:17 -07:00
Update ScalableButton
change the signature and remove functions/vars pertaining to a default bmp fix TODOs in ScalableButton Original Commit: Prusa3D/PrusaSlicer@066b567 Co-authored-by: YuSanka <yusanka@gmail.com>
This commit is contained in:
parent
3a3301b051
commit
2b9cb53676
9 changed files with 20 additions and 38 deletions
|
|
@ -356,7 +356,7 @@ CaliPageCaption::CaliPageCaption(wxWindow* parent, CalibMode cali_mode,
|
|||
auto top_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
auto caption_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_prev_btn = new ScalableButton(this, wxID_ANY, "cali_page_caption_prev",
|
||||
wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true, 30);
|
||||
wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, 30);
|
||||
m_prev_btn->SetBackgroundColour(*wxWHITE);
|
||||
caption_sizer->Add(m_prev_btn, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(10));
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ CaliPageCaption::CaliPageCaption(wxWindow* parent, CalibMode cali_mode,
|
|||
caption_sizer->Add(title_text, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(10));
|
||||
|
||||
m_help_btn = new ScalableButton(this, wxID_ANY, "cali_page_caption_help",
|
||||
wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true, 30);
|
||||
wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, 30);
|
||||
m_help_btn->Hide();
|
||||
m_help_btn->SetBackgroundColour(*wxWHITE);
|
||||
caption_sizer->Add(m_help_btn, 0, wxALIGN_CENTER);
|
||||
|
|
@ -566,7 +566,7 @@ PAPageHelpPanel::PAPageHelpPanel(wxWindow* parent, bool ground_panel, wxWindowID
|
|||
wxBoxSizer* help_text_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto help_text = new Label(this, _L("You could change the Flow Dynamics Calibration Factor in material editing"));
|
||||
help_text->SetFont(Label::Body_14);
|
||||
m_help_btn = new ScalableButton(this, wxID_ANY, "cali_page_caption_help", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 24);
|
||||
m_help_btn = new ScalableButton(this, wxID_ANY, "cali_page_caption_help", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, 24);
|
||||
m_help_btn->SetBackgroundColour(m_help_btn->GetParent()->GetBackgroundColour());
|
||||
help_text_sizer->Add(help_text, 0, wxALIGN_CENTER | wxLEFT, left_align_padding);
|
||||
help_text_sizer->Add(m_help_btn, 0, wxALIGN_CENTER | wxLEFT, FromDIP(8));
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ void CalibrationPresetPage::create_selection_panel(wxWindow* parent)
|
|||
filament_for_text->SetFont(Label::Head_14);
|
||||
filament_for_title_sizer->Add(filament_for_text, 0, wxALIGN_CENTER);
|
||||
filament_for_title_sizer->AddSpacer(FromDIP(25));
|
||||
m_ams_sync_button = new ScalableButton(parent, wxID_ANY, "ams_fila_sync", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 18);
|
||||
m_ams_sync_button = new ScalableButton(parent, wxID_ANY, "ams_fila_sync", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, 18);
|
||||
m_ams_sync_button->SetBackgroundColour(*wxWHITE);
|
||||
m_ams_sync_button->SetToolTip(_L("Synchronize filament list from AMS"));
|
||||
filament_for_title_sizer->Add(m_ams_sync_button, 0, wxALIGN_CENTER);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace GUI {
|
|||
|
||||
wxBoxSizer* m_sizer_web_control = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
auto m_control_back = new ScalableButton(m_web_control_panel, wxID_ANY, "mall_control_back", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
auto m_control_back = new ScalableButton(m_web_control_panel, wxID_ANY, "mall_control_back", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
m_control_back->SetBackgroundColour(*wxWHITE);
|
||||
m_control_back->SetSize(wxSize(FromDIP(25), FromDIP(30)));
|
||||
m_control_back->SetMinSize(wxSize(FromDIP(25), FromDIP(30)));
|
||||
|
|
@ -47,7 +47,7 @@ namespace GUI {
|
|||
m_control_back->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCursor(wxCURSOR_ARROW));});
|
||||
|
||||
|
||||
auto m_control_forward = new ScalableButton(m_web_control_panel, wxID_ANY, "mall_control_forward", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
auto m_control_forward = new ScalableButton(m_web_control_panel, wxID_ANY, "mall_control_forward", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
m_control_forward->SetBackgroundColour(*wxWHITE);
|
||||
m_control_forward->SetSize(wxSize(FromDIP(25), FromDIP(30)));
|
||||
m_control_forward->SetMinSize(wxSize(FromDIP(25), FromDIP(30)));
|
||||
|
|
@ -57,7 +57,7 @@ namespace GUI {
|
|||
m_control_forward->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCursor(wxCURSOR_HAND)); });
|
||||
m_control_forward->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCursor(wxCURSOR_ARROW)); });
|
||||
|
||||
auto m_control_refresh = new ScalableButton(m_web_control_panel, wxID_ANY, "mall_control_refresh", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
auto m_control_refresh = new ScalableButton(m_web_control_panel, wxID_ANY, "mall_control_refresh", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
m_control_refresh->SetBackgroundColour(*wxWHITE);
|
||||
m_control_refresh->SetSize(wxSize(FromDIP(25), FromDIP(30)));
|
||||
m_control_refresh->SetMinSize(wxSize(FromDIP(25), FromDIP(30)));
|
||||
|
|
|
|||
|
|
@ -233,11 +233,11 @@ ParamsPanel::ParamsPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, c
|
|||
//m_search_btn->SetToolTip(format_wxstr(_L("Search in settings [%1%]"), "Ctrl+F"));
|
||||
//m_search_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &) { wxGetApp().plater()->search(false); });
|
||||
|
||||
m_compare_btn = new ScalableButton(m_top_panel, wxID_ANY, "compare", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
m_compare_btn = new ScalableButton(m_top_panel, wxID_ANY, "compare", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
m_compare_btn->SetToolTip(_L("Compare presets"));
|
||||
m_compare_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { wxGetApp().mainframe->diff_dialog.show(); }));
|
||||
|
||||
m_setting_btn = new ScalableButton(m_top_panel, wxID_ANY, "table", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
m_setting_btn = new ScalableButton(m_top_panel, wxID_ANY, "table", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
m_setting_btn->SetToolTip(_L("View all object's settings"));
|
||||
m_setting_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &) { wxGetApp().plater()->PopupObjectTable(-1, -1, {0, 0}); });
|
||||
|
||||
|
|
|
|||
|
|
@ -842,7 +842,7 @@ Sidebar::Sidebar(Plater *parent)
|
|||
bSizer39->Add(FromDIP(20), 0, 0, 0, 0);
|
||||
|
||||
ams_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "ams_fila_sync", wxEmptyString, wxDefaultSize, wxDefaultPosition,
|
||||
wxBU_EXACTFIT | wxNO_BORDER, false, 18);
|
||||
wxBU_EXACTFIT | wxNO_BORDER, 18);
|
||||
ams_btn->SetToolTip(_L("Synchronize filament list from AMS"));
|
||||
ams_btn->Bind(wxEVT_BUTTON, [this, scrolled_sizer](wxCommandEvent &e) {
|
||||
sync_ams_list();
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
|||
|
||||
bSizer_task_btn->Add(FromDIP(10), 0, 0);
|
||||
|
||||
m_button_pause_resume = new ScalableButton(m_panel_progress, wxID_ANY, "print_control_pause", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER,true);
|
||||
m_button_pause_resume = new ScalableButton(m_panel_progress, wxID_ANY, "print_control_pause", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
|
||||
m_button_pause_resume->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) {
|
||||
if (m_button_pause_resume->GetToolTipText() == _L("Pause")) {
|
||||
|
|
@ -286,7 +286,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
|||
}
|
||||
});
|
||||
|
||||
m_button_abort = new ScalableButton(m_panel_progress, wxID_ANY, "print_control_stop", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
m_button_abort = new ScalableButton(m_panel_progress, wxID_ANY, "print_control_stop", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
m_button_abort->SetToolTip(_L("Stop"));
|
||||
|
||||
m_button_abort->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) {
|
||||
|
|
@ -490,7 +490,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
|||
m_score_star.resize(5);
|
||||
for (int i = 0; i < m_score_star.size(); ++i) {
|
||||
m_score_star[i] = new ScalableButton(m_score_subtask_info, wxID_ANY, "score_star_dark", wxEmptyString, wxSize(FromDIP(26), FromDIP(26)), wxDefaultPosition,
|
||||
wxBU_EXACTFIT | wxNO_BORDER, true, 26);
|
||||
wxBU_EXACTFIT | wxNO_BORDER, 26);
|
||||
m_score_star[i]->Bind(wxEVT_LEFT_DOWN, [this, i](auto &e) {
|
||||
for (int j = 0; j < m_score_star.size(); ++j) {
|
||||
ScalableBitmap light_star = ScalableBitmap(nullptr, "score_star_light", 26);
|
||||
|
|
@ -4278,10 +4278,10 @@ wxBoxSizer *ScoreDialog::get_star_sizer()
|
|||
}
|
||||
if (i < m_star_count) {
|
||||
m_score_star[i] = new ScalableButton(this, wxID_ANY, "score_star_light", wxEmptyString, wxSize(FromDIP(26), FromDIP(26)), wxDefaultPosition,
|
||||
wxBU_EXACTFIT | wxNO_BORDER, true, 26);
|
||||
wxBU_EXACTFIT | wxNO_BORDER, 26);
|
||||
} else
|
||||
m_score_star[i] = new ScalableButton(this, wxID_ANY, "score_star_dark", wxEmptyString, wxSize(FromDIP(26), FromDIP(26)), wxDefaultPosition,
|
||||
wxBU_EXACTFIT | wxNO_BORDER, true, 26);
|
||||
wxBU_EXACTFIT | wxNO_BORDER, 26);
|
||||
|
||||
m_score_star[i]->Bind(wxEVT_LEFT_DOWN, [this, i](auto &e) {
|
||||
if (!m_success_printed && i >= 3) {
|
||||
|
|
|
|||
|
|
@ -540,7 +540,7 @@ void Tab::add_scaled_button(wxWindow* parent,
|
|||
const wxString& label/* = wxEmptyString*/,
|
||||
long style /*= wxBU_EXACTFIT | wxNO_BORDER*/)
|
||||
{
|
||||
*btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, style, true);
|
||||
*btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, style);
|
||||
(*btn)->SetBackgroundColour(parent->GetBackgroundColour());
|
||||
m_scaled_buttons.push_back(*btn);
|
||||
}
|
||||
|
|
@ -1686,7 +1686,7 @@ void Tab::build_preset_description_line(ConfigOptionsGroup* optgroup)
|
|||
|
||||
auto detach_preset_btn = [this](wxWindow* parent) {
|
||||
m_detach_preset_btn = new ScalableButton(parent, wxID_ANY, "lock_normal_sys", "",
|
||||
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
|
||||
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT);
|
||||
ScalableButton* btn = m_detach_preset_btn;
|
||||
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
|
||||
|
|
@ -4918,7 +4918,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
|||
deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
wxGetApp().UpdateDarkUI(deps.checkbox, false, true);
|
||||
deps.btn = new ScalableButton(parent, wxID_ANY, "printer", from_u8((boost::format(" %s %s") % _utf8(L("Set")) % std::string(dots.ToUTF8())).str()),
|
||||
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
|
||||
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT);
|
||||
deps.btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
deps.btn->SetSize(deps.btn->GetBestSize());
|
||||
|
||||
|
|
@ -4993,7 +4993,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
|||
wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
|
||||
{
|
||||
ScalableButton* btn = new ScalableButton(parent, wxID_ANY, "printer", " " + _(L("Set")) + " " + dots,
|
||||
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
|
||||
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT);
|
||||
btn->SetFont(wxGetApp().normal_font());
|
||||
btn->SetSize(btn->GetBestSize());
|
||||
|
||||
|
|
|
|||
|
|
@ -902,11 +902,9 @@ ScalableButton::ScalableButton( wxWindow * parent,
|
|||
const wxSize& size /* = wxDefaultSize*/,
|
||||
const wxPoint& pos /* = wxDefaultPosition*/,
|
||||
long style /*= wxBU_EXACTFIT | wxNO_BORDER*/,
|
||||
bool use_default_disabled_bitmap/* = false*/, //OcraftyoneTODO: removed by ps
|
||||
int bmp_px_cnt/* = 16*/) :
|
||||
m_parent(parent),
|
||||
m_current_icon_name(icon_name),
|
||||
m_use_default_disabled_bitmap (use_default_disabled_bitmap), //OcraftyoneTODO: removed by ps
|
||||
m_px_cnt(bmp_px_cnt),
|
||||
m_has_border(!(style & wxNO_BORDER))
|
||||
{
|
||||
|
|
@ -916,9 +914,6 @@ ScalableButton::ScalableButton( wxWindow * parent,
|
|||
|
||||
if (!icon_name.empty()) {
|
||||
SetBitmap(create_scaled_bitmap(icon_name, parent, m_px_cnt));
|
||||
if (m_use_default_disabled_bitmap)
|
||||
SetBitmapDisabled(create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt, true));
|
||||
//OcraftyoneTODO: replace above 3 lines with following
|
||||
// SetBitmap(*get_bmp_bundle(icon_name, m_px_cnt));
|
||||
if (!label.empty())
|
||||
SetBitmapMargins(int(0.5* em_unit(parent)), 0);
|
||||
|
|
@ -966,10 +961,7 @@ bool ScalableButton::SetBitmap_(const std::string& bmp_name)
|
|||
SetBitmapCurrent(bmp);
|
||||
SetBitmapPressed(bmp);
|
||||
SetBitmapFocus(bmp);
|
||||
if (m_use_default_disabled_bitmap)
|
||||
SetBitmapDisabled(create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt, true));
|
||||
//OcraftyoneTODO: above 2 lines replaced with
|
||||
// SetBitmapDisabled(bmp);
|
||||
SetBitmapDisabled(bmp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -988,12 +980,6 @@ int ScalableButton::GetBitmapHeight()
|
|||
#endif
|
||||
}
|
||||
|
||||
void ScalableButton::UseDefaultBitmapDisabled() //OcraftyoneTODO: removed by ps
|
||||
{
|
||||
m_use_default_disabled_bitmap = true;
|
||||
SetBitmapDisabled(create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt, true));
|
||||
}
|
||||
|
||||
void ScalableButton::msw_rescale()
|
||||
{
|
||||
Slic3r::GUI::wxGetApp().UpdateDarkUI(this, m_has_border);
|
||||
|
|
|
|||
|
|
@ -263,7 +263,6 @@ public:
|
|||
const wxSize& size = wxDefaultSize,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
long style = wxBU_EXACTFIT | wxNO_BORDER,
|
||||
bool use_default_disabled_bitmap = false, //OcraftyoneTODO: LEGACY (PS deleted)
|
||||
int bmp_px_cnt = 16);
|
||||
|
||||
ScalableButton(
|
||||
|
|
@ -279,7 +278,6 @@ public:
|
|||
bool SetBitmap_(const std::string& bmp_name);
|
||||
void SetBitmapDisabled_(const ScalableBitmap &bmp);
|
||||
int GetBitmapHeight();
|
||||
void UseDefaultBitmapDisabled(); //OcraftyoneTODO: LEGACY (PS deleted)
|
||||
|
||||
void msw_rescale();
|
||||
|
||||
|
|
@ -290,8 +288,6 @@ private:
|
|||
int m_width {-1}; // should be multiplied to em_unit
|
||||
int m_height{-1}; // should be multiplied to em_unit
|
||||
|
||||
bool m_use_default_disabled_bitmap {false}; //OcraftyoneTODO: LEGACY (PS deleted)
|
||||
|
||||
// bitmap dimensions
|
||||
int m_px_cnt{ 16 };
|
||||
bool m_has_border {false};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue