Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
wxExtensions.hpp File Reference
#include <wx/checklst.h>
#include <wx/combo.h>
#include <wx/dataview.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/menu.h>
#include <wx/bmpcbox.h>
#include <wx/bmpbndl.h>
#include <wx/statbmp.h>
#include <wx/timer.h>
#include <vector>
#include <functional>
+ Include dependency graph for wxExtensions.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  wxCheckListBoxComboPopup
 
class  wxDataViewTreeCtrlComboPopup
 
class  ScalableBitmap
 
class  LockButton
 
class  ScalableButton
 
class  ModeButton
 
class  ModeSizer
 
class  MenuWithSeparators
 
class  BlinkingBitmap
 
class  Slic3r::GUI::Highlighter
 
class  Slic3r::GUI::HighlighterForWx
 

Namespaces

namespace  Slic3r
 
namespace  Slic3r::GUI
 

Functions

void sys_color_changed_menu (wxMenu *menu)
 
wxMenuItem * append_menu_item (wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, wxBitmapBundle *icon, wxEvtHandler *event_handler=nullptr, std::function< bool()> const cb_condition=[]() { return true;}, wxWindow *parent=nullptr, int insert_pos=wxNOT_FOUND)
 
wxMenuItem * append_menu_item (wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, const std::string &icon="", wxEvtHandler *event_handler=nullptr, std::function< bool()> const cb_condition=[]() { return true;}, wxWindow *parent=nullptr, int insert_pos=wxNOT_FOUND)
 
wxMenuItem * append_submenu (wxMenu *menu, wxMenu *sub_menu, int id, const wxString &string, const wxString &description, const std::string &icon="", std::function< bool()> const cb_condition=[]() { return true;}, wxWindow *parent=nullptr)
 
wxMenuItem * append_menu_radio_item (wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, wxEvtHandler *event_handler)
 
wxMenuItem * append_menu_check_item (wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, wxEvtHandler *event_handler, std::function< bool()> const enable_condition=[]() { return true;}, std::function< bool()> const check_condition=[]() { return true;}, wxWindow *parent=nullptr)
 
void enable_menu_item (wxUpdateUIEvent &evt, std::function< bool()> const cb_condition, wxMenuItem *item, wxWindow *win)
 
void edit_tooltip (wxString &tooltip)
 
void msw_buttons_rescale (wxDialog *dlg, const int em_unit, const std::vector< int > &btn_ids)
 
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_empty_bmp_bundle (int width, int height)
 
wxBitmapBundle * get_solid_bmp_bundle (int width, int height, const std::string &color)
 
std::vector< wxBitmapBundle * > get_extruder_color_icons (bool thin_icon=false)
 
void apply_extruder_selector (Slic3r::GUI::BitmapComboBox **ctrl, wxWindow *parent, const std::string &first_item="", wxPoint pos=wxDefaultPosition, wxSize size=wxDefaultSize, bool use_thin_icon=false)
 

Function Documentation

◆ append_menu_check_item()

wxMenuItem * append_menu_check_item ( wxMenu *  menu,
int  id,
const wxString &  string,
const wxString &  description,
std::function< void(wxCommandEvent &event)>  cb,
wxEvtHandler *  event_handler,
std::function< bool()> const  enable_condition = []() { return true;},
std::function< bool()> const  check_condition = []() { return true;},
wxWindow *  parent = nullptr 
)
150{
151 if (id == wxID_ANY)
152 id = wxNewId();
153
154 wxMenuItem* item = menu->AppendCheckItem(id, string, description);
155
156#ifdef __WXMSW__
157 if (event_handler != nullptr && event_handler != menu)
158 event_handler->Bind(wxEVT_MENU, cb, id);
159 else
160#endif // __WXMSW__
161 menu->Bind(wxEVT_MENU, cb, id);
162
163 if (parent)
164 parent->Bind(wxEVT_UPDATE_UI, [enable_condition, check_condition](wxUpdateUIEvent& evt)
165 {
166 evt.Enable(enable_condition());
167 evt.Check(check_condition());
168 }, id);
169
170 return item;
171}

