diff options
Diffstat (limited to 'scene/gui/color_picker.cpp')
-rw-r--r-- | scene/gui/color_picker.cpp | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index cdb091cb32..ee2122f269 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -54,6 +54,22 @@ void ColorPicker::_notification(int p_what) { _update_color(); } break; + case NOTIFICATION_TRANSLATION_CHANGED: { + List<BaseButton *> buttons; + preset_group->get_buttons(&buttons); + for (List<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) { + Color preset_color = ((ColorPresetButton *)E->get())->get_preset_color(); + E->get()->set_tooltip_text(vformat(atr(ETR("Color: #%s\nLMB: Apply color\nRMB: Remove preset")), preset_color.to_html(preset_color.a < 1))); + } + + buttons.clear(); + recent_preset_group->get_buttons(&buttons); + for (List<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) { + Color preset_color = ((ColorPresetButton *)E->get())->get_preset_color(); + E->get()->set_tooltip_text(vformat(atr(ETR("Color: #%s\nLMB: Apply color")), preset_color.to_html(preset_color.a < 1))); + } + } break; + case NOTIFICATION_THEME_CHANGED: { btn_pick->set_icon(theme_cache.screen_picker); _update_drop_down_arrow(btn_preset->is_pressed(), btn_preset); @@ -689,7 +705,7 @@ void ColorPicker::_text_type_toggled() { text_type->set_icon(nullptr); c_text->set_editable(true); - c_text->set_tooltip_text(RTR("Enter a hex code (\"#ff0000\") or named color (\"red\").")); + c_text->set_tooltip_text(ETR("Enter a hex code (\"#ff0000\") or named color (\"red\").")); } _update_color(); } @@ -735,7 +751,7 @@ inline int ColorPicker::_get_preset_size() { void ColorPicker::_add_preset_button(int p_size, const Color &p_color) { ColorPresetButton *btn_preset_new = memnew(ColorPresetButton(p_color, p_size)); - btn_preset_new->set_tooltip_text(vformat(RTR("Color: #%s\nLMB: Apply color\nRMB: Remove preset"), p_color.to_html(p_color.a < 1))); + btn_preset_new->set_tooltip_text(vformat(atr(ETR("Color: #%s\nLMB: Apply color\nRMB: Remove preset")), p_color.to_html(p_color.a < 1))); SET_DRAG_FORWARDING_GCDU(btn_preset_new, ColorPicker); btn_preset_new->set_button_group(preset_group); preset_container->add_child(btn_preset_new); @@ -745,7 +761,7 @@ void ColorPicker::_add_preset_button(int p_size, const Color &p_color) { void ColorPicker::_add_recent_preset_button(int p_size, const Color &p_color) { ColorPresetButton *btn_preset_new = memnew(ColorPresetButton(p_color, p_size)); - btn_preset_new->set_tooltip_text(vformat(RTR("Color: #%s\nLMB: Apply color"), p_color.to_html(p_color.a < 1))); + btn_preset_new->set_tooltip_text(vformat(atr(ETR("Color: #%s\nLMB: Apply color")), p_color.to_html(p_color.a < 1))); btn_preset_new->set_button_group(recent_preset_group); recent_preset_hbc->add_child(btn_preset_new); recent_preset_hbc->move_child(btn_preset_new, 0); @@ -1807,11 +1823,11 @@ ColorPicker::ColorPicker() { btn_pick = memnew(Button); sample_hbc->add_child(btn_pick); if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_SCREEN_CAPTURE)) { - btn_pick->set_tooltip_text(RTR("Pick a color from the screen.")); + btn_pick->set_tooltip_text(ETR("Pick a color from the screen.")); btn_pick->connect(SNAME("pressed"), callable_mp(this, &ColorPicker::_pick_button_pressed)); } else { // On unsupported platforms, use a legacy method for color picking. - btn_pick->set_tooltip_text(RTR("Pick a color from the application window.")); + btn_pick->set_tooltip_text(ETR("Pick a color from the application window.")); btn_pick->connect(SNAME("pressed"), callable_mp(this, &ColorPicker::_pick_button_pressed_legacy)); } @@ -1825,7 +1841,7 @@ ColorPicker::ColorPicker() { btn_shape->set_flat(false); sample_hbc->add_child(btn_shape); btn_shape->set_toggle_mode(true); - btn_shape->set_tooltip_text(RTR("Select a picker shape.")); + btn_shape->set_tooltip_text(ETR("Select a picker shape.")); current_shape = SHAPE_HSV_RECTANGLE; @@ -1864,7 +1880,7 @@ ColorPicker::ColorPicker() { btn_mode->set_flat(false); mode_hbc->add_child(btn_mode); btn_mode->set_toggle_mode(true); - btn_mode->set_tooltip_text(RTR("Select a picker mode.")); + btn_mode->set_tooltip_text(ETR("Select a picker mode.")); current_mode = MODE_RGB; @@ -1918,8 +1934,8 @@ ColorPicker::ColorPicker() { hex_hbc->add_child(c_text); c_text->set_h_size_flags(SIZE_EXPAND_FILL); c_text->set_select_all_on_focus(true); - c_text->set_tooltip_text(RTR("Enter a hex code (\"#ff0000\") or named color (\"red\").")); - c_text->set_placeholder(RTR("Hex code or named color")); + c_text->set_tooltip_text(ETR("Enter a hex code (\"#ff0000\") or named color (\"red\").")); + c_text->set_placeholder(ETR("Hex code or named color")); c_text->connect("text_submitted", callable_mp(this, &ColorPicker::_html_submitted)); c_text->connect("text_changed", callable_mp(this, &ColorPicker::_text_changed)); c_text->connect("focus_exited", callable_mp(this, &ColorPicker::_html_focus_exit)); @@ -1997,7 +2013,7 @@ ColorPicker::ColorPicker() { btn_add_preset = memnew(Button); btn_add_preset->set_icon_alignment(HORIZONTAL_ALIGNMENT_CENTER); - btn_add_preset->set_tooltip_text(RTR("Add current color as a preset.")); + btn_add_preset->set_tooltip_text(ETR("Add current color as a preset.")); btn_add_preset->connect("pressed", callable_mp(this, &ColorPicker::_add_preset_pressed)); preset_container->add_child(btn_add_preset); } |