2014-10-30 15:00:42 +01:00
|
|
|
#ifndef scope_hh_INCLUDED
|
|
|
|
#define scope_hh_INCLUDED
|
|
|
|
|
|
|
|
#include "alias_registry.hh"
|
2018-04-07 07:36:39 +02:00
|
|
|
#include "face_registry.hh"
|
|
|
|
#include "highlighter_group.hh"
|
2014-10-30 15:00:42 +01:00
|
|
|
#include "hook_manager.hh"
|
|
|
|
#include "keymap_manager.hh"
|
|
|
|
#include "option_manager.hh"
|
2014-12-23 14:54:09 +01:00
|
|
|
#include "utils.hh"
|
2014-10-30 15:00:42 +01:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
class Scope
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Scope(Scope& parent)
|
2015-02-15 00:28:09 +01:00
|
|
|
: m_options(parent.options()),
|
2015-04-09 17:28:13 +02:00
|
|
|
m_hooks(parent.hooks()),
|
|
|
|
m_keymaps(parent.keymaps()),
|
2017-10-28 05:00:51 +02:00
|
|
|
m_aliases(parent.aliases()),
|
2018-04-07 07:36:39 +02:00
|
|
|
m_faces(parent.faces()),
|
2017-10-28 05:00:51 +02:00
|
|
|
m_highlighters(parent.highlighters()) {}
|
|
|
|
|
|
|
|
OptionManager& options() { return m_options; }
|
|
|
|
const OptionManager& options() const { return m_options; }
|
|
|
|
HookManager& hooks() { return m_hooks; }
|
|
|
|
const HookManager& hooks() const { return m_hooks; }
|
|
|
|
KeymapManager& keymaps() { return m_keymaps; }
|
|
|
|
const KeymapManager& keymaps() const { return m_keymaps; }
|
|
|
|
AliasRegistry& aliases() { return m_aliases; }
|
|
|
|
const AliasRegistry& aliases() const { return m_aliases; }
|
2018-04-07 07:36:39 +02:00
|
|
|
FaceRegistry& faces() { return m_faces; }
|
2018-04-28 17:41:24 +02:00
|
|
|
const FaceRegistry& faces() const { return m_faces; }
|
2017-10-28 05:00:51 +02:00
|
|
|
Highlighters& highlighters() { return m_highlighters; }
|
|
|
|
const Highlighters& highlighters() const { return m_highlighters; }
|
2014-10-30 15:00:42 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend class GlobalScope;
|
|
|
|
Scope() = default;
|
|
|
|
|
|
|
|
OptionManager m_options;
|
|
|
|
HookManager m_hooks;
|
|
|
|
KeymapManager m_keymaps;
|
|
|
|
AliasRegistry m_aliases;
|
2018-04-28 17:41:24 +02:00
|
|
|
FaceRegistry m_faces;
|
2017-10-28 05:00:51 +02:00
|
|
|
Highlighters m_highlighters;
|
2014-10-30 15:00:42 +01:00
|
|
|
};
|
|
|
|
|
2018-03-05 00:39:14 +01:00
|
|
|
class GlobalScope : public Scope, public OptionManagerWatcher, public Singleton<GlobalScope>
|
2014-10-30 15:00:42 +01:00
|
|
|
{
|
|
|
|
public:
|
2018-03-05 00:39:14 +01:00
|
|
|
GlobalScope();
|
|
|
|
~GlobalScope();
|
2014-10-30 15:00:42 +01:00
|
|
|
|
|
|
|
OptionsRegistry& option_registry() { return m_option_registry; }
|
|
|
|
const OptionsRegistry& option_registry() const { return m_option_registry; }
|
|
|
|
private:
|
2019-11-02 22:07:49 +01:00
|
|
|
void on_option_changed(const Option& option) override;
|
2018-03-05 00:39:14 +01:00
|
|
|
|
2014-10-30 15:00:42 +01:00
|
|
|
OptionsRegistry m_option_registry;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // scope_hh_INCLUDED
|