Application Scaling for MSW: Added rescale function for DoubleSlider (from Preview), ObjectList, ManipulationPanel and SettingsPanel

+ Set wider default size for Preset Comboboxes from Tabs (#2023)
This commit is contained in:
YuSanka 2019-04-16 10:05:45 +02:00
parent e502b33f41
commit ae2c61160f
15 changed files with 398 additions and 162 deletions

View file

@ -424,8 +424,8 @@ int undef_spin_val = -9999; //! Probably, It's not necessary
void SpinCtrl::BUILD() {
auto size = wxSize(wxDefaultSize);
if (m_opt.height >= 0) size.SetHeight(m_opt.height);
if (m_opt.width >= 0) size.SetWidth(m_opt.width);
if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit());
if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit());
wxString text_value = wxString("");
int default_value = 0;
@ -885,8 +885,8 @@ void Choice::rescale()
void ColourPicker::BUILD()
{
auto size = wxSize(wxDefaultSize);
if (m_opt.height >= 0) size.SetHeight(m_opt.height);
if (m_opt.width >= 0) size.SetWidth(m_opt.width);
if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit());
if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit());
// Validate the color
wxString clr_str(static_cast<const ConfigOptionStrings*>(m_opt.default_value)->get_at(m_opt_idx));

View file

@ -203,7 +203,7 @@ void ObjectList::set_tooltip_for_item(const wxPoint& pt)
if (col->GetTitle() == " " && GetSelectedItemsCount()<2)
GetMainWindow()->SetToolTip(_(L("Right button click the icon to change the object settings")));
else if (col->GetTitle() == _("Name") &&
m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.GetRefData()) {
m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.bmp().GetRefData()) {
int obj_idx = m_objects_model->GetIdByItem(item);
auto& stats = (*m_objects)[obj_idx]->volumes[0]->mesh.stl.stats;
int errors = stats.degenerate_facets + stats.edges_fixed + stats.facets_removed +
@ -395,27 +395,83 @@ void ObjectList::update_name_in_model(const wxDataViewItem& item) const
void ObjectList::init_icons()
{
m_bmp_modifiermesh = create_scaled_bitmap(nullptr, "add_modifier");
m_bmp_solidmesh = create_scaled_bitmap(nullptr, "add_part");
m_bmp_support_enforcer = create_scaled_bitmap(nullptr, "support_enforcer");
m_bmp_support_blocker = create_scaled_bitmap(nullptr, "support_blocker");
// m_bmp_modifiermesh = create_scaled_bitmap(nullptr, "add_modifier");
// m_bmp_solidmesh = create_scaled_bitmap(nullptr, "add_part");
// m_bmp_support_enforcer = create_scaled_bitmap(nullptr, "support_enforcer");
// m_bmp_support_blocker = create_scaled_bitmap(nullptr, "support_blocker");
//
//
// m_bmp_vector.reserve(4); // bitmaps for different types of parts
// m_bmp_vector.push_back(&m_bmp_solidmesh);
// m_bmp_vector.push_back(&m_bmp_modifiermesh);
// m_bmp_vector.push_back(&m_bmp_support_enforcer);
// m_bmp_vector.push_back(&m_bmp_support_blocker);
m_bmp_modifiermesh = PrusaBitmap(nullptr, "add_modifier"); // Add part
m_bmp_solidmesh = PrusaBitmap(nullptr, "add_part"); // Add modifier
m_bmp_support_enforcer = PrusaBitmap(nullptr, "support_enforcer");// Add support enforcer
m_bmp_support_blocker = PrusaBitmap(nullptr, "support_blocker"); // Add support blocker
m_bmp_vector.reserve(4); // bitmaps for different types of parts
m_bmp_vector.push_back(&m_bmp_solidmesh); // Add part
m_bmp_vector.push_back(&m_bmp_modifiermesh); // Add modifier
m_bmp_vector.push_back(&m_bmp_support_enforcer); // Add support enforcer
m_bmp_vector.push_back(&m_bmp_support_blocker); // Add support blocker
m_bmp_vector.push_back(&m_bmp_solidmesh.bmp());
m_bmp_vector.push_back(&m_bmp_modifiermesh.bmp());
m_bmp_vector.push_back(&m_bmp_support_enforcer.bmp());
m_bmp_vector.push_back(&m_bmp_support_blocker.bmp());
// Set volumes default bitmaps for the model
m_objects_model->SetVolumeBitmaps(m_bmp_vector);
// init icon for manifold warning
m_bmp_manifold_warning = create_scaled_bitmap(nullptr, "exclamation");
m_bmp_manifold_warning = /*create_scaled_bitmap*/PrusaBitmap(nullptr, "exclamation");
// init bitmap for "Split to sub-objects" context menu
m_bmp_split = create_scaled_bitmap(nullptr, "split_parts_SMALL");
m_bmp_split = /*create_scaled_bitmap*/PrusaBitmap(nullptr, "split_parts_SMALL");
// init bitmap for "Add Settings" context menu
m_bmp_cog = create_scaled_bitmap(nullptr, "cog");
m_bmp_cog = /*create_scaled_bitmap*/PrusaBitmap(nullptr, "cog");
}
void ObjectList::rescale_icons()
{
m_bmp_vector.clear();
m_bmp_vector.reserve(4); // bitmaps for different types of parts
for (PrusaBitmap* bitmap : std::vector<PrusaBitmap*> {
&m_bmp_modifiermesh, // Add part
&m_bmp_solidmesh, // Add modifier
&m_bmp_support_enforcer, // Add support enforcer
&m_bmp_support_blocker }) // Add support blocker
{
bitmap->rescale();
m_bmp_vector.push_back(& bitmap->bmp());
}
// Set volumes default bitmaps for the model
m_objects_model->SetVolumeBitmaps(m_bmp_vector);
m_bmp_manifold_warning.rescale();
m_bmp_split.rescale();
m_bmp_cog.rescale();
// Update CATEGORY_ICON according to new scale
{
// Note: `this` isn't passed to create_scaled_bitmap() here because of bugs in the widget,
// see note in PresetBundle::load_compatible_bitmaps()
// ptFFF
CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap(nullptr, "layers");
CATEGORY_ICON[L("Infill")] = create_scaled_bitmap(nullptr, "infill");
CATEGORY_ICON[L("Support material")] = create_scaled_bitmap(nullptr, "support");
CATEGORY_ICON[L("Speed")] = create_scaled_bitmap(nullptr, "time");
CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap(nullptr, "funnel");
CATEGORY_ICON[L("Extrusion Width")] = create_scaled_bitmap(nullptr, "funnel");
// CATEGORY_ICON[L("Skirt and brim")] = create_scaled_bitmap(nullptr, "skirt+brim");
// CATEGORY_ICON[L("Speed > Acceleration")] = create_scaled_bitmap(nullptr, "time");
CATEGORY_ICON[L("Advanced")] = create_scaled_bitmap(nullptr, "wrench");
// ptSLA
CATEGORY_ICON[L("Supports")] = create_scaled_bitmap(nullptr, "support"/*"sla_supports"*/);
CATEGORY_ICON[L("Pad")] = create_scaled_bitmap(nullptr, "pad");
}
}
@ -533,7 +589,7 @@ void ObjectList::OnContextMenu(wxDataViewEvent&)
if (title == " ")
show_context_menu();
else if (title == _("Name") && pt.x >15 &&
m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.GetRefData())
m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.bmp().GetRefData())
{
if (is_windows10())
fix_through_netfabb();
@ -995,7 +1051,7 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu)
wxMenuItem* ObjectList::append_menu_item_split(wxMenu* menu)
{
return append_menu_item(menu, wxID_ANY, _(L("Split to parts")), "",
[this](wxCommandEvent&) { split(); }, m_bmp_split, menu);
[this](wxCommandEvent&) { split(); }, m_bmp_split.bmp(), menu);
}
wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
@ -1060,7 +1116,7 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
// Add full settings list
auto menu_item = new wxMenuItem(menu, wxID_ANY, menu_name);
menu_item->SetBitmap(m_bmp_cog);
menu_item->SetBitmap(m_bmp_cog.bmp());
menu_item->SetSubMenu(create_settings_popupmenu(menu));
@ -1821,7 +1877,7 @@ void ObjectList::add_object_to_list(size_t obj_idx)
stats.facets_added + stats.facets_reversed + stats.backwards_edges;
if (errors > 0) {
wxVariant variant;
variant << PrusaDataViewBitmapText(item_name, m_bmp_manifold_warning);
variant << PrusaDataViewBitmapText(item_name, m_bmp_manifold_warning.bmp());
m_objects_model->SetValue(variant, item, 0);
}
@ -2677,13 +2733,19 @@ void ObjectList::update_item_error_icon(const int obj_idx, const int vol_idx) co
void ObjectList::rescale()
{
// update min size !!! Width shouldn't be a wxDefaultCoord
// update min size !!! A width of control shouldn't be a wxDefaultCoord
SetMinSize(wxSize(1, 15 * wxGetApp().em_unit()));
GetColumn(0)->SetWidth(19 * wxGetApp().em_unit());
GetColumn(1)->SetWidth(8 * wxGetApp().em_unit());
GetColumn(2)->SetWidth(int(2 * wxGetApp().em_unit()));
// rescale all icons, used by ObjectList
rescale_icons();
// rescale/update existingitems with bitmaps
m_objects_model->Rescale();
Layout();
}

View file

@ -108,13 +108,13 @@ class ObjectList : public wxDataViewCtrl
wxBoxSizer *m_sizer {nullptr};
wxWindow *m_parent {nullptr};
wxBitmap m_bmp_modifiermesh;
wxBitmap m_bmp_solidmesh;
wxBitmap m_bmp_support_enforcer;
wxBitmap m_bmp_support_blocker;
wxBitmap m_bmp_manifold_warning;
wxBitmap m_bmp_cog;
wxBitmap m_bmp_split;
/*wxBitmap*/PrusaBitmap m_bmp_modifiermesh;
/*wxBitmap*/PrusaBitmap m_bmp_solidmesh;
/*wxBitmap*/PrusaBitmap m_bmp_support_enforcer;
/*wxBitmap*/PrusaBitmap m_bmp_support_blocker;
/*wxBitmap*/PrusaBitmap m_bmp_manifold_warning;
/*wxBitmap*/PrusaBitmap m_bmp_cog;
/*wxBitmap*/PrusaBitmap m_bmp_split;
PrusaMenu m_menu_object;
PrusaMenu m_menu_part;
@ -125,7 +125,7 @@ class ObjectList : public wxDataViewCtrl
wxMenuItem* m_menu_item_settings { nullptr };
wxMenuItem* m_menu_item_split_instances { nullptr };
std::vector<wxBitmap*> m_bmp_vector;
std::vector<wxBitmap* /*const wxBitmap&*/> m_bmp_vector;
int m_selected_object_id = -1;
bool m_prevent_list_events = false; // We use this flag to avoid circular event handling Select()
@ -176,6 +176,7 @@ public:
void update_extruder_values_for_items(const int max_extruder);
void init_icons();
void rescale_icons();
void set_tooltip_for_item(const wxPoint& pt);

View file

@ -117,15 +117,13 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
m_og->append_line(add_og_to_object_settings(L("Scale"), "%"), &m_scale_Label);
m_og->append_line(add_og_to_object_settings(L("Size"), "mm"));
/* Unused parameter at this time
def.label = L("Place on bed");
def.type = coBool;
def.tooltip = L("Automatic placing of models on printing bed in Y axis");
def.gui_type = "";
def.sidetext = "";
def.default_value = new ConfigOptionBool{ false };
m_og->append_single_option_line(Option(def, "place_on_bed"));
*/
// call back for a rescale of button "Set uniform scale"
m_og->rescale_near_label_widget = [this](wxWindow* win) {
auto *ctrl = dynamic_cast<PrusaLockButton*>(win);
if (ctrl == nullptr)
return;
ctrl->rescale();
};
}
void ObjectManipulation::Show(const bool show)

View file

@ -127,7 +127,7 @@ void ObjectSettings::update_settings_list()
auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), cat.first, config, false, extra_column);
optgroup->label_width = 15;
optgroup->sidetext_width = 5.5 * wxGetApp().em_unit();
optgroup->sidetext_width = 5.5;
optgroup->m_on_change = [](const t_config_option_key& opt_id, const boost::any& value) {
wxGetApp().obj_list()->part_settings_changed(); };
@ -137,14 +137,14 @@ void ObjectSettings::update_settings_list()
if (opt == "extruder")
continue;
Option option = optgroup->get_option(opt);
option.opt.width = 12 * wxGetApp().em_unit();
option.opt.width = 12;
optgroup->append_single_option_line(option);
}
optgroup->reload_config();
m_settings_list_sizer->Add(optgroup->sizer, 0, wxEXPAND | wxALL, 0);
// call back for rescaling of the extracolumn control
optgroup->rescale_extra_column = [this](wxWindow* win) {
optgroup->rescale_extra_column_item = [this](wxWindow* win) {
auto *ctrl = dynamic_cast<PrusaButton*>(win);
if (ctrl == nullptr)
return;

View file

@ -396,6 +396,11 @@ void Preview::refresh_print()
load_print(true);
}
void Preview::rescale_slider()
{
if (m_slider) m_slider->rescale();
}
void Preview::bind_event_handlers()
{
this->Bind(wxEVT_SIZE, &Preview::on_size, this);

View file

@ -120,6 +120,8 @@ public:
void reload_print(bool keep_volumes = false);
void refresh_print();
void rescale_slider();
private:
bool init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model);

View file

@ -297,16 +297,18 @@ void MainFrame::on_dpi_changed(const wxRect &suggested_rect)
*/
wxGetApp().preset_bundle->load_default_preset_bitmaps(this);
// update preset comboboxes on Plater
wxGetApp().sidebar().rescale();
// update Plater
wxGetApp().plater()->rescale();
// update preset comboboxes on Tabs
// update Tabs
for (auto tab : wxGetApp().tabs_list)
tab->rescale();
Layout();
Thaw();
Refresh();
}
// -<-
}

View file

@ -168,8 +168,8 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
// if we have an extra column, build it
if (extra_column)
{
m_extra_column_ptrs.push_back(extra_column(this->ctrl_parent(), line));
grid_sizer->Add(m_extra_column_ptrs.back(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 3);
m_extra_column_item_ptrs.push_back(extra_column(this->ctrl_parent(), line));
grid_sizer->Add(m_extra_column_item_ptrs.back(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 3);
}
// Build a label if we have it
@ -189,15 +189,19 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
label->Wrap(label_width*wxGetApp().em_unit()); // avoid a Linux/GTK bug
if (!line.near_label_widget)
grid_sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, line.label.IsEmpty() ? 0 : 5);
else if (line.near_label_widget && line.label.IsEmpty())
grid_sizer->Add(line.near_label_widget(this->ctrl_parent()), 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 7);
else {
// If we're here, we have some widget near the label
// so we need a horizontal sizer to arrange these things
auto sizer = new wxBoxSizer(wxHORIZONTAL);
grid_sizer->Add(sizer, 0, wxEXPAND | (staticbox ? wxALL : wxBOTTOM | wxTOP | wxLEFT), staticbox ? 0 : 1);
sizer->Add(line.near_label_widget(this->ctrl_parent()), 0, wxRIGHT, 7);
sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, 5);
m_near_label_widget_ptrs.push_back(line.near_label_widget(this->ctrl_parent()));
if (line.label.IsEmpty())
grid_sizer->Add(m_near_label_widget_ptrs.back(), 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 7);
else {
// If we're here, we have some widget near the label
// so we need a horizontal sizer to arrange these things
auto sizer = new wxBoxSizer(wxHORIZONTAL);
grid_sizer->Add(sizer, 0, wxEXPAND | (staticbox ? wxALL : wxBOTTOM | wxTOP | wxLEFT), staticbox ? 0 : 1);
sizer->Add(m_near_label_widget_ptrs.back(), 0, wxRIGHT, 7);
sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, 5);
}
}
if (line.label_tooltip.compare("") != 0)
label->SetToolTip(line.label_tooltip);
@ -269,7 +273,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
// add sidetext if any
if (option.sidetext != "") {
auto sidetext = new wxStaticText( this->ctrl_parent(), wxID_ANY, _(option.sidetext), wxDefaultPosition,
wxSize(sidetext_width, -1)/*wxDefaultSize*/, wxALIGN_LEFT);
/*wxSize(sidetext_width*wxGetApp().em_unit(), -1)*/wxDefaultSize, wxALIGN_LEFT);
sidetext->SetBackgroundStyle(wxBG_STYLE_PAINT);
sidetext->SetFont(wxGetApp().normal_font());
sizer_tmp->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4);
@ -482,10 +486,15 @@ bool ConfigOptionsGroup::update_visibility(ConfigOptionMode mode) {
void ConfigOptionsGroup::rescale()
{
// update bitmaps for mode markers : set new (rescaled) bitmaps
if (rescale_extra_column)
for (auto extra_col : m_extra_column_ptrs)
rescale_extra_column(extra_col);
// update bitmaps for extra column items (like "mode markers" or buttons on settings panel)
if (rescale_extra_column_item)
for (auto extra_col : m_extra_column_item_ptrs)
rescale_extra_column_item(extra_col);
// update bitmaps for near label widgets (like "Set uniform scale" button on settings panel)
if (rescale_near_label_widget)
for (auto near_label_widget : m_near_label_widget_ptrs)
rescale_near_label_widget(near_label_widget);
// update undo buttons : rescale bitmaps
for (const auto& field : m_fields)

View file

@ -85,7 +85,6 @@ public:
size_t label_width = 20 ;// {200};
wxSizer* sizer {nullptr};
column_t extra_column {nullptr};
std::function<void(wxWindow* win)> rescale_extra_column { nullptr };
t_change m_on_change { nullptr };
t_kill_focus m_fill_empty_value { nullptr };
t_kill_focus m_set_focus { nullptr };
@ -93,6 +92,9 @@ public:
std::function<DynamicPrintConfig()> m_get_sys_config{ nullptr };
std::function<bool()> have_sys_config{ nullptr };
std::function<void(wxWindow* win)> rescale_extra_column_item { nullptr };
std::function<void(wxWindow* win)> rescale_near_label_widget { nullptr };
wxFont sidetext_font {wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
wxFont label_font {wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
int sidetext_width{ -1 };
@ -192,7 +194,8 @@ protected:
std::map<t_config_option_key, Option> m_options;
wxWindow* m_parent {nullptr};
std::vector<ConfigOptionMode> m_options_mode;
std::vector<wxWindow*> m_extra_column_ptrs;
std::vector<wxWindow*> m_extra_column_item_ptrs;
std::vector<wxWindow*> m_near_label_widget_ptrs;
/// Field list, contains unique_ptrs of the derived type.
/// using types that need to know what it is beyond the public interface

View file

@ -163,7 +163,7 @@ void ObjectInfo::show_sizer(bool show)
void ObjectInfo::rescale()
{
manifold_warning_icon->SetBitmap(create_scaled_bitmap(nullptr, "exclamation_mark_"));
manifold_warning_icon->SetBitmap(create_scaled_bitmap(nullptr, "exclamation"));
}
enum SlisedInfoIdx
@ -928,8 +928,6 @@ void Sidebar::rescale()
p->object_info->rescale();
p->scrolled->Layout();
p->plater->Layout();
p->plater->GetParent()->Layout();
}
ObjectManipulation* Sidebar::obj_manipul()
@ -3806,6 +3804,16 @@ bool Plater::can_paste_from_clipboard() const
return true;
}
void Plater::rescale()
{
p->preview->rescale_slider();
p->sidebar->rescale();
Layout();
GetParent()->Layout();
}
bool Plater::can_delete() const { return p->can_delete(); }
bool Plater::can_delete_all() const { return p->can_delete_all(); }
bool Plater::can_increase_instances() const { return p->can_increase_instances(); }

View file

@ -203,6 +203,8 @@ public:
bool can_copy() const;
bool can_paste() const;
void rescale();
private:
struct priv;
std::unique_ptr<priv> p;

View file

@ -110,7 +110,7 @@ void Tab::create_preset_tab()
#endif //__WXOSX__
// preset chooser
m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(25 * m_em_unit, -1), 0, 0, wxCB_READONLY);
m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(35 * m_em_unit, -1), 0, 0, wxCB_READONLY);
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
@ -772,7 +772,7 @@ void Tab::rescale()
m_mode_sizer->rescale();
m_presets_choice->SetSize(25 * m_em_unit, -1);
m_presets_choice->SetSize(35 * m_em_unit, -1);
m_treectrl->SetMinSize(wxSize(20 * m_em_unit, -1));
update_tab_ui();
@ -3246,7 +3246,7 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
return static_cast<Tab*>(tab)->m_presets->get_selected_preset_parent() != nullptr;
};
optgroup->rescale_extra_column = [this](wxWindow* win) {
optgroup->rescale_extra_column_item = [this](wxWindow* win) {
auto *ctrl = dynamic_cast<wxStaticBitmap*>(win);
if (ctrl == nullptr)
return;

View file

@ -459,15 +459,43 @@ wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name_in, con
// ----------------------------------------------------------------------------
// PrusaObjectDataViewModelNode
// ----------------------------------------------------------------------------
/*
void PrusaObjectDataViewModelNode::set_object_action_icon() {
m_action_icon = create_scaled_bitmap(nullptr, "advanced_plus"); // FIXME: pass window ptr
}
void PrusaObjectDataViewModelNode::set_part_action_icon() {
m_action_icon = create_scaled_bitmap(nullptr, m_type == itVolume ? "cog" : "set_separate_obj"); // FIXME: pass window ptr
}
*/
void PrusaObjectDataViewModelNode::set_action_icon()
{
m_action_icon_name = m_type == itObject ? "advanced_plus" :
m_type == itVolume ? "cog" : "set_separate_obj";
m_action_icon = create_scaled_bitmap(nullptr, m_action_icon_name); // FIXME: pass window ptr
}
Slic3r::GUI::BitmapCache *m_bitmap_cache = nullptr;
void PrusaObjectDataViewModelNode::update_settings_digest_bitmaps()
{
m_bmp = m_empty_bmp;
std::map<std::string, wxBitmap>& categories_icon = Slic3r::GUI::wxGetApp().obj_list()->CATEGORY_ICON;
std::string scaled_bitmap_name = m_name.ToUTF8().data();
scaled_bitmap_name += "-em" + std::to_string(Slic3r::GUI::wxGetApp().em_unit());
wxBitmap *bmp = m_bitmap_cache->find(scaled_bitmap_name);
if (bmp == nullptr) {
std::vector<wxBitmap> bmps;
for (auto& cat : m_opt_categories)
bmps.emplace_back( categories_icon.find(cat) == categories_icon.end() ?
wxNullBitmap : categories_icon.at(cat));
bmp = m_bitmap_cache->insert(scaled_bitmap_name, bmps);
}
m_bmp = *bmp;
}
bool PrusaObjectDataViewModelNode::update_settings_digest(const std::vector<std::string>& categories)
{
if (m_type != itSettings || m_opt_categories == categories)
@ -475,15 +503,15 @@ bool PrusaObjectDataViewModelNode::update_settings_digest(const std::vector<std:
m_opt_categories = categories;
m_name = wxEmptyString;
m_bmp = m_empty_bmp;
// m_bmp = m_empty_bmp;
std::map<std::string, wxBitmap>& categories_icon = Slic3r::GUI::wxGetApp().obj_list()->CATEGORY_ICON;
// std::map<std::string, wxBitmap>& categories_icon = Slic3r::GUI::wxGetApp().obj_list()->CATEGORY_ICON;
for (auto& cat : m_opt_categories)
m_name += cat + "; ";
if (!m_name.IsEmpty())
m_name.erase(m_name.Length()-2, 2); // Delete last "; "
/*
wxBitmap *bmp = m_bitmap_cache->find(m_name.ToUTF8().data());
if (bmp == nullptr) {
std::vector<wxBitmap> bmps;
@ -494,10 +522,22 @@ bool PrusaObjectDataViewModelNode::update_settings_digest(const std::vector<std:
}
m_bmp = *bmp;
*/
update_settings_digest_bitmaps();
return true;
}
void PrusaObjectDataViewModelNode::rescale()
{
if (!m_action_icon_name.empty())
m_action_icon = create_scaled_bitmap(nullptr, m_action_icon_name);
if (!m_opt_categories.empty())
update_settings_digest_bitmaps();
}
// *****************************************************************************
// ----------------------------------------------------------------------------
// PrusaObjectDataViewModel
@ -554,6 +594,8 @@ wxDataViewItem PrusaObjectDataViewModel::AddVolumeChild(const wxDataViewItem &pa
root->m_volumes_cnt++;
if (insert_position > 0) insert_position++;
node->m_volume_type = volume_type;
}
const auto node = new PrusaObjectDataViewModelNode(root, name, *m_volume_bmps[int(volume_type)], extruder_str, root->m_volumes_cnt);
@ -563,6 +605,8 @@ wxDataViewItem PrusaObjectDataViewModel::AddVolumeChild(const wxDataViewItem &pa
ItemAdded(parent_item, child);
root->m_volumes_cnt++;
node->m_volume_type = volume_type;
return child;
}
@ -1332,8 +1376,6 @@ bool PrusaObjectDataViewModel::IsSettingsItem(const wxDataViewItem &item) const
return node->m_type == itSettings;
}
void PrusaObjectDataViewModel::UpdateSettingsDigest(const wxDataViewItem &item,
const std::vector<std::string>& categories)
{
@ -1354,6 +1396,29 @@ void PrusaObjectDataViewModel::SetVolumeType(const wxDataViewItem &item, const S
ItemChanged(item);
}
void PrusaObjectDataViewModel::Rescale()
{
wxDataViewItemArray all_items;
GetAllChildren(wxDataViewItem(0), all_items);
for (wxDataViewItem item : all_items)
{
if (!item.IsOk())
continue;
PrusaObjectDataViewModelNode *node = (PrusaObjectDataViewModelNode*)item.GetID();
node->rescale();
if (node->m_type & itVolume)
node->m_bmp = *m_volume_bmps[node->volume_type()];
if (node->m_type & itObject && node->m_bmp.IsOk())
node->m_bmp = create_scaled_bitmap(nullptr, "exclamation");
ItemChanged(item);
}
}
//-----------------------------------------------------------------------------
// PrusaDataViewBitmapText
//-----------------------------------------------------------------------------
@ -1506,21 +1571,21 @@ PrusaDoubleSlider::PrusaDoubleSlider(wxWindow *parent,
if (!is_osx)
SetDoubleBuffered(true);// SetDoubleBuffered exists on Win and Linux/GTK, but is missing on OSX
m_bmp_thumb_higher = wxBitmap(style == wxSL_HORIZONTAL ? create_scaled_bitmap(this, "right_half_circle.png") : create_scaled_bitmap(this, "up_half_circle.png", 16, true));
m_bmp_thumb_lower = wxBitmap(style == wxSL_HORIZONTAL ? create_scaled_bitmap(this, "left_half_circle.png" ) : create_scaled_bitmap(this, "down_half_circle.png", 16, true));
m_thumb_size = m_bmp_thumb_lower.GetSize();
m_bmp_thumb_higher = /*wxBitmap*/(style == wxSL_HORIZONTAL ? /*create_scaled_bitmap*/PrusaBitmap(this, "right_half_circle.png") : /*create_scaled_bitmap*/PrusaBitmap(this, "up_half_circle.png", 16, true));
m_bmp_thumb_lower = /*wxBitmap*/(style == wxSL_HORIZONTAL ? /*create_scaled_bitmap*/PrusaBitmap(this, "left_half_circle.png" ) : /*create_scaled_bitmap*/PrusaBitmap(this, "down_half_circle.png", 16, true));
m_thumb_size = m_bmp_thumb_lower.bmp().GetSize();
m_bmp_add_tick_on = create_scaled_bitmap(this, "colorchange_add_on.png");
m_bmp_add_tick_off = create_scaled_bitmap(this, "colorchange_add_off.png");
m_bmp_del_tick_on = create_scaled_bitmap(this, "colorchange_delete_on.png");
m_bmp_del_tick_off = create_scaled_bitmap(this, "colorchange_delete_off.png");
m_tick_icon_dim = m_bmp_add_tick_on.GetSize().x;
m_bmp_add_tick_on = /*create_scaled_bitmap*/PrusaBitmap(this, "colorchange_add_on.png");
m_bmp_add_tick_off = /*create_scaled_bitmap*/PrusaBitmap(this, "colorchange_add_off.png");
m_bmp_del_tick_on = /*create_scaled_bitmap*/PrusaBitmap(this, "colorchange_delete_on.png");
m_bmp_del_tick_off = /*create_scaled_bitmap*/PrusaBitmap(this, "colorchange_delete_off.png");
m_tick_icon_dim = m_bmp_add_tick_on.bmp().GetSize().x;
m_bmp_one_layer_lock_on = create_scaled_bitmap(this, "one_layer_lock_on.png");
m_bmp_one_layer_lock_off = create_scaled_bitmap(this, "one_layer_lock_off.png");
m_bmp_one_layer_unlock_on = create_scaled_bitmap(this, "one_layer_unlock_on.png");
m_bmp_one_layer_unlock_off = create_scaled_bitmap(this, "one_layer_unlock_off.png");
m_lock_icon_dim = m_bmp_one_layer_lock_on.GetSize().x;
m_bmp_one_layer_lock_on = /*create_scaled_bitmap*/PrusaBitmap(this, "one_layer_lock_on.png");
m_bmp_one_layer_lock_off = /*create_scaled_bitmap*/PrusaBitmap(this, "one_layer_lock_off.png");
m_bmp_one_layer_unlock_on = /*create_scaled_bitmap*/PrusaBitmap(this, "one_layer_unlock_on.png");
m_bmp_one_layer_unlock_off = /*create_scaled_bitmap*/PrusaBitmap(this, "one_layer_unlock_off.png");
m_lock_icon_dim = m_bmp_one_layer_lock_on.bmp().GetSize().x;
m_selection = ssUndef;
@ -1538,7 +1603,7 @@ PrusaDoubleSlider::PrusaDoubleSlider(wxWindow *parent,
Bind(wxEVT_RIGHT_UP, &PrusaDoubleSlider::OnRightUp, this);
// control's view variables
SLIDER_MARGIN = 4 + Slic3r::GUI::wxGetApp().em_unit();//(style == wxSL_HORIZONTAL ? m_bmp_thumb_higher.GetWidth() : m_bmp_thumb_higher.GetHeight());
SLIDER_MARGIN = 4 + Slic3r::GUI::wxGetApp().em_unit();
DARK_ORANGE_PEN = wxPen(wxColour(253, 84, 2));
ORANGE_PEN = wxPen(wxColour(253, 126, 66));
@ -1555,6 +1620,33 @@ PrusaDoubleSlider::PrusaDoubleSlider(wxWindow *parent,
m_font = is_osx ? font.Smaller().Smaller() : font.Smaller();
}
void PrusaDoubleSlider::rescale()
{
const wxFont& font = Slic3r::GUI::wxGetApp().normal_font();
m_font = is_osx ? font.Smaller().Smaller() : font.Smaller();
m_bmp_thumb_higher.rescale();
m_bmp_thumb_lower .rescale();
m_thumb_size = m_bmp_thumb_lower.bmp().GetSize();
m_bmp_add_tick_on .rescale();
m_bmp_add_tick_off.rescale();
m_bmp_del_tick_on .rescale();
m_bmp_del_tick_off.rescale();
m_tick_icon_dim = m_bmp_add_tick_on.bmp().GetSize().x;
m_bmp_one_layer_lock_on .rescale();
m_bmp_one_layer_lock_off .rescale();
m_bmp_one_layer_unlock_on .rescale();
m_bmp_one_layer_unlock_off.rescale();
m_lock_icon_dim = m_bmp_one_layer_lock_on.bmp().GetSize().x;
SLIDER_MARGIN = 4 + Slic3r::GUI::wxGetApp().em_unit();
SetMinSize(get_min_size());
GetParent()->Layout();
}
int PrusaDoubleSlider::GetActiveValue() const
{
return m_selection == ssLower ?
@ -1562,15 +1654,21 @@ int PrusaDoubleSlider::GetActiveValue() const
m_higher_value : -1;
}
wxSize PrusaDoubleSlider::get_min_size() const
{
const int min_side = is_horizontal() ?
(is_osx ? 8 : 6) * Slic3r::GUI::wxGetApp().em_unit() :
/*(is_osx ? 10 : 8)*/10 * Slic3r::GUI::wxGetApp().em_unit();
return wxSize(min_side, min_side);
}
wxSize PrusaDoubleSlider::DoGetBestSize() const
{
const wxSize size = wxControl::DoGetBestSize();
if (size.x > 1 && size.y > 1)
return size;
const int new_size = is_horizontal() ?
(is_osx ? 8 : 6) * Slic3r::GUI::wxGetApp().em_unit() :
(is_osx ? 10 : 8) * Slic3r::GUI::wxGetApp().em_unit();
return wxSize(new_size, new_size);
return get_min_size();
}
void PrusaDoubleSlider::SetLowerValue(const int lower_val)
@ -1786,9 +1884,12 @@ void PrusaDoubleSlider::render()
void PrusaDoubleSlider::draw_action_icon(wxDC& dc, const wxPoint pt_beg, const wxPoint pt_end)
{
const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
wxBitmap* icon = m_is_action_icon_focesed ? &m_bmp_add_tick_off : &m_bmp_add_tick_on;
// wxBitmap* icon = m_is_action_icon_focesed ? &m_bmp_add_tick_off : &m_bmp_add_tick_on;
// if (m_ticks.find(tick) != m_ticks.end())
// icon = m_is_action_icon_focesed ? &m_bmp_del_tick_off : &m_bmp_del_tick_on;
wxBitmap& icon = m_is_action_icon_focesed ? m_bmp_add_tick_off.bmp() : m_bmp_add_tick_on.bmp();
if (m_ticks.find(tick) != m_ticks.end())
icon = m_is_action_icon_focesed ? &m_bmp_del_tick_off : &m_bmp_del_tick_on;
icon = m_is_action_icon_focesed ? m_bmp_del_tick_off.bmp() : m_bmp_del_tick_on.bmp();
wxCoord x_draw, y_draw;
is_horizontal() ? x_draw = pt_beg.x - 0.5*m_tick_icon_dim : y_draw = pt_beg.y - 0.5*m_tick_icon_dim;
@ -1797,7 +1898,7 @@ void PrusaDoubleSlider::draw_action_icon(wxDC& dc, const wxPoint pt_beg, const w
else
is_horizontal() ? y_draw = pt_beg.y - m_tick_icon_dim-2 : x_draw = pt_end.x + 3;
dc.DrawBitmap(*icon, x_draw, y_draw);
dc.DrawBitmap(/***/icon, x_draw, y_draw);
//update rect of the tick action icon
m_rect_tick_action = wxRect(x_draw, y_draw, m_tick_icon_dim, m_tick_icon_dim);
@ -1873,7 +1974,7 @@ void PrusaDoubleSlider::draw_thumb_item(wxDC& dc, const wxPoint& pos, const Sele
y_draw = pos.y - m_thumb_size.y;
}
}
dc.DrawBitmap(selection == ssLower ? m_bmp_thumb_lower : m_bmp_thumb_higher, x_draw, y_draw);
dc.DrawBitmap(selection == ssLower ? m_bmp_thumb_lower.bmp() : m_bmp_thumb_higher.bmp(), x_draw, y_draw);
// Update thumb rect
update_thumb_rect(x_draw, y_draw, selection);
@ -1989,9 +2090,12 @@ void PrusaDoubleSlider::draw_colored_band(wxDC& dc)
void PrusaDoubleSlider::draw_one_layer_icon(wxDC& dc)
{
wxBitmap* icon = m_is_one_layer ?
m_is_one_layer_icon_focesed ? &m_bmp_one_layer_lock_off : &m_bmp_one_layer_lock_on :
m_is_one_layer_icon_focesed ? &m_bmp_one_layer_unlock_off : &m_bmp_one_layer_unlock_on;
// wxBitmap* icon = m_is_one_layer ?
// m_is_one_layer_icon_focesed ? &m_bmp_one_layer_lock_off : &m_bmp_one_layer_lock_on :
// m_is_one_layer_icon_focesed ? &m_bmp_one_layer_unlock_off : &m_bmp_one_layer_unlock_on;
const wxBitmap& icon = m_is_one_layer ?
m_is_one_layer_icon_focesed ? m_bmp_one_layer_lock_off.bmp() : m_bmp_one_layer_lock_on.bmp() :
m_is_one_layer_icon_focesed ? m_bmp_one_layer_unlock_off.bmp() : m_bmp_one_layer_unlock_on.bmp();
int width, height;
get_size(&width, &height);
@ -2000,7 +2104,7 @@ void PrusaDoubleSlider::draw_one_layer_icon(wxDC& dc)
is_horizontal() ? x_draw = width-2 : x_draw = 0.5*width - 0.5*m_lock_icon_dim;
is_horizontal() ? y_draw = 0.5*height - 0.5*m_lock_icon_dim : y_draw = height-2;
dc.DrawBitmap(*icon, x_draw, y_draw);
dc.DrawBitmap(/***/icon, x_draw, y_draw);
//update rect of the lock/unlock icon
m_rect_one_layer_icon = wxRect(x_draw, y_draw, m_lock_icon_dim, m_lock_icon_dim);
@ -2343,17 +2447,17 @@ PrusaLockButton::PrusaLockButton( wxWindow *parent,
const wxSize& size /*= wxDefaultSize*/):
wxButton(parent, id, wxEmptyString, pos, size, wxBU_EXACTFIT | wxNO_BORDER)
{
m_bmp_lock_on = create_scaled_bitmap(this, "one_layer_lock_on.png");
m_bmp_lock_off = create_scaled_bitmap(this, "one_layer_lock_off.png");
m_bmp_unlock_on = create_scaled_bitmap(this, "one_layer_unlock_on.png");
m_bmp_unlock_off = create_scaled_bitmap(this, "one_layer_unlock_off.png");
m_bmp_lock_on = /*create_scaled_bitmap*/PrusaBitmap(this, "one_layer_lock_on.png");
m_bmp_lock_off = /*create_scaled_bitmap*/PrusaBitmap(this, "one_layer_lock_off.png");
m_bmp_unlock_on = /*create_scaled_bitmap*/PrusaBitmap(this, "one_layer_unlock_on.png");
m_bmp_unlock_off = /*create_scaled_bitmap*/PrusaBitmap(this, "one_layer_unlock_off.png");
#ifdef __WXMSW__
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
#endif // __WXMSW__
SetBitmap(m_bmp_unlock_on);
SetBitmapDisabled(m_bmp_lock_on);
SetBitmap(m_bmp_unlock_on.bmp());
SetBitmapDisabled(m_bmp_lock_on.bmp());
//button events
Bind(wxEVT_BUTTON, &PrusaLockButton::OnButton, this);
@ -2375,12 +2479,25 @@ void PrusaLockButton::SetLock(bool lock)
enter_button(true);
}
void PrusaLockButton::rescale()
{
m_bmp_lock_on .rescale();
m_bmp_lock_off .rescale();
m_bmp_unlock_on .rescale();
m_bmp_unlock_off.rescale();
}
void PrusaLockButton::enter_button(const bool enter)
{
wxBitmap* icon = m_is_pushed ?
enter ? &m_bmp_lock_off : &m_bmp_lock_on :
enter ? &m_bmp_unlock_off : &m_bmp_unlock_on;
SetBitmap(*icon);
// wxBitmap* icon = m_is_pushed ?
// enter ? &m_bmp_lock_off : &m_bmp_lock_on :
// enter ? &m_bmp_unlock_off : &m_bmp_unlock_on;
// SetBitmap(*icon);
const wxBitmap& icon = m_is_pushed ?
enter ? m_bmp_lock_off.bmp() : m_bmp_lock_on.bmp() :
enter ? m_bmp_unlock_off.bmp() : m_bmp_unlock_on.bmp();
SetBitmap(icon);
Refresh();
Update();
@ -2527,16 +2644,19 @@ void PrusaMenu::DestroySeparators()
// PrusaBitmap
// ----------------------------------------------------------------------------
PrusaBitmap::PrusaBitmap(wxWindow *parent,
const std::string& icon_name/* = ""*/):
m_parent(parent), m_icon_name(icon_name)
const std::string& icon_name/* = ""*/,
const int px_cnt/* = 16*/,
const bool is_horizontal/* = false*/):
m_parent(parent), m_icon_name(icon_name),
m_px_cnt(px_cnt), m_is_horizontal(is_horizontal)
{
m_bmp = create_scaled_bitmap(parent, icon_name);
m_bmp = create_scaled_bitmap(parent, icon_name, px_cnt, is_horizontal);
}
void PrusaBitmap::rescale()
{
m_bmp = create_scaled_bitmap(m_parent, m_icon_name);
m_bmp = create_scaled_bitmap(m_parent, m_icon_name, m_px_cnt, m_is_horizontal);
}
// ----------------------------------------------------------------------------
@ -2553,14 +2673,13 @@ PrusaButton::PrusaButton(wxWindow *parent,
m_current_icon_name(icon_name),
m_parent(parent)
{
const wxBitmap bmp = create_scaled_bitmap(parent, icon_name);
Create(parent, id, label, pos, size, style);
#ifdef __WXMSW__
if (style & wxNO_BORDER)
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
#endif // __WXMSW__
SetBitmap(bmp);
SetBitmap(create_scaled_bitmap(parent, icon_name));
}
@ -2572,14 +2691,13 @@ PrusaButton::PrusaButton(wxWindow *parent,
m_current_icon_name(bitmap.name()),
m_parent(parent)
{
const wxBitmap& bmp = bitmap.bmp();
Create(parent, id, label, wxDefaultPosition, wxDefaultSize, style);
#ifdef __WXMSW__
if (style & wxNO_BORDER)
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
#endif // __WXMSW__
SetBitmap(bmp);
SetBitmap(bitmap.bmp());
}
void PrusaButton::SetBitmap_(const PrusaBitmap& bmp)

View file

@ -233,6 +233,10 @@ class PrusaObjectDataViewModelNode
wxBitmap m_empty_bmp;
size_t m_volumes_cnt = 0;
std::vector< std::string > m_opt_categories;
std::string m_action_icon_name = "";
Slic3r::ModelVolumeType m_volume_type;
public:
PrusaObjectDataViewModelNode(const wxString &name,
const wxString& extruder) {
@ -246,7 +250,9 @@ public:
m_container = true;
#endif //__WXGTK__
m_extruder = extruder;
set_object_action_icon();
// set_object_action_icon();
set_action_icon();
}
PrusaObjectDataViewModelNode( PrusaObjectDataViewModelNode* parent,
@ -266,7 +272,9 @@ public:
// it will be produce "segmentation fault"
m_container = true;
#endif //__WXGTK__
set_part_action_icon();
// set_part_action_icon();
set_action_icon();
}
PrusaObjectDataViewModelNode( PrusaObjectDataViewModelNode* parent, const ItemType type) :
@ -286,7 +294,8 @@ public:
else if (type == itInstance) {
m_idx = parent->GetChildCount();
m_name = wxString::Format("Instance_%d", m_idx+1);
set_part_action_icon();
// set_part_action_icon();
set_action_icon();
}
}
@ -428,9 +437,14 @@ public:
}
// Set action icons for node
void set_object_action_icon();
void set_part_action_icon();
bool update_settings_digest(const std::vector<std::string>& categories);
// void set_object_action_icon();
// void set_part_action_icon();
void set_action_icon();
void update_settings_digest_bitmaps();
bool update_settings_digest(const std::vector<std::string>& categories);
int volume_type() const { return int(m_volume_type); }
void rescale();
private:
friend class PrusaObjectDataViewModel;
};
@ -527,6 +541,8 @@ public:
void SetVolumeType(const wxDataViewItem &item, const Slic3r::ModelVolumeType type);
void SetAssociatedControl(wxDataViewCtrl* ctrl) { m_ctrl = ctrl; }
// Rescale bitmaps for existing Items
void Rescale();
};
// ----------------------------------------------------------------------------
@ -675,6 +691,36 @@ private:
};
// ----------------------------------------------------------------------------
// PrusaBitmap
// ----------------------------------------------------------------------------
class PrusaBitmap
{
public:
PrusaBitmap() {};
PrusaBitmap(wxWindow *parent,
const std::string& icon_name = "",
const int px_cnt = 16,
const bool is_horizontal = false);
~PrusaBitmap() {}
void rescale();
const wxBitmap& bmp() const { return m_bmp; }
wxBitmap& bmp() { return m_bmp; }
const std::string& name() const{ return m_icon_name; }
private:
wxWindow* m_parent{ nullptr };
wxBitmap m_bmp = wxBitmap();
std::string m_icon_name = "";
int m_px_cnt {16};
bool m_is_horizontal {false};
};
// ----------------------------------------------------------------------------
// PrusaDoubleSlider
// ----------------------------------------------------------------------------
@ -710,6 +756,8 @@ public:
const wxString& name = wxEmptyString);
~PrusaDoubleSlider() {}
void rescale();
int GetMinValue() const { return m_min_value; }
int GetMaxValue() const { return m_max_value; }
double GetMinValueD() { return m_values.empty() ? 0. : m_values[m_min_value].second; }
@ -717,6 +765,7 @@ public:
int GetLowerValue() const { return m_lower_value; }
int GetHigherValue() const { return m_higher_value; }
int GetActiveValue() const;
wxSize get_min_size() const ;
double GetLowerValueD() { return get_double_value(ssLower); }
double GetHigherValueD() { return get_double_value(ssHigher); }
wxSize DoGetBestSize() const override;
@ -801,16 +850,16 @@ private:
int m_max_value;
int m_lower_value;
int m_higher_value;
wxBitmap m_bmp_thumb_higher;
wxBitmap m_bmp_thumb_lower;
wxBitmap m_bmp_add_tick_on;
wxBitmap m_bmp_add_tick_off;
wxBitmap m_bmp_del_tick_on;
wxBitmap m_bmp_del_tick_off;
wxBitmap m_bmp_one_layer_lock_on;
wxBitmap m_bmp_one_layer_lock_off;
wxBitmap m_bmp_one_layer_unlock_on;
wxBitmap m_bmp_one_layer_unlock_off;
/*wxBitmap*/PrusaBitmap m_bmp_thumb_higher;
/*wxBitmap*/PrusaBitmap m_bmp_thumb_lower;
/*wxBitmap*/PrusaBitmap m_bmp_add_tick_on;
/*wxBitmap*/PrusaBitmap m_bmp_add_tick_off;
/*wxBitmap*/PrusaBitmap m_bmp_del_tick_on;
/*wxBitmap*/PrusaBitmap m_bmp_del_tick_off;
/*wxBitmap*/PrusaBitmap m_bmp_one_layer_lock_on;
/*wxBitmap*/PrusaBitmap m_bmp_one_layer_lock_off;
/*wxBitmap*/PrusaBitmap m_bmp_one_layer_unlock_on;
/*wxBitmap*/PrusaBitmap m_bmp_one_layer_unlock_off;
SelectedSlider m_selection;
bool m_is_left_down = false;
bool m_is_right_down = false;
@ -869,41 +918,18 @@ public:
bool IsLocked() const { return m_is_pushed; }
void SetLock(bool lock);
void rescale();
protected:
void enter_button(const bool enter);
private:
bool m_is_pushed = false;
wxBitmap m_bmp_lock_on;
wxBitmap m_bmp_lock_off;
wxBitmap m_bmp_unlock_on;
wxBitmap m_bmp_unlock_off;
};
// ----------------------------------------------------------------------------
// PrusaBitmap
// ----------------------------------------------------------------------------
class PrusaBitmap
{
public:
PrusaBitmap() {};
PrusaBitmap( wxWindow *parent, const std::string& icon_name = "");
~PrusaBitmap() {}
void rescale();
const wxBitmap& bmp() const { return m_bmp; }
const std::string& name() const { return m_icon_name; }
private:
wxWindow* m_parent {nullptr};
wxBitmap m_bmp;
std::string m_icon_name = "";
/*wxBitmap*/PrusaBitmap m_bmp_lock_on;
/*wxBitmap*/PrusaBitmap m_bmp_lock_off;
/*wxBitmap*/PrusaBitmap m_bmp_unlock_on;
/*wxBitmap*/PrusaBitmap m_bmp_unlock_off;
};