Fixed GTK build

This commit is contained in:
YuSanka 2020-08-11 09:17:52 +02:00
parent 058e024d2d
commit 6a33c967cf

View File

@ -499,30 +499,35 @@ UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, const std::string&
m_tree->AppendToggleColumn(L"\u2714", UnsavedChangesModel::colToggle, wxDATAVIEW_CELL_ACTIVATABLE, 6 * em);//2610,11,12 //2714 m_tree->AppendToggleColumn(L"\u2714", UnsavedChangesModel::colToggle, wxDATAVIEW_CELL_ACTIVATABLE, 6 * em);//2610,11,12 //2714
auto append_bmp_text_column = [this](const wxString& label, unsigned model_column, int width, bool set_expander = false)
{
#ifdef __linux__ #ifdef __linux__
wxDataViewIconTextRenderer* rd = new wxDataViewIconTextRenderer(); wxDataViewIconTextRenderer* rd = new wxDataViewIconTextRenderer();
#ifdef SUPPORTS_MARKUP #ifdef SUPPORTS_MARKUP
rd->EnableMarkup(true); rd->EnableMarkup(true);
#endif #endif
wxDataViewColumn* icon_text_clmn = new wxDataViewColumn("", rd, UnsavedChangesModel::colIconText, 30 * em, wxALIGN_TOP, wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_CELL_INERT); wxDataViewColumn* column = new wxDataViewColumn(label, rd, model_column, width, wxALIGN_TOP, wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_CELL_INERT);
#else #else
wxDataViewColumn* icon_text_clmn = new wxDataViewColumn("", new BitmapTextRenderer(true), UnsavedChangesModel::colIconText, 30 * em, wxALIGN_TOP, wxDATAVIEW_COL_RESIZABLE); wxDataViewColumn* column = new wxDataViewColumn(label, new BitmapTextRenderer(true), model_column, width, wxALIGN_TOP, wxDATAVIEW_COL_RESIZABLE);
#endif //__linux__ #endif //__linux__
m_tree->AppendColumn(icon_text_clmn); m_tree->AppendColumn(column);
m_tree->AppendColumn(new wxDataViewColumn("Old value", new BitmapTextRenderer(true), UnsavedChangesModel::colOldValue, 20 * em, wxALIGN_TOP)); if (set_expander)
m_tree->AppendColumn(new wxDataViewColumn("New value", new BitmapTextRenderer(true), UnsavedChangesModel::colNewValue, 20 * em, wxALIGN_TOP)); m_tree->SetExpanderColumn(column);
};
// m_tree->SetExpanderColumn(icon_text_clmn); append_bmp_text_column("", UnsavedChangesModel::colIconText, 30 * em);
append_bmp_text_column(_L("Old Value"), UnsavedChangesModel::colOldValue, 20 * em);
append_bmp_text_column(_L("New Value"), UnsavedChangesModel::colNewValue, 20 * em);
m_tree->Bind(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, &UnsavedChangesDialog::item_value_changed, this); m_tree->Bind(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, &UnsavedChangesDialog::item_value_changed, this);
m_tree->Bind(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, &UnsavedChangesDialog::context_menu, this); m_tree->Bind(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, &UnsavedChangesDialog::context_menu, this);
m_tree->Bind(wxEVT_MOTION, [this](wxMouseEvent& e) { show_info_line(Action::Undef); e.Skip(); }); m_tree->Bind(wxEVT_MOTION, [this](wxMouseEvent& e) { show_info_line(Action::Undef); e.Skip(); });
// Add Buttons
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCANCEL); wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCANCEL);
Tab* tab = wxGetApp().get_tab(type); Tab* tab = wxGetApp().get_tab(type);
assert(tab); assert(tab);
PresetCollection* presets = tab->get_presets(); PresetCollection* presets = tab->get_presets();
wxString label= from_u8((boost::format(_u8L("Save selected to preset: %1%"))% ("\"" + presets->get_selected_preset().name + "\"")).str()); wxString label= from_u8((boost::format(_u8L("Save selected to preset: %1%"))% ("\"" + presets->get_selected_preset().name + "\"")).str());
@ -549,7 +554,6 @@ UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, const std::string&
m_info_line = new wxStaticText(this, wxID_ANY, ""); m_info_line = new wxStaticText(this, wxID_ANY, "");
m_info_line->SetFont(wxGetApp().bold_font()); m_info_line->SetFont(wxGetApp().bold_font());
m_info_line->Hide();
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
@ -564,6 +568,8 @@ UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, const std::string&
SetSizer(topSizer); SetSizer(topSizer);
topSizer->SetSizeHints(this); topSizer->SetSizeHints(this);
show_info_line(Action::Undef);
} }
void UnsavedChangesDialog::item_value_changed(wxDataViewEvent& event) void UnsavedChangesDialog::item_value_changed(wxDataViewEvent& event)