This commit is contained in:
bubnikv 2019-01-29 18:08:02 +01:00
commit 7bfc60e805
6 changed files with 39 additions and 10 deletions

View file

@ -115,7 +115,7 @@ public:
/// subclasses should overload with a specific version
/// Postcondition: Method does not fire the on_change event.
virtual void set_value(const boost::any& value, bool change_event) = 0;
/// Gets a boost::any representing this control.
/// subclasses should overload with a specific version
virtual boost::any& get_value() = 0;
@ -128,6 +128,8 @@ public:
virtual wxString get_tooltip_text(const wxString& default_string);
void field_changed() { on_change_field(); }
// set icon to "UndoToSystemValue" button according to an inheritance of preset
// void set_nonsys_btn_icon(const wxBitmap& icon);

View file

@ -3250,6 +3250,7 @@ bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection)
if (!m_enabled || selection.is_empty())
return false;
EType old_current = m_current;
bool handled = false;
for (GizmosMap::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
{
@ -3273,7 +3274,12 @@ bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection)
handled = true;
}
}
else
}
if (handled && (old_current != Undefined) && (old_current != m_current))
{
GizmosMap::const_iterator it = m_gizmos.find(old_current);
if (it != m_gizmos.end())
it->second->set_state(GLGizmoBase::Off);
}

View file

@ -1589,11 +1589,11 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(btn);
btn->Bind(wxEVT_BUTTON, [this, parent, optgroup](wxCommandEvent e) {
btn->Bind(wxEVT_BUTTON, [this, parent, optgroup](wxCommandEvent &e) {
BonjourDialog dialog(parent);
if (dialog.show_and_lookup()) {
optgroup->set_value("print_host", std::move(dialog.get_selected()), true);
// FIXME: emit killfocus on the edit widget
optgroup->get_field("print_host")->field_changed();
}
});
@ -1607,7 +1607,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(btn);
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) {
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
std::unique_ptr<PrintHost> host(PrintHost::get_print_host(m_config));
if (! host) {
const auto text = wxString::Format("%s",
@ -1648,6 +1648,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
wxFileDialog openFileDialog(this, _(L("Open CA certificate file")), "", "", filemasks, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() != wxID_CANCEL) {
optgroup->set_value("printhost_cafile", std::move(openFileDialog.GetPath()), true);
optgroup->get_field("printhost_cafile")->field_changed();
}
});