mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 02:25:53 +08:00
Fix for https://dev.prusa3d.com/browse/SPE-1490 - DarkMode, MSW specific: Selected item in SearchDialog is black
This commit is contained in:
parent
0202eec4b7
commit
250463c6e9
@ -16,6 +16,7 @@
|
|||||||
#include "Tab.hpp"
|
#include "Tab.hpp"
|
||||||
|
|
||||||
#define FTS_FUZZY_MATCH_IMPLEMENTATION
|
#define FTS_FUZZY_MATCH_IMPLEMENTATION
|
||||||
|
#include "ExtraRenderers.hpp"
|
||||||
#include "fts_fuzzy_match.h"
|
#include "fts_fuzzy_match.h"
|
||||||
|
|
||||||
#include "imgui/imconfig.h"
|
#include "imgui/imconfig.h"
|
||||||
@ -500,6 +501,10 @@ SearchDialog::SearchDialog(OptionsSearcher* searcher)
|
|||||||
search_list_model = new SearchListModel(this);
|
search_list_model = new SearchListModel(this);
|
||||||
search_list->AssociateModel(search_list_model);
|
search_list->AssociateModel(search_list_model);
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
search_list->AppendColumn(new wxDataViewColumn("", new BitmapTextRenderer(true, wxDATAVIEW_CELL_INERT), SearchListModel::colIconMarkedText, wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT));
|
||||||
|
search_list->GetColumn(SearchListModel::colIconMarkedText)->SetWidth(48 * em_unit());
|
||||||
|
#else
|
||||||
search_list->AppendBitmapColumn("", SearchListModel::colIcon);
|
search_list->AppendBitmapColumn("", SearchListModel::colIcon);
|
||||||
|
|
||||||
wxDataViewTextRenderer* const markupRenderer = new wxDataViewTextRenderer();
|
wxDataViewTextRenderer* const markupRenderer = new wxDataViewTextRenderer();
|
||||||
@ -512,6 +517,7 @@ SearchDialog::SearchDialog(OptionsSearcher* searcher)
|
|||||||
|
|
||||||
search_list->GetColumn(SearchListModel::colIcon )->SetWidth(3 * em_unit());
|
search_list->GetColumn(SearchListModel::colIcon )->SetWidth(3 * em_unit());
|
||||||
search_list->GetColumn(SearchListModel::colMarkedText)->SetWidth(40 * em_unit());
|
search_list->GetColumn(SearchListModel::colMarkedText)->SetWidth(40 * em_unit());
|
||||||
|
#endif
|
||||||
|
|
||||||
wxBoxSizer* check_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* check_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
@ -725,10 +731,12 @@ void SearchDialog::OnLeftDown(wxMouseEvent& event)
|
|||||||
void SearchDialog::msw_rescale()
|
void SearchDialog::msw_rescale()
|
||||||
{
|
{
|
||||||
const int& em = em_unit();
|
const int& em = em_unit();
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
search_list->GetColumn(SearchListModel::colIconMarkedText)->SetWidth(48 * em);
|
||||||
|
#else
|
||||||
search_list->GetColumn(SearchListModel::colIcon )->SetWidth(3 * em);
|
search_list->GetColumn(SearchListModel::colIcon )->SetWidth(3 * em);
|
||||||
search_list->GetColumn(SearchListModel::colMarkedText)->SetWidth(45 * em);
|
search_list->GetColumn(SearchListModel::colMarkedText)->SetWidth(45 * em);
|
||||||
|
#endif
|
||||||
const wxSize& size = wxSize(40 * em, 30 * em);
|
const wxSize& size = wxSize(40 * em, 30 * em);
|
||||||
SetMinSize(size);
|
SetMinSize(size);
|
||||||
|
|
||||||
@ -787,8 +795,13 @@ void SearchListModel::sys_color_changed()
|
|||||||
|
|
||||||
wxString SearchListModel::GetColumnType(unsigned int col) const
|
wxString SearchListModel::GetColumnType(unsigned int col) const
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
if (col == colIconMarkedText)
|
||||||
|
return "DataViewBitmapText";
|
||||||
|
#else
|
||||||
if (col == colIcon)
|
if (col == colIcon)
|
||||||
return "wxBitmap";
|
return "wxBitmap";
|
||||||
|
#endif
|
||||||
return "string";
|
return "string";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,12 +810,20 @@ void SearchListModel::GetValueByRow(wxVariant& variant,
|
|||||||
{
|
{
|
||||||
switch (col)
|
switch (col)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
case colIconMarkedText: {
|
||||||
|
const ScalableBitmap& icon = m_icon[m_values[row].second];
|
||||||
|
variant << DataViewBitmapText(m_values[row].first, icon.bmp().GetBitmapFor(icon.parent()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
case colIcon:
|
case colIcon:
|
||||||
variant << m_icon[m_values[row].second].bmp().GetBitmapFor(m_icon[m_values[row].second].parent());
|
variant << m_icon[m_values[row].second].bmp().GetBitmapFor(m_icon[m_values[row].second].parent());
|
||||||
break;
|
break;
|
||||||
case colMarkedText:
|
case colMarkedText:
|
||||||
variant = m_values[row].first;
|
variant = m_values[row].first;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case colMax:
|
case colMax:
|
||||||
wxFAIL_MSG("invalid column");
|
wxFAIL_MSG("invalid column");
|
||||||
default:
|
default:
|
||||||
|
@ -202,8 +202,12 @@ class SearchListModel : public wxDataViewVirtualListModel
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
colIconMarkedText,
|
||||||
|
#else
|
||||||
colIcon,
|
colIcon,
|
||||||
colMarkedText,
|
colMarkedText,
|
||||||
|
#endif
|
||||||
colMax
|
colMax
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user