Merge pull request #116081 from arkology/goto_line_button
Convert "Line and column numbers" label to button
This commit is contained in:
commit
d155457554
4 changed files with 24 additions and 12 deletions
|
|
@ -95,6 +95,7 @@ void GotoLinePopup::_notification(int p_what) {
|
|||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (!is_visible()) {
|
||||
text_editor->set_preview_navigation_change(false);
|
||||
text_editor->get_text_editor()->grab_focus();
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
|
@ -993,7 +994,7 @@ void CodeTextEditor::_line_col_changed() {
|
|||
sb.append(" : ");
|
||||
sb.append(itos(positional_column + 1).lpad(3));
|
||||
|
||||
line_and_col_txt->set_text(sb.as_string());
|
||||
line_and_col_button->set_text(sb.as_string());
|
||||
|
||||
if (find_replace_bar) {
|
||||
if (!find_replace_bar->line_col_changed_for_result) {
|
||||
|
|
@ -1855,11 +1856,16 @@ float CodeTextEditor::get_zoom_factor() {
|
|||
return zoom_factor;
|
||||
}
|
||||
|
||||
void CodeTextEditor::_show_goto_popup_request() {
|
||||
emit_signal("show_goto_popup");
|
||||
}
|
||||
|
||||
void CodeTextEditor::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("validate_script"));
|
||||
ADD_SIGNAL(MethodInfo("load_theme_settings"));
|
||||
ADD_SIGNAL(MethodInfo("show_errors_panel"));
|
||||
ADD_SIGNAL(MethodInfo("show_warnings_panel"));
|
||||
ADD_SIGNAL(MethodInfo("show_goto_popup"));
|
||||
ADD_SIGNAL(MethodInfo("navigation_preview_ended"));
|
||||
ADD_SIGNAL(MethodInfo("zoomed", PropertyInfo(Variant::FLOAT, "p_zoom_factor")));
|
||||
}
|
||||
|
|
@ -1982,16 +1988,18 @@ CodeTextEditor::CodeTextEditor() {
|
|||
|
||||
status_bar->add_child(memnew(VSeparator));
|
||||
|
||||
// Line and column
|
||||
line_and_col_txt = memnew(Label);
|
||||
status_bar->add_child(line_and_col_txt);
|
||||
line_and_col_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
|
||||
line_and_col_txt->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
line_and_col_txt->set_tooltip_auto_translate_mode(AUTO_TRANSLATE_MODE_ALWAYS);
|
||||
line_and_col_txt->set_tooltip_text(TTRC("Line and column numbers."));
|
||||
line_and_col_txt->set_accessibility_name(TTRC("Line and column numbers."));
|
||||
line_and_col_txt->set_focus_mode(FOCUS_ACCESSIBILITY);
|
||||
line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP);
|
||||
// Line and column.
|
||||
line_and_col_button = memnew(Button);
|
||||
line_and_col_button->set_theme_type_variation("FlatMenuButton");
|
||||
line_and_col_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
|
||||
line_and_col_button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
line_and_col_button->set_tooltip_auto_translate_mode(AUTO_TRANSLATE_MODE_ALWAYS);
|
||||
line_and_col_button->set_tooltip_text(TTRC("Line and column numbers."));
|
||||
line_and_col_button->set_accessibility_name(TTRC("Line and column numbers."));
|
||||
line_and_col_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_show_goto_popup_request));
|
||||
line_and_col_button->set_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"));
|
||||
line_and_col_button->set_shortcut_context(this);
|
||||
status_bar->add_child(line_and_col_button);
|
||||
|
||||
status_bar->add_child(memnew(VSeparator));
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class CodeTextEditor : public VBoxContainer {
|
|||
Button *warning_button = nullptr;
|
||||
|
||||
MenuButton *zoom_button = nullptr;
|
||||
Label *line_and_col_txt = nullptr;
|
||||
Button *line_and_col_button = nullptr;
|
||||
Label *indentation_txt = nullptr;
|
||||
|
||||
Timer *idle = nullptr;
|
||||
|
|
@ -209,6 +209,8 @@ class CodeTextEditor : public VBoxContainer {
|
|||
void _zoom_out();
|
||||
void _zoom_to(float p_zoom_factor);
|
||||
|
||||
void _show_goto_popup_request();
|
||||
|
||||
void _update_error_content_height();
|
||||
|
||||
void _error_button_pressed();
|
||||
|
|
|
|||
|
|
@ -639,6 +639,7 @@ TextEditorBase::TextEditorBase() {
|
|||
code_editor->get_text_editor()->connect(SceneStringName(gui_input), callable_mp(this, &TextEditorBase::_text_edit_gui_input));
|
||||
code_editor->connect("validate_script", callable_mp(this, &TextEditorBase::_validate_script));
|
||||
code_editor->connect("load_theme_settings", callable_mp(this, &TextEditorBase::_load_theme_settings));
|
||||
code_editor->connect("show_goto_popup", callable_mp(this, &TextEditorBase::_edit_option).bind(SEARCH_GOTO_LINE));
|
||||
|
||||
context_menu = memnew(PopupMenu);
|
||||
context_menu->connect(SceneStringName(id_pressed), callable_mp(this, &TextEditorBase::_edit_option));
|
||||
|
|
|
|||
|
|
@ -1307,6 +1307,7 @@ TextShaderEditor::TextShaderEditor() {
|
|||
|
||||
goto_line_popup = memnew(GotoLinePopup);
|
||||
add_child(goto_line_popup);
|
||||
code_editor->connect("show_goto_popup", callable_mp(this, &TextShaderEditor::_menu_option).bind(SEARCH_GOTO_LINE));
|
||||
|
||||
disk_changed = memnew(ConfirmationDialog);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue