diff options
Diffstat (limited to 'editor/editor_settings.h')
-rw-r--r-- | editor/editor_settings.h | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 809389eb40..4e084e5291 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -31,17 +31,18 @@ #include "object.h" -#include "resource.h" -#include "os/thread_safe.h" #include "core/io/config_file.h" -#include "translation.h" +#include "os/thread_safe.h" +#include "resource.h" #include "scene/gui/input_action.h" +#include "translation.h" class EditorPlugin; class EditorSettings : public Resource { - GDCLASS( EditorSettings, Resource ); + GDCLASS(EditorSettings, Resource); + private: _THREAD_SAFE_CLASS_ @@ -58,24 +59,32 @@ public: String script; Vector<String> install_files; }; -private: +private: struct VariantContainer { int order; Variant variant; bool hide_from_editor; bool save; - VariantContainer(){ order=0; hide_from_editor=false; save=false;} - VariantContainer(const Variant& p_variant, int p_order) { variant=p_variant; order=p_order; hide_from_editor=false; } + VariantContainer() { + order = 0; + hide_from_editor = false; + save = false; + } + VariantContainer(const Variant &p_variant, int p_order) { + variant = p_variant; + order = p_order; + hide_from_editor = false; + } }; - HashMap<String,PropertyInfo> hints; + HashMap<String, PropertyInfo> hints; int last_order; - HashMap<String,VariantContainer> props; + HashMap<String, VariantContainer> props; String resource_path; - bool _set(const StringName& p_name, const Variant& p_value); - bool _get(const StringName& p_name,Variant &r_ret) const; + bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List<PropertyInfo> *p_list) const; static Ref<EditorSettings> singleton; @@ -85,7 +94,6 @@ private: Ref<Resource> clipboard; - bool save_changed_setting; bool optimize_save; //do not save stuff that came from config but was not set from engine @@ -102,20 +110,18 @@ private: Vector<Ref<Translation> > translations; - Map<String,Ref<ShortCut> > shortcuts; + Map<String, Ref<ShortCut> > shortcuts; - void _add_property_info_bind(const Dictionary& p_info); + void _add_property_info_bind(const Dictionary &p_info); protected: - static void _bind_methods(); -public: +public: enum { - NOTIFICATION_EDITOR_SETTINGS_CHANGED=10000 + NOTIFICATION_EDITOR_SETTINGS_CHANGED = 10000 }; - bool has(String p_var) const; static EditorSettings *get_singleton(); void erase(String p_var); @@ -123,26 +129,25 @@ public: //String get_global_settings_path() const; String get_project_settings_path() const; - void setup_language(); void setup_network(); - void raise_order(const String& p_name); + void raise_order(const String &p_name); static void create(); static void save(); static void destroy(); void notify_changes(); - void set_resource_clipboard(const Ref<Resource>& p_resource) { clipboard=p_resource; } + void set_resource_clipboard(const Ref<Resource> &p_resource) { clipboard = p_resource; } Ref<Resource> get_resource_clipboard() const { return clipboard; } - void add_property_hint(const PropertyInfo& p_hint); + void add_property_hint(const PropertyInfo &p_hint); - void set_favorite_dirs(const Vector<String>& p_favorite_dirs); + void set_favorite_dirs(const Vector<String> &p_favorite_dirs); Vector<String> get_favorite_dirs() const; - void set_recent_dirs(const Vector<String>& p_recent_dirs); + void set_recent_dirs(const Vector<String> &p_recent_dirs); Vector<String> get_recent_dirs() const; void load_favorites(); @@ -153,28 +158,27 @@ public: bool save_text_editor_theme(); bool save_text_editor_theme_as(String p_file); - void add_shortcut(const String& p_name,Ref<ShortCut>& p_shortcut); - bool is_shortcut(const String&p_name,const InputEvent& p_event) const; - Ref<ShortCut> get_shortcut(const String&p_name) const; + void add_shortcut(const String &p_name, Ref<ShortCut> &p_shortcut); + bool is_shortcut(const String &p_name, const InputEvent &p_event) const; + Ref<ShortCut> get_shortcut(const String &p_name) const; void get_shortcut_list(List<String> *r_shortcuts); void set_optimize_save(bool p_optimize); - Variant get_project_metadata(const String& p_section, const String& p_key, Variant p_default); - void set_project_metadata(const String& p_section, const String& p_key, Variant p_data); + Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default); + void set_project_metadata(const String &p_section, const String &p_key, Variant p_data); EditorSettings(); ~EditorSettings(); - }; //not a macro any longer -#define EDITOR_DEF(m_var,m_val) _EDITOR_DEF(m_var,Variant(m_val)) -Variant _EDITOR_DEF( const String& p_var, const Variant& p_default); +#define EDITOR_DEF(m_var, m_val) _EDITOR_DEF(m_var, Variant(m_val)) +Variant _EDITOR_DEF(const String &p_var, const Variant &p_default); -#define ED_IS_SHORTCUT(p_name,p_ev) (EditorSettings::get_singleton()->is_shortcut(p_name,p_ev)) -Ref<ShortCut> ED_SHORTCUT(const String& p_path,const String& p_name,uint32_t p_keycode=0); -Ref<ShortCut> ED_GET_SHORTCUT(const String& p_path); +#define ED_IS_SHORTCUT(p_name, p_ev) (EditorSettings::get_singleton()->is_shortcut(p_name, p_ev)) +Ref<ShortCut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode = 0); +Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path); #endif // EDITOR_SETTINGS_H |