/* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2020, Itamar S. * Copyright (c) 2020-2021, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "ClassViewWidget.h" #include "Debugger/DebugInfoWidget.h" #include "Debugger/DisassemblyWidget.h" #include "EditorWrapper.h" #include "FindInFilesWidget.h" #include "Git/DiffViewer.h" #include "Git/GitWidget.h" #include "Locator.h" #include "Project.h" #include "ProjectFile.h" #include "TerminalWrapper.h" #include #include #include #include #include namespace HackStudio { class HackStudioWidget : public GUI::Widget { C_OBJECT(HackStudioWidget) public: virtual ~HackStudioWidget() override; bool open_file(const String& filename); void update_actions(); Project& project(); GUI::TextEditor& current_editor(); EditorWrapper& current_editor_wrapper(); void set_current_editor_wrapper(RefPtr); const String& active_file() const { return m_current_editor_wrapper->filename(); } void initialize_menubar(GUI::Menubar&); Locator& locator() { VERIFY(m_locator); return *m_locator; } enum class ContinueDecision { No, Yes }; ContinueDecision warn_unsaved_changes(const String& prompt); private: static String get_full_path_of_serenity_source(const String& file); Vector selected_file_paths() const; HackStudioWidget(const String& path_to_project); void open_project(const String& root_path); enum class EditMode { Text, Form, Diff, }; void set_edit_mode(EditMode); NonnullRefPtr create_project_tree_view_context_menu(); NonnullRefPtr create_new_file_action(); NonnullRefPtr create_new_directory_action(); NonnullRefPtr create_open_selected_action(); NonnullRefPtr create_delete_action(); NonnullRefPtr create_new_project_action(); NonnullRefPtr create_switch_to_next_editor_action(); NonnullRefPtr create_switch_to_previous_editor_action(); NonnullRefPtr create_remove_current_editor_action(); NonnullRefPtr create_open_action(); NonnullRefPtr create_save_action(); NonnullRefPtr create_add_editor_action(); NonnullRefPtr create_add_terminal_action(); NonnullRefPtr create_remove_current_terminal_action(); NonnullRefPtr create_debug_action(); NonnullRefPtr create_build_action(); NonnullRefPtr create_run_action(); NonnullRefPtr create_stop_action(); void add_new_editor(GUI::Widget& parent); RefPtr get_editor_of_file(const String& filename); String get_project_executable_path() const; void on_action_tab_change(); void reveal_action_tab(GUI::Widget&); void initialize_debugger(); void handle_external_file_deletion(const String& filepath); void create_open_files_view(GUI::Widget& parent); void create_toolbar(GUI::Widget& parent); void create_action_tab(GUI::Widget& parent); void create_file_menubar(GUI::Menubar&); void create_project_menubar(GUI::Menubar&); void create_edit_menubar(GUI::Menubar&); void create_build_menubar(GUI::Menubar&); void create_view_menubar(GUI::Menubar&); void create_help_menubar(GUI::Menubar&); void create_project_tab(GUI::Widget& parent); void configure_project_tree_view(); void run(TerminalWrapper& wrapper); void build(TerminalWrapper& wrapper); void hide_action_tabs(); bool any_document_is_dirty() const; NonnullRefPtrVector m_all_editor_wrappers; RefPtr m_current_editor_wrapper; HashMap> m_open_files; RefPtr m_file_watcher; Vector m_open_files_vector; // NOTE: This contains the keys from m_open_files and m_file_watchers OwnPtr m_project; RefPtr m_project_tree_view; RefPtr m_open_files_view; RefPtr m_right_hand_splitter; RefPtr m_right_hand_stack; RefPtr m_editors_splitter; RefPtr m_form_inner_container; RefPtr m_form_widget_tree_view; RefPtr m_diff_viewer; RefPtr m_git_widget; RefPtr m_class_view; RefPtr m_project_tree_view_context_menu; RefPtr m_action_tab_widget; RefPtr m_project_tab; RefPtr m_terminal_wrapper; RefPtr m_locator; RefPtr m_find_in_files_widget; RefPtr m_debug_info_widget; RefPtr m_disassembly_widget; RefPtr m_debugger_thread; RefPtr m_current_editor_in_execution; RefPtr m_new_file_action; RefPtr m_new_directory_action; RefPtr m_open_selected_action; RefPtr m_delete_action; RefPtr m_new_project_action; RefPtr m_switch_to_next_editor; RefPtr m_switch_to_previous_editor; RefPtr m_remove_current_editor_action; RefPtr m_open_action; RefPtr m_save_action; RefPtr m_add_editor_action; RefPtr m_add_terminal_action; RefPtr m_remove_current_terminal_action; RefPtr m_stop_action; RefPtr m_debug_action; RefPtr m_build_action; RefPtr m_run_action; GUI::ActionGroup m_wrapping_mode_actions; RefPtr m_no_wrapping_action; RefPtr m_wrap_anywhere_action; RefPtr m_wrap_at_words_action; }; }