Change reset buttons tooltips according to its state

This commit is contained in:
YuSanka 2018-04-24 12:12:15 +02:00
parent 1e8d302fd4
commit 92b67fb62e
3 changed files with 46 additions and 19 deletions

View File

@ -149,7 +149,8 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** colored_Label/*
// If there's a widget, build it and add the result to the sizer. // If there's a widget, build it and add the result to the sizer.
if (line.widget != nullptr) { if (line.widget != nullptr) {
auto wgt = line.widget(parent()); auto wgt = line.widget(parent());
grid_sizer->Add(wgt, 0, wxEXPAND | wxBOTTOM | wxTOP, wxOSX ? 0 : 5); // If widget doesn't have label, don't use border
grid_sizer->Add(wgt, 0, wxEXPAND | wxBOTTOM | wxTOP, (wxOSX || line.label.IsEmpty()) ? 0 : 5);
if (colored_Label != nullptr) *colored_Label = label; if (colored_Label != nullptr) *colored_Label = label;
return; return;
} }

View File

@ -104,27 +104,41 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
m_undo_btn = new wxButton(panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); m_undo_btn = new wxButton(panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
m_undo_to_sys_btn = new wxButton(panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); m_undo_to_sys_btn = new wxButton(panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
m_question_btn = new wxButton(panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); m_question_btn = new wxButton(panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
// m_undo_btns_legent = new wxStaticText(panel, wxID_ANY, _(L("For more information about buttons hover the mouse cursor over them.")), wxDefaultPosition, wxDefaultSize);
if (wxMSW) { if (wxMSW) {
m_undo_btn->SetBackgroundColour(color); m_undo_btn->SetBackgroundColour(color);
m_undo_to_sys_btn->SetBackgroundColour(color); m_undo_to_sys_btn->SetBackgroundColour(color);
m_question_btn->SetBackgroundColour(color); m_question_btn->SetBackgroundColour(color);
} }
m_undo_to_sys_btn->SetToolTip(_(L( "LOCKED LOCK icon indicates that the settings are the same as the system values " // m_undo_to_sys_btn->SetToolTip(_(L( "LOCKED LOCK icon indicates that the settings are the same as the system values "
"for the current option group.\n" // "for the current option group.\n"
"UNLOCKED LOCK icon indicates that some settings were changed and are not equal " // "UNLOCKED LOCK icon indicates that some settings were changed and are not equal "
"to the system values for the current option group.\n" // "to the system values for the current option group.\n"
"WHITE BULLET icon indicates a nonsystem preset.\n\n" // "WHITE BULLET icon indicates a non system preset.\n\n"
"Click the UNLOCKED LOCK icon to reset all settings for current option group to " // "Click the UNLOCKED LOCK icon to reset all settings for current option group to "
"the system values."))); // "the system values.")));
//
// m_undo_btn->SetToolTip(_(L( "WHITE BULLET icon indicates that the settings are the same as in the last saved"
// "preset for the current option group.\n"
// "BACK ARROW icon indicates that the settings were changed and are not equal to "
// "the last saved preset for the current option group.\n\n"
// "Click the BACK ARROW icon to reset all settings for the current option group to "
// "the last saved preset.")));
m_undo_btn->SetToolTip(_(L( "WHITE BULLET icon indicates that the settings are the same as in the last saved" // Text to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
"preset for the current option group.\n" m_tt_value_lock = _(L("LOCKED LOCK icon indicates that the settings are the same as the system values "
"BACK ARROW icon indicates that the settings were changed and are not equal to " "for the current option group"));
"the last saved preset for the current option group.\n\n" m_tt_value_unlock = _(L("UNLOCKED LOCK icon indicates that some settings were changed and are not equal "
"Click the BACK ARROW icon to reset all settings for the current option group to " "to the system values for the current option group.\n"
"the last saved preset."))); "Click it to reset all settings for current option group to the system values."));
m_tt_white_bullet_ns= _(L("WHITE BULLET icon indicates a non system preset."));
m_tt_non_system = &m_tt_white_bullet_ns;
// Bitmaps to be shown on the "Undo user changes" button next to each input field.
m_tt_white_bullet = _(L("WHITE BULLET icon indicates that the settings are the same as in the last saved "
"preset for the current option group."));
m_tt_value_revert = _(L("BACK ARROW icon indicates that the settings were changed and are not equal to "
"the last saved preset for the current option group.\n"
"Click it to reset all settings for the current option group to the last saved preset."));
m_question_btn->SetToolTip(_(L("Hover the cursor over buttons to find more information."))); m_question_btn->SetToolTip(_(L("Hover the cursor over buttons to find more information.")));
@ -171,8 +185,6 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
m_hsizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL); m_hsizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->AddSpacer(32); m_hsizer->AddSpacer(32);
m_hsizer->Add(m_question_btn, 0, wxALIGN_CENTER_VERTICAL); m_hsizer->Add(m_question_btn, 0, wxALIGN_CENTER_VERTICAL);
// m_hsizer->Add(m_undo_btns_legent, 0, wxALIGN_CENTER_VERTICAL);
// m_hsizer->AddSpacer(64);
// m_hsizer->Add(m_cc_presets_choice, 1, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3); // m_hsizer->Add(m_cc_presets_choice, 1, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
//Horizontal sizer to hold the tree and the selected page. //Horizontal sizer to hold the tree and the selected page.
@ -265,6 +277,7 @@ void Tab::load_initial_data()
{ {
m_config = &m_presets->get_edited_preset().config; m_config = &m_presets->get_edited_preset().config;
m_bmp_non_system = m_presets->get_selected_preset_parent() ? &m_bmp_value_unlock : &m_bmp_white_bullet; m_bmp_non_system = m_presets->get_selected_preset_parent() ? &m_bmp_value_unlock : &m_bmp_white_bullet;
m_tt_non_system = m_presets->get_selected_preset_parent() ? &m_tt_value_unlock : &m_tt_white_bullet_ns;
} }
PageShp Tab::add_options_page(const wxString& title, const std::string& icon, bool is_extruder_pages/* = false*/) PageShp Tab::add_options_page(const wxString& title, const std::string& icon, bool is_extruder_pages/* = false*/)
@ -468,6 +481,9 @@ void Tab::update_undo_buttons()
{ {
m_undo_btn->SetBitmap(m_is_modified_values ? m_bmp_value_revert : m_bmp_white_bullet); m_undo_btn->SetBitmap(m_is_modified_values ? m_bmp_value_revert : m_bmp_white_bullet);
m_undo_to_sys_btn->SetBitmap(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock); m_undo_to_sys_btn->SetBitmap(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock);
m_undo_btn->SetToolTip(m_is_modified_values ? m_tt_value_revert : m_tt_white_bullet);
m_undo_to_sys_btn->SetToolTip(m_is_nonsys_values ? *m_tt_non_system : m_tt_value_lock);
} }
void Tab::on_roll_back_value(const bool to_sys /*= true*/) void Tab::on_roll_back_value(const bool to_sys /*= true*/)
@ -1810,6 +1826,7 @@ void Tab::load_current_preset()
// Reload preset pages with the new configuration values. // Reload preset pages with the new configuration values.
reload_config(); reload_config();
m_bmp_non_system = m_presets->get_selected_preset_parent() ? &m_bmp_value_unlock : &m_bmp_white_bullet; m_bmp_non_system = m_presets->get_selected_preset_parent() ? &m_bmp_value_unlock : &m_bmp_white_bullet;
m_tt_non_system = m_presets->get_selected_preset_parent() ? &m_tt_value_unlock : &m_tt_white_bullet_ns;
// use CallAfter because some field triggers schedule on_change calls using CallAfter, // use CallAfter because some field triggers schedule on_change calls using CallAfter,
// and we don't want them to be called after this update_dirty() as they would mark the // and we don't want them to be called after this update_dirty() as they would mark the

View File

@ -118,7 +118,6 @@ protected:
wxButton* m_undo_btn; wxButton* m_undo_btn;
wxButton* m_undo_to_sys_btn; wxButton* m_undo_to_sys_btn;
wxButton* m_question_btn; wxButton* m_question_btn;
// wxStaticText* m_undo_btns_legent;
wxComboCtrl* m_cc_presets_choice; wxComboCtrl* m_cc_presets_choice;
wxDataViewTreeCtrl* m_presetctrl; wxDataViewTreeCtrl* m_presetctrl;
@ -136,7 +135,7 @@ protected:
wxBitmap *m_bmp_non_system; wxBitmap *m_bmp_non_system;
// Bitmaps to be shown on the "Undo user changes" button next to each input field. // Bitmaps to be shown on the "Undo user changes" button next to each input field.
wxBitmap m_bmp_value_revert; wxBitmap m_bmp_value_revert;
wxBitmap m_bmp_value_unmodified; // wxBitmap m_bmp_value_unmodified;
wxBitmap m_bmp_question; wxBitmap m_bmp_question;
// Colors for ui "decoration" // Colors for ui "decoration"
@ -144,6 +143,16 @@ protected:
wxColour m_modified_label_clr; wxColour m_modified_label_clr;
wxColour m_default_text_clr; wxColour m_default_text_clr;
// Text for reset buttons tooltips
wxString m_tt_value_lock;
wxString m_tt_value_unlock;
wxString m_tt_white_bullet_ns;
// The following text points to either m_bmp_value_unlock or m_bmp_white_bullet, depending on whether the current preset has a parent preset.
wxString *m_tt_non_system;
// Bitmaps to be shown on the "Undo user changes" button next to each input field.
wxString m_tt_white_bullet;
wxString m_tt_value_revert;
int m_icon_count; int m_icon_count;
std::map<std::string, size_t> m_icon_index; // Map from an icon file name to its index std::map<std::string, size_t> m_icon_index; // Map from an icon file name to its index
std::vector<PageShp> m_pages; std::vector<PageShp> m_pages;