2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2019-10-23 15:54:41 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-08-15 04:58:31 -03:00
|
|
|
#include "CodeDocument.h"
|
2019-10-23 15:54:41 -03:00
|
|
|
#include <AK/ByteBuffer.h>
|
2022-12-04 15:02:33 -03:00
|
|
|
#include <AK/DeprecatedString.h>
|
2019-10-23 15:54:41 -03:00
|
|
|
#include <AK/NonnullRefPtr.h>
|
|
|
|
|
#include <AK/RefCounted.h>
|
|
|
|
|
|
2020-08-17 10:22:30 -03:00
|
|
|
namespace HackStudio {
|
|
|
|
|
|
2019-11-01 14:40:32 -03:00
|
|
|
class ProjectFile : public RefCounted<ProjectFile> {
|
2019-10-23 15:54:41 -03:00
|
|
|
public:
|
2022-12-04 15:02:33 -03:00
|
|
|
static NonnullRefPtr<ProjectFile> construct_with_name(DeprecatedString const& name)
|
2019-10-23 15:54:41 -03:00
|
|
|
{
|
2021-04-23 11:46:57 -03:00
|
|
|
return adopt_ref(*new ProjectFile(name));
|
2019-10-23 15:54:41 -03:00
|
|
|
}
|
|
|
|
|
|
2022-12-04 15:02:33 -03:00
|
|
|
DeprecatedString const& name() const { return m_name; }
|
2021-03-19 08:06:32 -03:00
|
|
|
bool could_render_text() const { return m_could_render_text; }
|
2019-10-23 15:54:41 -03:00
|
|
|
|
2020-04-23 15:29:38 -03:00
|
|
|
GUI::TextDocument& document() const;
|
2021-03-05 12:21:01 -03:00
|
|
|
CodeDocument& code_document() const;
|
2019-10-27 15:39:15 -03:00
|
|
|
|
2020-11-03 09:27:05 -03:00
|
|
|
int vertical_scroll_value() const;
|
|
|
|
|
void vertical_scroll_value(int);
|
|
|
|
|
int horizontal_scroll_value() const;
|
|
|
|
|
void horizontal_scroll_value(int);
|
|
|
|
|
|
2019-10-23 15:54:41 -03:00
|
|
|
private:
|
2022-12-04 15:02:33 -03:00
|
|
|
explicit ProjectFile(DeprecatedString const& name);
|
2021-03-05 12:21:01 -03:00
|
|
|
void create_document_if_needed() const;
|
2019-10-23 15:54:41 -03:00
|
|
|
|
2022-12-04 15:02:33 -03:00
|
|
|
DeprecatedString m_name;
|
2020-08-15 04:58:31 -03:00
|
|
|
mutable RefPtr<CodeDocument> m_document;
|
2021-03-19 08:06:32 -03:00
|
|
|
mutable bool m_could_render_text { false };
|
2020-11-03 09:40:24 -03:00
|
|
|
int m_vertical_scroll_value { 0 };
|
|
|
|
|
int m_horizontal_scroll_value { 0 };
|
2019-10-23 15:54:41 -03:00
|
|
|
};
|
2020-08-17 10:22:30 -03:00
|
|
|
|
|
|
|
|
}
|