PRUSA 2.7.0

This commit is contained in:
sunsets
2023-12-27 18:02:35 +08:00
parent b33112327f
commit 0a3c63dcb1
488 changed files with 92371 additions and 29443 deletions

View File

@@ -46,11 +46,11 @@ void enable_menu_item(wxUpdateUIEvent& evt, std::function<bool()> const cb_condi
class wxDialog;
void edit_tooltip(wxString& tooltip);
void msw_buttons_rescale(wxDialog* dlg, const int em_unit, const std::vector<int>& btn_ids);
void msw_buttons_rescale(wxDialog* dlg, const int em_unit, const std::vector<int>& btn_ids, double height_koef = 1.);
int em_unit(wxWindow* win);
int mode_icon_px_size();
wxBitmapBundle* get_bmp_bundle(const std::string& bmp_name, int px_cnt = 16, const std::string& new_color_rgb = std::string());
wxBitmapBundle* get_bmp_bundle(const std::string& bmp_name, int width = 16, int height = -1, const std::string& new_color_rgb = std::string());
wxBitmapBundle* get_empty_bmp_bundle(int width, int height);
wxBitmapBundle* get_solid_bmp_bundle(int width, int height, const std::string& color);
@@ -127,6 +127,16 @@ public:
void SetItemsCnt(int cnt) { m_cnt_open_items = cnt; }
};
inline wxSize get_preferred_size(const wxBitmapBundle& bmp, wxWindow* parent)
{
if (!bmp.IsOk())
return wxSize(0,0);
#ifdef __WIN32__
return bmp.GetPreferredBitmapSizeFor(parent);
#else
return bmp.GetDefaultSize();
#endif
}
// ----------------------------------------------------------------------------
// ScalableBitmap
@@ -137,8 +147,14 @@ class ScalableBitmap
public:
ScalableBitmap() {};
ScalableBitmap( wxWindow *parent,
const std::string& icon_name = "",
const int px_cnt = 16,
const std::string& icon_name,
const int width = 16,
const int height = -1 ,
const bool grayscale = false);
ScalableBitmap( wxWindow *parent,
const std::string& icon_name,
const wxSize icon_size,
const bool grayscale = false);
~ScalableBitmap() {}
@@ -149,18 +165,12 @@ public:
wxBitmap get_bitmap() { return m_bmp.GetBitmapFor(m_parent); }
wxWindow* parent() const { return m_parent;}
const std::string& name() const { return m_icon_name; }
int px_cnt() const { return m_px_cnt;}
wxSize px_size() const { return wxSize(m_bmp_width, m_bmp_height);}
wxSize GetSize() const {
#ifdef __WIN32__
return m_bmp.GetPreferredBitmapSizeFor(m_parent);
#else
return m_bmp.GetDefaultSize();
#endif
}
void SetBitmap(const wxBitmapBundle& bmp) { m_bmp = bmp; }
wxSize GetSize() const { return get_preferred_size(m_bmp, m_parent); }
//B34
void msw_rescale();
//void msw_rescale();
int GetWidth() const { return GetSize().GetWidth(); }
int GetHeight() const { return GetSize().GetHeight(); }
@@ -169,7 +179,8 @@ private:
wxBitmapBundle m_bmp = wxBitmapBundle();
wxBitmap m_bitmap = wxBitmap();
std::string m_icon_name = "";
int m_px_cnt {16};
int m_bmp_width{ 16 };
int m_bmp_height{ -1 };
//B34
bool m_grayscale{false};
bool m_resize{false};
@@ -231,7 +242,8 @@ public:
const wxSize& size = wxDefaultSize,
const wxPoint& pos = wxDefaultPosition,
long style = wxBU_EXACTFIT | wxNO_BORDER,
int bmp_px_cnt = 16);
int width = 16,
int height = -1);
ScalableButton(
wxWindow * parent,
@@ -258,7 +270,8 @@ private:
protected:
// bitmap dimensions
int m_px_cnt{ 16 };
int m_bmp_width{ 16 };
int m_bmp_height{ -1 };
bool m_has_border {false};
};