summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorlucastarche <lucastarche@gmail.com>2021-03-15 18:28:24 -0300
committerAndreas Kling <kling@serenityos.org>2021-03-25 11:01:49 +0100
commitf6892d1ede29a8627cc06263cfbe8b554210e11d (patch)
treef10b54b877382fa7d1aa68b9ee6a81f344cfaf1a /Userland
parent0071dc7be4b162de700a86f0d2658e1ab36f50e6 (diff)
downloadserenity-f6892d1ede29a8627cc06263cfbe8b554210e11d.zip
TextEditorWidget: Added tab width submenu
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/TextEditor/TextEditorWidget.cpp28
-rw-r--r--Userland/Applications/TextEditor/TextEditorWidget.h7
2 files changed, 35 insertions, 0 deletions
diff --git a/Userland/Applications/TextEditor/TextEditorWidget.cpp b/Userland/Applications/TextEditor/TextEditorWidget.cpp
index 1c95f69616..6ea8763523 100644
--- a/Userland/Applications/TextEditor/TextEditorWidget.cpp
+++ b/Userland/Applications/TextEditor/TextEditorWidget.cpp
@@ -481,6 +481,34 @@ void TextEditorWidget::initialize_menubar(GUI::MenuBar& menubar)
m_no_wrapping_action->set_checked(true);
view_menu.add_separator();
+
+ m_soft_tab_width_actions.set_exclusive(true);
+ auto& soft_tab_width_menu = view_menu.add_submenu("Tab width");
+ m_soft_tab_1_width_action = GUI::Action::create_checkable("1", [&](auto&) {
+ m_editor->set_soft_tab_width(1);
+ });
+ m_soft_tab_2_width_action = GUI::Action::create_checkable("2", [&](auto&) {
+ m_editor->set_soft_tab_width(2);
+ });
+ m_soft_tab_4_width_action = GUI::Action::create_checkable("4", [&](auto&) {
+ m_editor->set_soft_tab_width(4);
+ });
+ m_soft_tab_8_width_action = GUI::Action::create_checkable("8", [&](auto&) {
+ m_editor->set_soft_tab_width(8);
+ });
+ m_soft_tab_16_width_action = GUI::Action::create_checkable("16", [&](auto&) {
+ m_editor->set_soft_tab_width(16);
+ });
+
+ soft_tab_width_menu.add_action(*m_soft_tab_1_width_action);
+ soft_tab_width_menu.add_action(*m_soft_tab_2_width_action);
+ soft_tab_width_menu.add_action(*m_soft_tab_4_width_action);
+ soft_tab_width_menu.add_action(*m_soft_tab_8_width_action);
+ soft_tab_width_menu.add_action(*m_soft_tab_16_width_action);
+
+ m_soft_tab_4_width_action->set_checked(true);
+
+ view_menu.add_separator();
view_menu.add_action(*m_no_preview_action);
view_menu.add_action(*m_markdown_preview_action);
view_menu.add_action(*m_html_preview_action);
diff --git a/Userland/Applications/TextEditor/TextEditorWidget.h b/Userland/Applications/TextEditor/TextEditorWidget.h
index 25c848054f..ace76a1a78 100644
--- a/Userland/Applications/TextEditor/TextEditorWidget.h
+++ b/Userland/Applications/TextEditor/TextEditorWidget.h
@@ -114,6 +114,13 @@ private:
RefPtr<GUI::Action> m_wrap_anywhere_action;
RefPtr<GUI::Action> m_wrap_at_words_action;
+ GUI::ActionGroup m_soft_tab_width_actions;
+ RefPtr<GUI::Action> m_soft_tab_1_width_action;
+ RefPtr<GUI::Action> m_soft_tab_2_width_action;
+ RefPtr<GUI::Action> m_soft_tab_4_width_action;
+ RefPtr<GUI::Action> m_soft_tab_8_width_action;
+ RefPtr<GUI::Action> m_soft_tab_16_width_action;
+
GUI::ActionGroup syntax_actions;
RefPtr<GUI::Action> m_plain_text_highlight;
RefPtr<GUI::Action> m_cpp_highlight;