Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::Search::SearchDialog Class Reference

#include <src/slic3r/GUI/Search.hpp>

+ Inheritance diagram for Slic3r::Search::SearchDialog:
+ Collaboration diagram for Slic3r::Search::SearchDialog:

Public Member Functions

 SearchDialog (OptionsSearcher *searcher)
 
 ~SearchDialog ()
 
void Popup (wxPoint position=wxDefaultPosition)
 
void ProcessSelection (wxDataViewItem selection)
 
void msw_rescale ()
 
void on_sys_color_changed () override
 
float scale_factor () const
 
float prev_scale_factor () const
 
int em_unit () const
 
const wxFont & normal_font () const
 
void enable_force_rescale ()
 

Protected Member Functions

void on_dpi_changed (const wxRect &suggested_rect) override
 

Private Member Functions

void OnInputText (wxCommandEvent &event)
 
void OnLeftUpInTextCtrl (wxEvent &event)
 
void OnKeyDown (wxKeyEvent &event)
 
void OnActivate (wxDataViewEvent &event)
 
void OnSelect (wxDataViewEvent &event)
 
void OnCheck (wxCommandEvent &event)
 
void OnMotion (wxMouseEvent &event)
 
void OnLeftDown (wxMouseEvent &event)
 
void update_list ()
 
bool is_new_scale_factor () const
 
void scale_win_font (wxWindow *window, const int font_point_size)
 
void scale_controls_fonts (wxWindow *window, const int font_point_size)
 
void rescale (const wxRect &suggested_rect)
 

Private Attributes

wxString search_str
 
wxString default_string
 
bool prevent_list_events {false}
 
wxTextCtrl * search_line { nullptr }
 
wxDataViewCtrl * search_list { nullptr }
 
SearchListModelsearch_list_model { nullptr }
 
wxCheckBox * check_category { nullptr }
 
wxCheckBox * check_english { nullptr }
 
OptionsSearchersearcher { nullptr }
 
float m_scale_factor
 
int m_em_unit
 
wxFont m_normal_font
 
float m_prev_scale_factor
 
bool m_can_rescale { true }
 
bool m_force_rescale { false }
 
int m_new_font_point_size
 

Detailed Description

Constructor & Destructor Documentation

◆ SearchDialog()

Slic3r::Search::SearchDialog::SearchDialog ( OptionsSearcher searcher)
482 : GUI::DPIDialog(GUI::wxGetApp().tab_panel(), wxID_ANY, _L("Search"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
484{
485 SetFont(GUI::wxGetApp().normal_font());
486 GUI::wxGetApp().UpdateDarkUI(this);
487
488 default_string = _L("Enter a search term");
489 int border = 10;
490 int em = em_unit();
491
492 search_line = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
493 GUI::wxGetApp().UpdateDarkUI(search_line);
494
495 search_list = new wxDataViewCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(em * 40, em * 30), wxDV_NO_HEADER | wxDV_SINGLE
496#ifdef _WIN32
497 | wxBORDER_SIMPLE
498#endif
499 );
500 GUI::wxGetApp().UpdateDarkUI(search_list);
501 search_list_model = new SearchListModel(this);
502 search_list->AssociateModel(search_list_model);
503
504#ifdef __WXMSW__
505 search_list->AppendColumn(new wxDataViewColumn("", new BitmapTextRenderer(true, wxDATAVIEW_CELL_INERT), SearchListModel::colIconMarkedText, wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT));
506 search_list->GetColumn(SearchListModel::colIconMarkedText)->SetWidth(48 * em_unit());
507#else
508 search_list->AppendBitmapColumn("", SearchListModel::colIcon);
509
510 wxDataViewTextRenderer* const markupRenderer = new wxDataViewTextRenderer();
511
512#ifdef SUPPORTS_MARKUP
513 markupRenderer->EnableMarkup();
514#endif
515
516 search_list->AppendColumn(new wxDataViewColumn("", markupRenderer, SearchListModel::colMarkedText, wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT));
517
518 search_list->GetColumn(SearchListModel::colIcon )->SetWidth(3 * em_unit());
519 search_list->GetColumn(SearchListModel::colMarkedText)->SetWidth(40 * em_unit());
520#endif
521
522 wxBoxSizer* check_sizer = new wxBoxSizer(wxHORIZONTAL);
523
524 check_category = new wxCheckBox(this, wxID_ANY, _L("Category"));
525 if (GUI::wxGetApp().is_localized())
526 check_english = new wxCheckBox(this, wxID_ANY, _L("Search in English"));
527
528 wxStdDialogButtonSizer* cancel_btn = this->CreateStdDialogButtonSizer(wxCANCEL);
529 GUI::wxGetApp().UpdateDarkUI(static_cast<wxButton*>(this->FindWindowById(wxID_CANCEL, this)));
530
531 check_sizer->Add(new wxStaticText(this, wxID_ANY, _L("Use for search") + ":"), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, border);
532 check_sizer->Add(check_category, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, border);
533 if (check_english)
534 check_sizer->Add(check_english, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, border);
535 check_sizer->AddStretchSpacer(border);
536 check_sizer->Add(cancel_btn, 0, wxALIGN_CENTER_VERTICAL);
537
538 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
539
540 topSizer->Add(search_line, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
541 topSizer->Add(search_list, 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
542 topSizer->Add(check_sizer, 0, wxEXPAND | wxALL, border);
543
544 search_line->Bind(wxEVT_TEXT, &SearchDialog::OnInputText, this);
545 search_line->Bind(wxEVT_LEFT_UP, &SearchDialog::OnLeftUpInTextCtrl, this);
546 // process wxEVT_KEY_DOWN to navigate inside search_list, if ArrowUp/Down was pressed
547 search_line->Bind(wxEVT_KEY_DOWN,&SearchDialog::OnKeyDown, this);
548
549 search_list->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, &SearchDialog::OnSelect, this);
550 search_list->Bind(wxEVT_DATAVIEW_ITEM_ACTIVATED, &SearchDialog::OnActivate, this);
551#ifdef __WXMSW__
552 search_list->GetMainWindow()->Bind(wxEVT_MOTION, &SearchDialog::OnMotion, this);
553 search_list->GetMainWindow()->Bind(wxEVT_LEFT_DOWN, &SearchDialog::OnLeftDown, this);
554#endif //__WXMSW__
555
556 // Under OSX mouse and key states didn't fill after wxEVT_DATAVIEW_SELECTION_CHANGED call
557 // As a result, we can't to identify what kind of actions was done
558 // So, under OSX is used OnKeyDown function to navigate inside the list
559#ifdef __APPLE__
560 search_list->Bind(wxEVT_KEY_DOWN, &SearchDialog::OnKeyDown, this);
561#endif
562
563 check_category->Bind(wxEVT_CHECKBOX, &SearchDialog::OnCheck, this);
564 if (check_english)
565 check_english ->Bind(wxEVT_CHECKBOX, &SearchDialog::OnCheck, this);
566
567// Bind(wxEVT_MOTION, &SearchDialog::OnMotion, this);
568 Bind(wxEVT_LEFT_DOWN, &SearchDialog::OnLeftDown, this);
569
570 SetSizer(topSizer);
571 topSizer->SetSizeHints(this);
572}
Definition ExtraRenderers.hpp:64
int em_unit() const
Definition GUI_Utils.hpp:176
const wxFont & normal_font() const
Definition GUI_Utils.hpp:178
OptionsSearcher * searcher
Definition Search.hpp:164
wxTextCtrl * search_line
Definition Search.hpp:158
void OnMotion(wxMouseEvent &event)
Definition Search.cpp:712
SearchListModel * search_list_model
Definition Search.hpp:160
void OnCheck(wxCommandEvent &event)
Definition Search.cpp:701
void OnLeftDown(wxMouseEvent &event)
Definition Search.cpp:726
void OnInputText(wxCommandEvent &event)
Definition Search.cpp:609
void OnSelect(wxDataViewEvent &event)
Definition Search.cpp:665
wxString default_string
Definition Search.hpp:154
wxDataViewCtrl * search_list
Definition Search.hpp:159
wxCheckBox * check_category
Definition Search.hpp:161
wxCheckBox * check_english
Definition Search.hpp:162
void OnKeyDown(wxKeyEvent &event)
Definition Search.cpp:628
void OnLeftUpInTextCtrl(wxEvent &event)
Definition Search.cpp:620
void OnActivate(wxDataViewEvent &event)
Definition Search.cpp:660
@ colMarkedText
Definition Search.hpp:209
@ colIcon
Definition Search.hpp:208
DPIAware< wxDialog > DPIDialog
Definition GUI_Utils.hpp:279
#define _L(s)
Definition I18N.hpp:3

References _L, check_category, check_english, Slic3r::Search::SearchListModel::colIcon, Slic3r::Search::SearchListModel::colMarkedText, default_string, Slic3r::GUI::DPIAware< P >::em_unit(), Slic3r::GUI::DPIAware< P >::normal_font(), OnActivate(), OnCheck(), OnInputText(), OnKeyDown(), OnLeftDown(), OnLeftUpInTextCtrl(), OnMotion(), OnSelect(), search_line, search_list, and search_list_model.

+ Here is the call graph for this function:

◆ ~SearchDialog()

Slic3r::Search::SearchDialog::~SearchDialog ( )
inline
181{}

Member Function Documentation

◆ em_unit()

template<class P >
int Slic3r::GUI::DPIAware< P >::em_unit ( ) const
inlineinherited
176{ return m_em_unit; }
int m_em_unit
Definition GUI_Utils.hpp:195

References Slic3r::GUI::DPIAware< P >::m_em_unit.

Referenced by Slic3r::GUI::AboutDialog::AboutDialog(), Slic3r::GUI::CopyrightsDialog::CopyrightsDialog(), Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::GUI::GalleryDialog::GalleryDialog(), Slic3r::GUI::PageMaterials::PageMaterials(), SearchDialog(), Slic3r::GUI::SendSystemInfoDialog::SendSystemInfoDialog(), Slic3r::GUI::SettingsDialog::SettingsDialog(), Slic3r::GUI::SysInfoDialog::SysInfoDialog(), Slic3r::GUI::ExtruderSequenceDialog::apply_extruder_sequence(), Slic3r::GUI::UnsavedChangesDialog::build(), Slic3r::GUI::DiffPresetDialog::complete_dialog_creation(), Slic3r::GUI::DiffPresetDialog::create_edit_sizer(), Slic3r::GUI::DiffPresetDialog::create_presets_sizer(), Slic3r::GUI::DiffPresetDialog::create_tree(), em_unit(), Slic3r::GUI::SavePresetDialog::Item::init_input_name_ctrl(), msw_rescale(), Slic3r::GUI::SendSystemInfoDialog::on_dpi_changed(), Slic3r::GUI::CopyrightsDialog::on_dpi_changed(), Slic3r::GUI::AboutDialog::on_dpi_changed(), Slic3r::GUI::BedShapeDialog::on_dpi_changed(), Slic3r::GUI::ConfigSnapshotDialog::on_dpi_changed(), Slic3r::GUI::ConfigWizard::on_dpi_changed(), Slic3r::GUI::ExtruderSequenceDialog::on_dpi_changed(), Slic3r::GUI::FileArchiveDialog::on_dpi_changed(), Slic3r::FirmwareDialog::on_dpi_changed(), Slic3r::GUI::GalleryDialog::on_dpi_changed(), Slic3r::GUI::KBShortcutsDialog::on_dpi_changed(), Slic3r::GUI::SettingsDialog::on_dpi_changed(), Slic3r::GUI::PhysicalPrinterDialog::on_dpi_changed(), Slic3r::GUI::LoadProjectsDialog::on_dpi_changed(), Slic3r::GUI::ProjectDropDialog::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(), Slic3r::GUI::DiffPresetDialog::on_dpi_changed(), and Slic3r::GUI::GUI_App::update_fonts().

+ Here is the caller graph for this function:

◆ enable_force_rescale()

template<class P >
void Slic3r::GUI::DPIAware< P >::enable_force_rescale ( )
inlineinherited
179{ m_force_rescale = true; }
bool m_force_rescale
Definition GUI_Utils.hpp:201

References Slic3r::GUI::DPIAware< P >::m_force_rescale.

Referenced by Slic3r::GUI::MainFrame::update_layout().

+ Here is the caller graph for this function:

◆ is_new_scale_factor()

template<class P >
bool Slic3r::GUI::DPIAware< P >::is_new_scale_factor ( ) const
inlineprivateinherited
214{ return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }
float m_scale_factor
Definition GUI_Utils.hpp:194
float m_prev_scale_factor
Definition GUI_Utils.hpp:199

References Slic3r::GUI::DPIAware< P >::m_prev_scale_factor, and Slic3r::GUI::DPIAware< P >::m_scale_factor.

Referenced by Slic3r::GUI::DPIAware< P >::DPIAware().

+ Here is the caller graph for this function:

◆ msw_rescale()

void Slic3r::Search::SearchDialog::msw_rescale ( )
732{
733 const int& em = em_unit();
734#ifdef __WXMSW__
735 search_list->GetColumn(SearchListModel::colIconMarkedText)->SetWidth(48 * em);
736#else
737 search_list->GetColumn(SearchListModel::colIcon )->SetWidth(3 * em);
738 search_list->GetColumn(SearchListModel::colMarkedText)->SetWidth(45 * em);
739#endif
740 const wxSize& size = wxSize(40 * em, 30 * em);
741 SetMinSize(size);
742
743 Fit();
744 Refresh();
745}
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References Slic3r::Search::SearchListModel::colIcon, Slic3r::Search::SearchListModel::colMarkedText, Slic3r::GUI::DPIAware< P >::em_unit(), and search_list.

Referenced by Slic3r::Search::OptionsSearcher::dlg_msw_rescale(), and on_dpi_changed().

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

◆ normal_font()

template<class P >
const wxFont & Slic3r::GUI::DPIAware< P >::normal_font ( ) const
inlineinherited

◆ on_dpi_changed()

void Slic3r::Search::SearchDialog::on_dpi_changed ( const wxRect &  suggested_rect)
inlineoverrideprotectedvirtual

Implements Slic3r::GUI::DPIAware< P >.

190{ msw_rescale(); }
void msw_rescale()
Definition Search.cpp:731

References msw_rescale().

+ Here is the call graph for this function:

◆ on_sys_color_changed()

void Slic3r::Search::SearchDialog::on_sys_color_changed ( )
overridevirtual

Reimplemented from Slic3r::GUI::DPIAware< P >.

748{
749#ifdef _WIN32
750 GUI::wxGetApp().UpdateAllStaticTextDarkUI(this);
751 GUI::wxGetApp().UpdateDarkUI(static_cast<wxButton*>(this->FindWindowById(wxID_CANCEL, this)), true);
752 for (wxWindow* win : std::vector<wxWindow*> {search_line, search_list, check_category, check_english})
753 if (win) GUI::wxGetApp().UpdateDarkUI(win);
754#endif
755
756 // msw_rescale updates just icons, so use it
758
759 Refresh();
760}
void sys_color_changed()
Definition Search.cpp:790
STL namespace.

References check_category, check_english, search_line, search_list, search_list_model, and Slic3r::Search::SearchListModel::sys_color_changed().

Referenced by Slic3r::Search::OptionsSearcher::dlg_sys_color_changed().

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

◆ OnActivate()

void Slic3r::Search::SearchDialog::OnActivate ( wxDataViewEvent &  event)
private
661{
662 ProcessSelection(event.GetItem());
663}
void ProcessSelection(wxDataViewItem selection)
Definition Search.cpp:593

References ProcessSelection().

Referenced by SearchDialog().

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

◆ OnCheck()

void Slic3r::Search::SearchDialog::OnCheck ( wxCommandEvent &  event)
private
702{
703 OptionViewParameters& params = searcher->view_params;
704 if (check_english)
705 params.english = check_english->GetValue();
706 params.category = check_category->GetValue();
707
708 searcher->search();
709 update_list();
710}
OptionViewParameters view_params
Definition Search.hpp:107
bool search()
Definition Search.cpp:175
void update_list()
Definition Search.cpp:684
bool english
Definition Search.hpp:76

References Slic3r::Search::OptionViewParameters::category, check_category, check_english, Slic3r::Search::OptionViewParameters::english, Slic3r::Search::OptionsSearcher::search(), searcher, update_list(), and Slic3r::Search::OptionsSearcher::view_params.

Referenced by SearchDialog().

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

◆ OnInputText()

void Slic3r::Search::SearchDialog::OnInputText ( wxCommandEvent &  event)
private
610{
611 wxString input_string = search_line->GetValue();
612 if (input_string == default_string)
613 input_string.Clear();
614
615 searcher->search(into_u8(input_string));
616
617 update_list();
618}
std::string into_u8(const wxString &str)
Definition GUI.cpp:442

References default_string, Slic3r::Search::OptionsSearcher::search(), search_line, searcher, and update_list().

Referenced by SearchDialog().

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

◆ OnKeyDown()

void Slic3r::Search::SearchDialog::OnKeyDown ( wxKeyEvent &  event)
private
629{
630 int key = event.GetKeyCode();
631
632 // change selected item in the list
633 if (key == WXK_UP || key == WXK_DOWN)
634 {
635 // So, for the next correct navigation, set focus on the search_list
636 search_list->SetFocus();
637
638 auto item = search_list->GetSelection();
639
640 if (item.IsOk()) {
641 unsigned selection = search_list_model->GetRow(item);
642
643 if (key == WXK_UP && selection > 0)
644 selection--;
645 if (key == WXK_DOWN && selection < unsigned(search_list_model->GetCount() - 1))
646 selection++;
647
648 prevent_list_events = true;
649 search_list->Select(search_list_model->GetItem(selection));
650 prevent_list_events = false;
651 }
652 }
653 // process "Enter" pressed
654 else if (key == WXK_NUMPAD_ENTER || key == WXK_RETURN)
655 ProcessSelection(search_list->GetSelection());
656 else
657 event.Skip(); // !Needed to have EVT_CHAR generated as well
658}
bool prevent_list_events
Definition Search.hpp:156

References prevent_list_events, ProcessSelection(), search_list, and search_list_model.

Referenced by SearchDialog().

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

◆ OnLeftDown()

void Slic3r::Search::SearchDialog::OnLeftDown ( wxMouseEvent &  event)
private
727{
728 ProcessSelection(search_list->GetSelection());
729}

References ProcessSelection(), and search_list.

Referenced by SearchDialog().

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

◆ OnLeftUpInTextCtrl()

void Slic3r::Search::SearchDialog::OnLeftUpInTextCtrl ( wxEvent &  event)
private
621{
622 if (search_line->GetValue() == default_string)
623 search_line->SetValue("");
624
625 event.Skip();
626}

References default_string, and search_line.

Referenced by SearchDialog().

+ Here is the caller graph for this function:

◆ OnMotion()

void Slic3r::Search::SearchDialog::OnMotion ( wxMouseEvent &  event)
private
713{
714 wxDataViewItem item;
715 wxDataViewColumn* col;
716 wxWindow* win = this;
717#ifdef __WXMSW__
718 win = search_list;
719#endif
720 search_list->HitTest(wxGetMousePosition() - win->GetScreenPosition(), item, col);
721 search_list->Select(item);
722
723 event.Skip();
724}
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col().
Definition BlockMethods.h:838

References col(), and search_list.

Referenced by SearchDialog().

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

◆ OnSelect()

void Slic3r::Search::SearchDialog::OnSelect ( wxDataViewEvent &  event)
private
666{
667 // To avoid selection update from Select() under osx
669 return;
670
671 // Under OSX mouse and key states didn't fill after wxEVT_DATAVIEW_SELECTION_CHANGED call
672 // As a result, we can't to identify what kind of actions was done
673 // So, under OSX is used OnKeyDown function to navigate inside the list
674#ifndef __APPLE__
675 // wxEVT_DATAVIEW_SELECTION_CHANGED is processed, when selection is changed after mouse click or press the Up/Down arrows
676 // But this two cases should be processed in different way:
677 // Up/Down arrows -> leave it as it is (just a navigation)
678 // LeftMouseClick -> call the ProcessSelection function
679 if (wxGetMouseState().LeftIsDown())
680#endif //__APPLE__
681 ProcessSelection(search_list->GetSelection());
682}

References prevent_list_events, ProcessSelection(), and search_list.

Referenced by SearchDialog().

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

◆ Popup()

void Slic3r::Search::SearchDialog::Popup ( wxPoint  position = wxDefaultPosition)
575{
576 const std::string& line = searcher->search_string();
577 search_line->SetValue(line.empty() ? default_string : from_u8(line));
578 search_line->SetFocus();
579 search_line->SelectAll();
580
581 update_list();
582
583 const OptionViewParameters& params = searcher->view_params;
584 check_category->SetValue(params.category);
585 if (check_english)
586 check_english->SetValue(params.english);
587
588 if (position != wxDefaultPosition)
589 this->SetPosition(position);
590 this->ShowModal();
591}
std::string & search_string()
Definition Search.hpp:133
wxString from_u8(const std::string &str)
Definition GUI.cpp:437

References Slic3r::Search::OptionViewParameters::category, check_category, check_english, default_string, Slic3r::Search::OptionViewParameters::english, search_line, Slic3r::Search::OptionsSearcher::search_string(), searcher, update_list(), and Slic3r::Search::OptionsSearcher::view_params.

Referenced by Slic3r::Search::OptionsSearcher::show_dialog().

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

◆ prev_scale_factor()

template<class P >
float Slic3r::GUI::DPIAware< P >::prev_scale_factor ( ) const
inlineinherited

◆ ProcessSelection()

void Slic3r::Search::SearchDialog::ProcessSelection ( wxDataViewItem  selection)
594{
595 if (!selection.IsOk())
596 return;
597 this->EndModal(wxID_CLOSE);
598
599 // If call GUI::wxGetApp().sidebar.jump_to_option() directly from here,
600 // then mainframe will not have focus and found option will not be "active" (have cursor) as a result
601 // SearchDialog have to be closed and have to lose a focus
602 // and only after that jump_to_option() function can be called
603 // So, post event to plater:
604 wxCommandEvent event(wxCUSTOMEVT_JUMP_TO_OPTION);
605 event.SetInt(search_list_model->GetRow(selection));
606 wxPostEvent(GUI::wxGetApp().plater(), event);
607}

References search_list_model.

Referenced by OnActivate(), OnKeyDown(), OnLeftDown(), and OnSelect().

+ Here is the caller graph for this function:

◆ rescale()

template<class P >
void Slic3r::GUI::DPIAware< P >::rescale ( const wxRect &  suggested_rect)
inlineprivateinherited
238 {
239 this->Freeze();
240
241 m_force_rescale = false;
242#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
243 // rescale fonts of all controls
245 // rescale current window font
247#endif // wxVERSION_EQUAL_OR_GREATER_THAN
248
249 // set normal application font as a current window font
250 m_normal_font = this->GetFont();
251
252 // update em_unit value for new window font
253 m_em_unit = std::max<int>(10, 10.0f * m_scale_factor);
254
255 // rescale missed controls sizes and images
256 on_dpi_changed(suggested_rect);
257
258 this->Layout();
259 this->Thaw();
260
261 // reset previous scale factor from current scale factor value
263 }
virtual void on_dpi_changed(const wxRect &suggested_rect)=0
void scale_controls_fonts(wxWindow *window, const int font_point_size)
Definition GUI_Utils.hpp:225
void scale_win_font(wxWindow *window, const int font_point_size)
Definition GUI_Utils.hpp:217
int m_new_font_point_size
Definition GUI_Utils.hpp:203
IMGUI_API ImFont * GetFont()
Definition imgui.cpp:6932

References Slic3r::GUI::DPIAware< P >::m_em_unit, Slic3r::GUI::DPIAware< P >::m_force_rescale, Slic3r::GUI::DPIAware< P >::m_new_font_point_size, Slic3r::GUI::DPIAware< P >::m_normal_font, Slic3r::GUI::DPIAware< P >::m_prev_scale_factor, Slic3r::GUI::DPIAware< P >::m_scale_factor, Slic3r::GUI::DPIAware< P >::on_dpi_changed(), Slic3r::GUI::DPIAware< P >::scale_controls_fonts(), and Slic3r::GUI::DPIAware< P >::scale_win_font().

Referenced by Slic3r::GUI::DPIAware< P >::DPIAware(), and Slic3r::GUI::DiffPresetDialog::on_dpi_changed().

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

◆ scale_controls_fonts()

template<class P >
void Slic3r::GUI::DPIAware< P >::scale_controls_fonts ( wxWindow *  window,
const int  font_point_size 
)
inlineprivateinherited
226 {
227 auto children = window->GetChildren();
228
229 for (auto child : children) {
230 scale_controls_fonts(child, font_point_size);
231 scale_win_font(child, font_point_size);
232 }
233
234 window->Layout();
235 }

References Slic3r::GUI::DPIAware< P >::scale_controls_fonts(), and Slic3r::GUI::DPIAware< P >::scale_win_font().

Referenced by Slic3r::GUI::DPIAware< P >::rescale(), and Slic3r::GUI::DPIAware< P >::scale_controls_fonts().

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

◆ scale_factor()

template<class P >
float Slic3r::GUI::DPIAware< P >::scale_factor ( ) const
inlineinherited

◆ scale_win_font()

template<class P >
void Slic3r::GUI::DPIAware< P >::scale_win_font ( wxWindow *  window,
const int  font_point_size 
)
inlineprivateinherited
218 {
219 wxFont new_font(window->GetFont());
220 new_font.SetPointSize(font_point_size);
221 window->SetFont(new_font);
222 }

Referenced by Slic3r::GUI::DPIAware< P >::rescale(), and Slic3r::GUI::DPIAware< P >::scale_controls_fonts().

+ Here is the caller graph for this function:

◆ update_list()

void Slic3r::Search::SearchDialog::update_list ( )
private
685{
686 // Under OSX model->Clear invoke wxEVT_DATAVIEW_SELECTION_CHANGED, so
687 // set prevent_list_events to true already here
688 prevent_list_events = true;
690
691 const std::vector<FoundOption>& filters = searcher->found_options();
692 for (const FoundOption& item : filters)
693 search_list_model->Prepend(item.label);
694
695 // select first item, if search_list
696 if (search_list_model->GetCount() > 0)
697 search_list->Select(search_list_model->GetItem(0));
698 prevent_list_events = false;
699}
const std::vector< FoundOption > & found_options()
Definition Search.hpp:131
void Clear()
Definition Search.cpp:773

References Slic3r::Search::SearchListModel::Clear(), Slic3r::Search::OptionsSearcher::found_options(), Slic3r::Search::SearchListModel::Prepend(), prevent_list_events, search_list, search_list_model, and searcher.

Referenced by OnCheck(), OnInputText(), and Popup().

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

Member Data Documentation

◆ check_category

wxCheckBox* Slic3r::Search::SearchDialog::check_category { nullptr }
private

◆ check_english

wxCheckBox* Slic3r::Search::SearchDialog::check_english { nullptr }
private

◆ default_string

wxString Slic3r::Search::SearchDialog::default_string
private

◆ m_can_rescale

template<class P >
bool Slic3r::GUI::DPIAware< P >::m_can_rescale { true }
privateinherited

◆ m_em_unit

◆ m_force_rescale

template<class P >
bool Slic3r::GUI::DPIAware< P >::m_force_rescale { false }
privateinherited

◆ m_new_font_point_size

template<class P >
int Slic3r::GUI::DPIAware< P >::m_new_font_point_size
privateinherited

◆ m_normal_font

◆ m_prev_scale_factor

◆ m_scale_factor

◆ prevent_list_events

bool Slic3r::Search::SearchDialog::prevent_list_events {false}
private

Referenced by OnKeyDown(), OnSelect(), and update_list().

◆ search_line

wxTextCtrl* Slic3r::Search::SearchDialog::search_line { nullptr }
private

◆ search_list

wxDataViewCtrl* Slic3r::Search::SearchDialog::search_list { nullptr }
private

◆ search_list_model

SearchListModel* Slic3r::Search::SearchDialog::search_list_model { nullptr }
private

◆ search_str

wxString Slic3r::Search::SearchDialog::search_str
private

◆ searcher

OptionsSearcher* Slic3r::Search::SearchDialog::searcher { nullptr }
private

The documentation for this class was generated from the following files: