mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 17:28:48 +00:00
HackStudio: Mark compilation-unit-only functions as static
This also resolves some typing issues that only 'accidentally' worked, like declaring a function to return type A, and the definition actually returning type B (which works if type B is a subtype of type A). I like to call these "ninja imports". To prevent problems like this in the future, I put all globals in a HackStudio.h. I'm not sure about the name, but main.h and common.h felt wrong.
This commit is contained in:
parent
42b057b0c9
commit
7893871d5a
Notes:
sideshowbarker
2024-07-19 03:43:14 +09:00
Author: https://github.com/BenWiederhake
Commit: 7893871d5a
Pull-request: https://github.com/SerenityOS/serenity/pull/3096
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/stelar7
7 changed files with 53 additions and 18 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "FindInFilesWidget.h"
|
||||
#include "FormEditorWidget.h"
|
||||
#include "FormWidget.h"
|
||||
#include "HackStudio.h"
|
||||
#include "Locator.h"
|
||||
#include "Project.h"
|
||||
#include "TerminalWrapper.h"
|
||||
|
@ -91,7 +92,7 @@ RefPtr<FormEditorWidget> g_form_editor_widget;
|
|||
|
||||
static RefPtr<GUI::TabWidget> s_action_tab_widget;
|
||||
|
||||
void add_new_editor(GUI::Widget& parent)
|
||||
static void add_new_editor(GUI::Widget& parent)
|
||||
{
|
||||
auto wrapper = EditorWrapper::construct(Debugger::on_breakpoint_change);
|
||||
if (s_action_tab_widget) {
|
||||
|
@ -109,7 +110,7 @@ enum class EditMode {
|
|||
Form,
|
||||
};
|
||||
|
||||
void set_edit_mode(EditMode mode)
|
||||
static void set_edit_mode(EditMode mode)
|
||||
{
|
||||
if (mode == EditMode::Text) {
|
||||
g_right_hand_stack->set_active_widget(g_text_inner_splitter);
|
||||
|
@ -118,18 +119,18 @@ void set_edit_mode(EditMode mode)
|
|||
}
|
||||
}
|
||||
|
||||
EditorWrapper& current_editor_wrapper()
|
||||
static EditorWrapper& current_editor_wrapper()
|
||||
{
|
||||
ASSERT(g_current_editor_wrapper);
|
||||
return *g_current_editor_wrapper;
|
||||
}
|
||||
|
||||
Editor& current_editor()
|
||||
GUI::TextEditor& current_editor()
|
||||
{
|
||||
return current_editor_wrapper().editor();
|
||||
}
|
||||
|
||||
NonnullRefPtr<EditorWrapper> get_editor_of_file(const String& file)
|
||||
static NonnullRefPtr<EditorWrapper> get_editor_of_file(const String& file)
|
||||
{
|
||||
for (auto& wrapper : g_all_editor_wrappers) {
|
||||
String wrapper_file = wrapper.filename_label().text();
|
||||
|
@ -140,7 +141,7 @@ NonnullRefPtr<EditorWrapper> get_editor_of_file(const String& file)
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
String get_project_executable_path()
|
||||
static String get_project_executable_path()
|
||||
{
|
||||
// e.g /my/project.hackstudio => /my/project
|
||||
// TODO: Perhaps a Makefile rule for getting the value of $(PROGRAM) would be better?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue