mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
ScriptEditor/ShaderEditor: Replace find/replace dialog with a bar
This commit is contained in:
parent
aba972238e
commit
51be9beec9
9 changed files with 621 additions and 47 deletions
|
|
@ -33,7 +33,9 @@
|
|||
#include "scene/gui/text_edit.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "scene/main/timer.h"
|
||||
#include "scene/gui/tool_button.h"
|
||||
#include "scene/gui/check_button.h"
|
||||
#include "scene/gui/check_box.h"
|
||||
#include "scene/gui/line_edit.h"
|
||||
|
||||
|
||||
|
|
@ -58,8 +60,71 @@ public:
|
|||
GotoLineDialog();
|
||||
};
|
||||
|
||||
class FindReplaceBar : public HBoxContainer {
|
||||
|
||||
OBJ_TYPE(FindReplaceBar,HBoxContainer);
|
||||
|
||||
LineEdit *search_text;
|
||||
ToolButton *find_prev;
|
||||
ToolButton *find_next;
|
||||
CheckBox *case_sensitive;
|
||||
CheckBox *whole_words;
|
||||
Label *error_label;
|
||||
TextureButton *hide_button;
|
||||
|
||||
LineEdit *replace_text;
|
||||
ToolButton *replace;
|
||||
ToolButton *replace_all;
|
||||
CheckBox *selection_only;
|
||||
|
||||
VBoxContainer *text_vbc;
|
||||
HBoxContainer *replace_hbc;
|
||||
HBoxContainer *replace_options_hbc;
|
||||
|
||||
TextEdit *text_edit;
|
||||
|
||||
int current_result_line;
|
||||
int current_result_col;
|
||||
|
||||
bool replace_all_mode;
|
||||
|
||||
void _show_search();
|
||||
void _hide_bar();
|
||||
void _search_options_changed(bool p_pressed);
|
||||
void _search_text_changed(const String& p_text);
|
||||
void _search_text_entered(const String& p_text);
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
void _unhandled_input(const InputEvent &p_event);
|
||||
|
||||
bool _search(bool p_include_current=false, bool p_backwards=false);
|
||||
|
||||
void _replace();
|
||||
void _replace_all();
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
String get_search_text() const;
|
||||
String get_replace_text() const;
|
||||
|
||||
bool is_case_sensitive() const;
|
||||
bool is_whole_words() const;
|
||||
bool is_selection_only() const;
|
||||
void set_error(const String& p_label);
|
||||
|
||||
void set_text_edit(TextEdit *p_text_edit);
|
||||
|
||||
void popup_search();
|
||||
void popup_replace();
|
||||
|
||||
void search_current();
|
||||
void search_prev();
|
||||
void search_next();
|
||||
|
||||
FindReplaceBar();
|
||||
};
|
||||
|
||||
class FindReplaceDialog : public ConfirmationDialog {
|
||||
|
||||
|
|
@ -119,11 +184,12 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class CodeTextEditor : public Control {
|
||||
class CodeTextEditor : public VBoxContainer {
|
||||
|
||||
OBJ_TYPE(CodeTextEditor,Control);
|
||||
OBJ_TYPE(CodeTextEditor,VBoxContainer);
|
||||
|
||||
TextEdit *text_editor;
|
||||
FindReplaceBar *find_replace_bar;
|
||||
|
||||
Label *line_col;
|
||||
Label *info;
|
||||
|
|
@ -157,6 +223,7 @@ protected:
|
|||
public:
|
||||
|
||||
TextEdit *get_text_edit() { return text_editor; }
|
||||
FindReplaceBar *get_find_replace_bar() { return find_replace_bar; }
|
||||
virtual void apply_code() {}
|
||||
|
||||
CodeTextEditor();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue