mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-22 18:32:16 +00:00
Fix object search bar on macOS and Linux (#9473)
* Remove unused search code * Reimplement the object search bar (SoftFever/OrcaSlicer#7438) * Fix result list when search text is empty * Prevent infinite focus loop * Update layout on Linux * Fix focus on macOS --------- Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
@@ -184,25 +184,15 @@ class SearchListModel;
|
||||
class SearchDialog : public PopupWindow
|
||||
{
|
||||
public:
|
||||
wxString search_str;
|
||||
wxString default_string;
|
||||
|
||||
bool prevent_list_events{false};
|
||||
|
||||
wxColour m_text_color;
|
||||
wxColour m_bg_colour;
|
||||
wxColour m_hover_colour;
|
||||
wxColour m_bold_colour;
|
||||
wxColour m_thumb_color;
|
||||
|
||||
wxBoxSizer *m_sizer_body{nullptr};
|
||||
wxBoxSizer *m_sizer_main{nullptr};
|
||||
wxBoxSizer *m_sizer_border{nullptr};
|
||||
wxBoxSizer *m_listsizer{nullptr};
|
||||
|
||||
wxWindow *m_border_panel{nullptr};
|
||||
wxWindow *m_client_panel{nullptr};
|
||||
wxWindow *m_listPanel{nullptr};
|
||||
|
||||
wxWindow *m_event_tag{nullptr};
|
||||
wxWindow *m_search_item_tag{nullptr};
|
||||
@@ -215,23 +205,12 @@ public:
|
||||
wxTextCtrl * search_line2{nullptr};
|
||||
Preset::Type search_type = Preset::TYPE_INVALID;
|
||||
|
||||
wxDataViewCtrl * search_list{nullptr};
|
||||
ScrolledWindow * m_scrolledWindow{nullptr};
|
||||
SearchListModel *search_list_model{nullptr};
|
||||
wxCheckBox * check_category{nullptr};
|
||||
|
||||
OptionsSearcher *searcher{nullptr};
|
||||
|
||||
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();
|
||||
|
||||
@@ -244,12 +223,8 @@ public:
|
||||
void OnDismiss();
|
||||
void Dismiss();
|
||||
void Die();
|
||||
void ProcessSelection(wxDataViewItem selection);
|
||||
void msw_rescale();
|
||||
// void on_sys_color_changed() override;
|
||||
|
||||
protected:
|
||||
// void on_dpi_changed(const wxRect& suggested_rect) override { msw_rescale(); }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -284,11 +259,17 @@ public:
|
||||
class SearchObjectDialog : public PopupWindow
|
||||
{
|
||||
public:
|
||||
SearchObjectDialog(GUI::ObjectList* object_list, wxWindow* parent);
|
||||
SearchObjectDialog(GUI::ObjectList* object_list, wxWindow* parent, TextInput* input);
|
||||
~SearchObjectDialog();
|
||||
|
||||
void MSWDismissUnfocusedPopup();
|
||||
void Popup(wxPoint position = wxDefaultPosition);
|
||||
void OnDismiss();
|
||||
void Dismiss();
|
||||
void Die();
|
||||
|
||||
void OnInputText(wxCommandEvent& event);
|
||||
void OnLeftUpInTextCtrl(wxEvent& event);
|
||||
|
||||
void update_list();
|
||||
|
||||
@@ -299,12 +280,13 @@ public:
|
||||
const int POPUP_WIDTH = 41;
|
||||
const int POPUP_HEIGHT = 45;
|
||||
|
||||
TextInput* search_line{nullptr};
|
||||
wxTextCtrl* search_line2{nullptr};
|
||||
|
||||
ScrolledWindow* m_scrolledWindow{ nullptr };
|
||||
|
||||
wxColour m_text_color;
|
||||
wxColour m_bg_color;
|
||||
wxColour m_thumb_color;
|
||||
wxColour m_bold_color;
|
||||
|
||||
wxBoxSizer* m_sizer_body{ nullptr };
|
||||
wxBoxSizer* m_sizer_main{ nullptr };
|
||||
@@ -312,7 +294,9 @@ public:
|
||||
|
||||
wxWindow* m_border_panel{ nullptr };
|
||||
wxWindow* m_client_panel{ nullptr };
|
||||
wxWindow* m_listPanel{ nullptr };
|
||||
|
||||
private:
|
||||
bool m_is_dismissing{ false };
|
||||
};
|
||||
|
||||
} // namespace Search
|
||||
|
||||
Reference in New Issue
Block a user