Referenced by Slic3r::GUI::MenuFactory::append_menu_item_printable(), Slic3r::GUI::MainFrame::init_menubar_as_editor(), Slic3r::GUI::MainFrame::init_menubar_as_gcodeviewer(), and Slic3r::DoubleSlider::Control::show_cog_icon_context_menu().

+ Here is the caller graph for this function:

◆ append_menu_item() [1/2]

wxMenuItem * append_menu_item ( wxMenu *  menu,
int  id,
const wxString &  string,
const wxString &  description,
std::function< void(wxCommandEvent &event)>  cb,
const std::string &  icon = "",
wxEvtHandler *  event_handler = nullptr,
std::function< bool()> const  cb_condition = []() { return true;},
wxWindow *  parent = nullptr,
int  insert_pos = wxNOT_FOUND 
)
89{
90 if (id == wxID_ANY)
91 id = wxNewId();
92
93 wxBitmapBundle* bmp = icon.empty() ? nullptr : get_bmp_bundle(icon);
94
95#ifndef __linux__
96 if (bmp && bmp->IsOk())
97 msw_menuitem_bitmaps[id] = icon;
98#endif /* no __linux__ */
99
100 return append_menu_item(menu, id, string, description, cb, bmp, event_handler, cb_condition, parent, insert_pos);
101}
static std::map< int, std::string > msw_menuitem_bitmaps
Definition wxExtensions.cpp:27
wxMenuItem * append_menu_item(wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, wxBitmapBundle *icon, wxEvtHandler *event_handler, std::function< bool()> const cb_condition, wxWindow *parent, int insert_pos)
Definition wxExtensions.cpp:55
wxBitmapBundle * get_bmp_bundle(const std::string &bmp_name_in, int px_cnt, const std::string &new_color)
Definition wxExtensions.cpp:420

References append_menu_item(), get_bmp_bundle(), and msw_menuitem_bitmaps.

+ Here is the call graph for this function:

◆ append_menu_item() [2/2]

wxMenuItem * append_menu_item ( wxMenu *  menu,
int  id,
const wxString &  string,
const wxString &  description,
std::function< void(wxCommandEvent &event)>  cb,
wxBitmapBundle *  icon,
wxEvtHandler *  event_handler = nullptr,
std::function< bool()> const  cb_condition = []() { return true;},
wxWindow *  parent = nullptr,
int  insert_pos = wxNOT_FOUND 
)
58{
59 if (id == wxID_ANY)
60 id = wxNewId();
61
62 auto *item = new wxMenuItem(menu, id, string, description);
63 if (icon && icon->IsOk()) {
64 item->SetBitmap(*icon);
65 }
66 if (insert_pos == wxNOT_FOUND)
67 menu->Append(item);
68 else
69 menu->Insert(insert_pos, item);
70
71#ifdef __WXMSW__
72 if (event_handler != nullptr && event_handler != menu)
73 event_handler->Bind(wxEVT_MENU, cb, id);
74 else
75#endif // __WXMSW__
76 menu->Bind(wxEVT_MENU, cb, id);
77
78 if (parent) {
79 parent->Bind(wxEVT_UPDATE_UI, [cb_condition, item, parent](wxUpdateUIEvent& evt) {
80 enable_menu_item(evt, cb_condition, item, parent); }, id);
81 }
82
83 return item;
84}
void enable_menu_item(wxUpdateUIEvent &evt, std::function< bool()> const cb_condition, wxMenuItem *item, wxWindow *win)
Definition wxExtensions.cpp:49

References enable_menu_item().

Referenced by Slic3r::GUI::add_common_view_menu_items(), Slic3r::DoubleSlider::Control::append_add_color_change_menu_item(), Slic3r::DoubleSlider::Control::append_change_extruder_menu_item(), append_menu_item(), Slic3r::GUI::MenuFactory::append_menu_item_add_text(), Slic3r::GUI::MenuFactory::append_menu_item_change_extruder(), Slic3r::GUI::MenuFactory::append_menu_item_change_type(), Slic3r::GUI::MenuFactory::append_menu_item_delete(), Slic3r::GUI::MenuFactory::append_menu_item_edit_text(), Slic3r::GUI::MenuFactory::append_menu_item_export_stl(), Slic3r::GUI::MenuFactory::append_menu_item_fix_through_netfabb(), Slic3r::GUI::MenuFactory::append_menu_item_instance_to_object(), Slic3r::GUI::MenuFactory::append_menu_item_invalidate_cut_info(), Slic3r::GUI::MenuFactory::append_menu_item_layers_editing(), Slic3r::GUI::MenuFactory::append_menu_item_merge_to_multipart_object(), Slic3r::GUI::MenuFactory::append_menu_item_reload_from_disk(), Slic3r::GUI::MenuFactory::append_menu_item_replace_with_stl(), Slic3r::GUI::MenuFactory::append_menu_item_scale_selection_to_fit_print_volume(), Slic3r::GUI::MenuFactory::append_menu_item_simplify(), Slic3r::GUI::MenuFactory::append_menu_items_add_volume(), Slic3r::GUI::MenuFactory::append_menu_items_convert_unit(), Slic3r::GUI::MenuFactory::append_menu_items_instance_manipulation(), Slic3r::GUI::MenuFactory::append_menu_items_mirror(), Slic3r::GUI::MenuFactory::append_menu_items_osx(), Slic3r::GUI::MenuFactory::append_menu_items_split(), Slic3r::GUI::MenuFactory::append_submenu_add_generic(), Slic3r::GUI::create_freq_settings_popupmenu(), Slic3r::GUI::MenuFactory::create_part_menu(), Slic3r::GUI::create_settings_popupmenu(), Slic3r::GUI::generate_help_menu(), Slic3r::GUI::MainFrame::init_menubar_as_editor(), Slic3r::GUI::MainFrame::init_menubar_as_gcodeviewer(), Slic3r::GUI::MenuFactory::multi_selection_menu(), Slic3r::DoubleSlider::Control::show_add_context_menu(), Slic3r::GUI::PlaterPresetComboBox::show_add_menu(), Slic3r::DoubleSlider::Control::show_cog_icon_context_menu(), Slic3r::GUI::GalleryDialog::show_context_menu(), Slic3r::DoubleSlider::Control::show_edit_context_menu(), and Slic3r::GUI::PlaterPresetComboBox::show_edit_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ append_menu_radio_item()

wxMenuItem * append_menu_radio_item ( wxMenu *  menu,
int  id,
const wxString &  string,
const wxString &  description,
std::function< void(wxCommandEvent &event)>  cb,
wxEvtHandler *  event_handler 
)
131{
132 if (id == wxID_ANY)
133 id = wxNewId();
134
135 wxMenuItem* item = menu->AppendRadioItem(id, string, description);
136
137#ifdef __WXMSW__
138 if (event_handler != nullptr && event_handler != menu)
139 event_handler->Bind(wxEVT_MENU, cb, id);
140 else
141#endif // __WXMSW__
142 menu->Bind(wxEVT_MENU, cb, id);
143
144 return item;
145}

◆ append_submenu()

wxMenuItem * append_submenu ( wxMenu *  menu,
wxMenu *  sub_menu,
int  id,
const wxString &  string,
const wxString &  description,
const std::string &  icon = "",
std::function< bool()> const  cb_condition = []() { return true;},
wxWindow *  parent = nullptr 
)
105{
106 if (id == wxID_ANY)
107 id = wxNewId();
108
109 wxMenuItem* item = new wxMenuItem(menu, id, string, description);
110 if (!icon.empty()) {
111 item->SetBitmap(*get_bmp_bundle(icon));
112
113#ifndef __linux__
114 msw_menuitem_bitmaps[id] = icon;
115#endif // no __linux__
116 }
117
118 item->SetSubMenu(sub_menu);
119 menu->Append(item);
120
121 if (parent) {
122 parent->Bind(wxEVT_UPDATE_UI, [cb_condition, item, parent](wxUpdateUIEvent& evt) {
123 enable_menu_item(evt, cb_condition, item, parent); }, id);
124 }
125
126 return item;
127}

References enable_menu_item(), get_bmp_bundle(), and msw_menuitem_bitmaps.

Referenced by Slic3r::DoubleSlider::Control::append_change_extruder_menu_item(), Slic3r::GUI::MenuFactory::append_menu_item_change_extruder(), Slic3r::GUI::MenuFactory::append_menu_items_add_volume(), Slic3r::GUI::MenuFactory::append_menu_items_mirror(), Slic3r::GUI::MenuFactory::append_menu_items_split(), Slic3r::GUI::MenuFactory::create_default_menu(), Slic3r::GUI::MainFrame::init_menubar_as_editor(), and Slic3r::DoubleSlider::Control::show_cog_icon_context_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apply_extruder_selector()

void apply_extruder_selector ( Slic3r::GUI::BitmapComboBox **  ctrl,
wxWindow *  parent,
const std::string &  first_item = "",
wxPoint  pos = wxDefaultPosition,
wxSize  size = wxDefaultSize,
bool  use_thin_icon = false 
)
484{
485 std::vector<wxBitmapBundle*> icons = get_extruder_color_icons(use_thin_icon);
486
487 if (!*ctrl) {
488 *ctrl = new Slic3r::GUI::BitmapComboBox(parent, wxID_ANY, wxEmptyString, pos, size, 0, nullptr, wxCB_READONLY);
489 Slic3r::GUI::wxGetApp().UpdateDarkUI(*ctrl);
490 }
491 else
492 {
493 (*ctrl)->SetPosition(pos);
494 (*ctrl)->SetMinSize(size);
495 (*ctrl)->SetSize(size);
496 (*ctrl)->Clear();
497 }
498 if (first_item.empty())
499 (*ctrl)->Hide(); // to avoid unwanted rendering before layout (ExtruderSequenceDialog)
500
501 if (icons.empty() && !first_item.empty()) {
502 (*ctrl)->Append(_(first_item), wxNullBitmap);
503 return;
504 }
505
506 // For ObjectList we use short extruder name (just a number)
507 const bool use_full_item_name = dynamic_cast<Slic3r::GUI::ObjectList*>(parent) == nullptr;
508
509 int i = 0;
510 wxString str = _(L("Extruder"));
511 for (wxBitmapBundle* bmp : icons) {
512 if (i == 0) {
513 if (!first_item.empty())
514 (*ctrl)->Append(_(first_item), *bmp);
515 ++i;
516 }
517
518 (*ctrl)->Append(use_full_item_name
519 ? Slic3r::GUI::from_u8((boost::format("%1% %2%") % str % i).str())
520 : wxString::Format("%d", i), *bmp);
521 ++i;
522 }
523 (*ctrl)->SetSelection(0);
524}
Definition BitmapComboBox.hpp:17
Definition GUI_ObjectList.hpp:78
#define _(msgid)
Definition getopt.c:87
wxString from_u8(const std::string &str)
Definition GUI.cpp:437
#define L(s)
Definition I18N.hpp:18
std::vector< wxBitmapBundle * > get_extruder_color_icons(bool thin_icon)
Definition wxExtensions.cpp:462

References _, Slic3r::GUI::from_u8(), get_extruder_color_icons(), and L.

Referenced by Slic3r::GUI::ExtruderSequenceDialog::apply_extruder_sequence(), and Slic3r::GUI::ObjectList::extruder_editing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit_tooltip()

void edit_tooltip ( wxString &  tooltip)
363{
364 tooltip.Replace("Slic3r", SLIC3R_APP_KEY, true);
365}

Referenced by Slic3r::GUI::Option::Option().

+ Here is the caller graph for this function:

◆ em_unit()

int em_unit ( wxWindow *  win)
389{
390 if (win)
391 {
392 wxTopLevelWindow *toplevel = Slic3r::GUI::find_toplevel_parent(win);
393 Slic3r::GUI::DPIDialog* dlg = dynamic_cast<Slic3r::GUI::DPIDialog*>(toplevel);
394 if (dlg)
395 return dlg->em_unit();
396 Slic3r::GUI::DPIFrame* frame = dynamic_cast<Slic3r::GUI::DPIFrame*>(toplevel);
397 if (frame)
398 return frame->em_unit();
399 }
400
401 return Slic3r::GUI::wxGetApp().em_unit();
402}
Definition GUI_Utils.hpp:82
int em_unit() const
Definition GUI_Utils.hpp:176
wxTopLevelWindow * find_toplevel_parent(wxWindow *window)
Definition GUI_Utils.cpp:33

References Slic3r::GUI::DPIAware< P >::em_unit(), and Slic3r::GUI::find_toplevel_parent().

Referenced by Slic3r::GUI::DiamTextCtrl::DiamTextCtrl(), Slic3r::GUI::ErrorDialog::ErrorDialog(), Slic3r::GUI::FreqChangedParams::FreqChangedParams(), Slic3r::GUI::MsgDataIncompatible::MsgDataIncompatible(), Slic3r::GUI::MsgDataLegacy::MsgDataLegacy(), Slic3r::GUI::MsgDialog::MsgDialog(), Slic3r::GUI::MsgNoAppUpdates::MsgNoAppUpdates(), Slic3r::GUI::MsgNoUpdates::MsgNoUpdates(), Slic3r::GUI::MsgUpdateConfig::MsgUpdateConfig(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::ObjectLayers::ObjectLayers(), Slic3r::GUI::OG_CustomCtrl::OG_CustomCtrl(), Slic3r::GUI::ogStaticText::ogStaticText(), Slic3r::GUI::PrintHostSendDialog::PrintHostSendDialog(), ScalableButton::ScalableButton(), Slic3r::GUI::Sidebar::Sidebar(), Slic3r::GUI::Tab::Tab(), Slic3r::GUI::OptionsGroup::activate_line(), Slic3r::GUI::BedShapePanel::build_panel(), Slic3r::GUI::Sidebar::change_top_border_for_mode_sizer(), Slic3r::GUI::PreferencesDialog::create_downloader_path_sizer(), Slic3r::GUI::TabFilament::create_extruder_combobox(), Slic3r::GUI::PreferencesDialog::create_icon_size_slider(), Slic3r::GUI::ObjectLayers::create_layers_list(), Slic3r::GUI::TabPrint::create_manage_substitution_widget(), Slic3r::GUI::Tab::create_preset_tab(), Slic3r::GUI::PreferencesDialog::create_settings_font_widget(), Slic3r::GUI::PreferencesDialog::create_settings_mode_color_widget(), Slic3r::GUI::PreferencesDialog::create_settings_mode_widget(), Slic3r::GUI::PreferencesDialog::create_settings_text_color_widget(), Slic3r::GUI::TabPrint::create_substitutions_widget(), Slic3r::GUI::create_word_local_combo(), Slic3r::GUI::GUI_Descriptions::FillSizerWithModeColorDescriptions(), Slic3r::GUI::SubstitutionManager::init(), Slic3r::GUI::Sidebar::init_filament_combo(), Slic3r::GUI::PreferencesDialog::layout(), Slic3r::GUI::ObjectList::list_manipulation(), msw_buttons_rescale(), Slic3r::GUI::Field::msw_rescale(), Slic3r::GUI::LayerRangeEditor::msw_rescale(), Slic3r::GUI::OG_CustomCtrl::msw_rescale(), Slic3r::GUI::Sidebar::msw_rescale(), Slic3r::GUI::PreferencesDialog::msw_rescale(), Slic3r::GUI::PresetComboBox::msw_rescale(), Slic3r::GUI::Tab::msw_rescale(), Slic3r::GUI::msw_rescale_word_local_combo(), Slic3r::GUI::Field::PostInitialize(), Slic3r::GUI::ObjectList::set_min_height(), Slic3r::GUI::ObjectList::set_tooltip_for_item(), Slic3r::GUI::ogStaticText::SetText(), Slic3r::Search::OptionsSearcher::show_dialog(), and ScalableButton::sys_color_changed().

+ Here is the call graph for this function:

◆ enable_menu_item()

void enable_menu_item ( wxUpdateUIEvent &  evt,
std::function< bool()> const  cb_condition,
wxMenuItem *  item,
wxWindow *  win 
)
50{
51 const bool enable = cb_condition();
52 evt.Enable(enable);
53}

Referenced by append_menu_item(), and append_submenu().

+ Here is the caller graph for this function:

◆ get_bmp_bundle()

wxBitmapBundle * get_bmp_bundle ( const std::string &  bmp_name,
int  px_cnt = 16,
const std::string &  new_color_rgb = std::string() 
)
421{
422#ifdef __WXGTK2__
423 px_cnt *= scale();
424#endif // __WXGTK2__
425
426 static Slic3r::GUI::BitmapCache cache;
427
428 std::string bmp_name = bmp_name_in;
429 boost::replace_last(bmp_name, ".png", "");
430
431 // Try loading an SVG first, then PNG if SVG is not found:
432 wxBitmapBundle* bmp = cache.from_svg(bmp_name, px_cnt, px_cnt, Slic3r::GUI::wxGetApp().dark_mode(), new_color);
433 if (bmp == nullptr) {
434 bmp = cache.from_png(bmp_name, px_cnt, px_cnt);
435 if (!bmp)
436 // Neither SVG nor PNG has been found, raise error
437 throw Slic3r::RuntimeError("Could not load bitmap: " + bmp_name);
438 }
439 return bmp;
440}
int scale(const int val)
Definition WipeTowerDialog.cpp:14
Definition BitmapCache.hpp:20
wxBitmapBundle * from_png(const std::string &bitmap_name, unsigned width, unsigned height)
Definition BitmapCache.cpp:420
wxBitmapBundle * from_svg(const std::string &bitmap_name, unsigned target_width, unsigned target_height, const bool dark_mode, const std::string &new_color="")
Definition BitmapCache.cpp:390

References Slic3r::GUI::BitmapCache::from_png(), Slic3r::GUI::BitmapCache::from_svg(), and scale().

Referenced by Slic3r::GUI::AboutDialog::AboutDialog(), Slic3r::GUI::ErrorDialog::ErrorDialog(), Slic3r::GUI::ObjectDataViewModel::ObjectDataViewModel(), Slic3r::GUI::ObjectDataViewModelNode::ObjectDataViewModelNode(), Slic3r::GUI::ObjectDataViewModelNode::ObjectDataViewModelNode(), Slic3r::GUI::ObjectInfo::ObjectInfo(), Slic3r::GUI::OG_CustomCtrl::OG_CustomCtrl(), Slic3r::GUI::PresetComboBox::PresetComboBox(), ScalableBitmap::ScalableBitmap(), ScalableButton::ScalableButton(), Slic3r::GUI::SysInfoDialog::SysInfoDialog(), Slic3r::GUI::add_default_image(), Slic3r::GUI::add_lock(), Slic3r::DoubleSlider::Control::append_add_color_change_menu_item(), append_menu_item(), Slic3r::GUI::MenuFactory::append_menu_item_settings(), append_submenu(), Slic3r::GUI::MsgDialog::apply_style(), Slic3r::GUI::KBShortcutsDialog::create_header(), Slic3r::DoubleSlider::Control::draw_action_icon(), Slic3r::GUI::OG_CustomCtrl::CtrlLine::draw_blinking_bmp(), Slic3r::GUI::OG_CustomCtrl::CtrlLine::draw_mode_bmp(), Slic3r::DoubleSlider::Control::draw_ticks(), Slic3r::GUI::ModePaletteComboBox::get_bmp(), Slic3r::GUI::PresetComboBox::get_bmp(), Slic3r::GUI::PresetComboBox::get_bmp(), Slic3r::GUI::SettingsFactory::get_category_bitmap(), Slic3r::GUI::MenuFactory::get_text_volume_bitmaps(), Slic3r::GUI::MenuFactory::get_volume_bitmaps(), Slic3r::GUI::OG_CustomCtrl::CtrlLine::msw_rescale(), Slic3r::GUI::OG_CustomCtrl::msw_rescale(), Slic3r::GUI::GUI_App::on_init_inner(), Slic3r::GUI::ObjectDataViewModelNode::set_action_and_extruder_icons(), Slic3r::GUI::ObjectDataViewModelNode::set_printable_icon(), ScalableButton::SetBitmap_(), Slic3r::GUI::ObjectDataViewModelNode::sys_color_changed(), Slic3r::GUI::PresetComboBox::sys_color_changed(), ScalableBitmap::sys_color_changed(), ScalableButton::sys_color_changed(), sys_color_changed_menu(), ModeButton::update_bitmap(), Slic3r::GUI::TabFilament::update_extruder_combobox(), Slic3r::GUI::MainFrame::update_menubar(), Slic3r::GUI::Tab::update_show_hide_incompatible_button(), Slic3r::GUI::SavePresetDialog::Item::update_valid_bmp(), Slic3r::GUI::ObjectInfo::update_warning_icon(), Slic3r::GUI::ObjectDataViewModel::UpdateBitmaps(), and Slic3r::GUI::ModelNode::UpdateIcons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_empty_bmp_bundle()

wxBitmapBundle * get_empty_bmp_bundle ( int  width,
int  height 
)
443{
444 static Slic3r::GUI::BitmapCache cache;
445#ifdef __WXGTK2__
446 return cache.mkclear_bndl(width * scale(), height * scale());
447#else
448 return cache.mkclear_bndl(width, height);
449#endif // __WXGTK2__
450}
wxBitmapBundle * mkclear_bndl(size_t width, size_t height)
Definition BitmapCache.hpp:59

References Slic3r::GUI::BitmapCache::mkclear_bndl(), and scale().

Referenced by Slic3r::GUI::ModePaletteComboBox::get_bmp(), Slic3r::GUI::PresetComboBox::get_bmp(), Slic3r::GUI::PresetComboBox::get_bmp(), and Slic3r::GUI::PresetComboBox::NullBitmapBndl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_extruder_color_icons()

std::vector< wxBitmapBundle * > get_extruder_color_icons ( bool  thin_icon = false)
463{
464 // Create the bitmap with color bars.
465 std::vector<wxBitmapBundle*> bmps;
466 std::vector<std::string> colors = Slic3r::GUI::wxGetApp().plater()->get_extruder_colors_from_plater_config();
467
468 if (colors.empty())
469 return bmps;
470
471 for (const std::string& color : colors)
472 bmps.emplace_back(get_solid_bmp_bundle(thin_icon ? 16 : 32, 16, color));
473
474 return bmps;
475}
wxBitmapBundle * get_solid_bmp_bundle(int width, int height, const std::string &color)
Definition wxExtensions.cpp:452

References get_solid_bmp_bundle().

Referenced by Slic3r::DoubleSlider::Control::append_change_extruder_menu_item(), Slic3r::GUI::MenuFactory::append_menu_item_change_extruder(), apply_extruder_selector(), BitmapChoiceRenderer::CreateEditorCtrl(), and Slic3r::GUI::ObjectDataViewModelNode::UpdateExtruderAndColorIcon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_solid_bmp_bundle()

wxBitmapBundle * get_solid_bmp_bundle ( int  width,
int  height,
const std::string &  color 
)
453{
454 static Slic3r::GUI::BitmapCache cache;
455#ifdef __WXGTK2__
456 return cache.mksolid_bndl(width * scale(), height * scale(), color, 1, Slic3r::GUI::wxGetApp().dark_mode());
457#else
458 return cache.mksolid_bndl(width, height, color, 1, Slic3r::GUI::wxGetApp().dark_mode());
459#endif // __WXGTK2__
460}
wxBitmapBundle * mksolid_bndl(size_t width, size_t height, const std::string &color=std::string(), size_t border_width=0, bool dark_mode=false)
Definition BitmapCache.cpp:605

References Slic3r::GUI::BitmapCache::mksolid_bndl(), and scale().

Referenced by Slic3r::GUI::ModelNode::get_bitmap(), Slic3r::GUI::PresetComboBox::get_bmp(), and get_extruder_color_icons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mode_icon_px_size()

int mode_icon_px_size ( )
405{
406#ifdef __APPLE__
407 return 10;
408#else
409 return 12;
410#endif
411}

Referenced by ModeSizer::ModeSizer().

+ Here is the caller graph for this function:

◆ msw_buttons_rescale()

void msw_buttons_rescale ( wxDialog *  dlg,
const int  em_unit,
const std::vector< int > &  btn_ids 
)
371{
372 const wxSize& btn_size = wxSize(-1, int(2.5f * em_unit + 0.5f));
373
374 for (int btn_id : btn_ids) {
375 // There is a case [FirmwareDialog], when we have wxControl instead of wxButton
376 // so let casting everything to the wxControl
377 wxControl* btn = static_cast<wxControl*>(dlg->FindWindowById(btn_id, dlg));
378 if (btn)
379 btn->SetMinSize(btn_size);
380 }
381}
int em_unit(wxWindow *win)
Definition wxExtensions.cpp:388

References em_unit().

Referenced by Slic3r::GUI::PreferencesDialog::msw_rescale(), Slic3r::GUI::SendSystemInfoDialog::on_dpi_changed(), Slic3r::GUI::CopyrightsDialog::on_dpi_changed(), Slic3r::GUI::AboutDialog::on_dpi_changed(), Slic3r::GUI::ConfigSnapshotDialog::on_dpi_changed(), Slic3r::GUI::ConfigWizard::on_dpi_changed(), Slic3r::GUI::ExtruderSequenceDialog::on_dpi_changed(), Slic3r::FirmwareDialog::on_dpi_changed(), Slic3r::GUI::GalleryDialog::on_dpi_changed(), Slic3r::GUI::KBShortcutsDialog::on_dpi_changed(), Slic3r::GUI::PhysicalPrinterDialog::on_dpi_changed(), Slic3r::GUI::PrintHostQueueDialog::on_dpi_changed(), Slic3r::GUI::SavePresetDialog::on_dpi_changed(), Slic3r::GUI::SysInfoDialog::on_dpi_changed(), Slic3r::GUI::UnsavedChangesDialog::on_dpi_changed(), and Slic3r::GUI::DiffPresetDialog::on_dpi_changed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sys_color_changed_menu()

void sys_color_changed_menu ( wxMenu *  menu)
29{
30 struct update_icons {
31 static void run(wxMenuItem* item) {
32 const auto it = msw_menuitem_bitmaps.find(item->GetId());
33 if (it != msw_menuitem_bitmaps.end()) {
34 wxBitmapBundle* item_icon = get_bmp_bundle(it->second);
35 if (item_icon->IsOk())
36 item->SetBitmap(*item_icon);
37 }
38 if (item->IsSubMenu())
39 for (wxMenuItem *sub_item : item->GetSubMenu()->GetMenuItems())
40 update_icons::run(sub_item);
41 }
42 };
43
44 for (wxMenuItem *item : menu->GetMenuItems())
45 update_icons::run(item);
46}

References get_bmp_bundle(), and msw_menuitem_bitmaps.

Referenced by Slic3r::GUI::MenuFactory::sys_color_changed(), and Slic3r::GUI::MenuFactory::sys_color_changed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: