diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/SCsub | 22 | ||||
-rw-r--r-- | editor/editor_node.cpp | 10 | ||||
-rw-r--r-- | editor/plugins/item_list_editor_plugin.cpp | 40 | ||||
-rw-r--r-- | editor/plugins/item_list_editor_plugin.h | 29 | ||||
-rw-r--r-- | editor/settings_config_dialog.cpp | 4 |
5 files changed, 101 insertions, 4 deletions
diff --git a/editor/SCsub b/editor/SCsub index a26f6bba77..47bdec2e0d 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -185,6 +185,24 @@ def make_authors_header(target, source, env): g.write("#endif\n") +def make_license_header(target, source, env): + + src = source[0].srcnode().abspath + dst = target[0].srcnode().abspath + f = open(src, "rb") + g = open(dst, "wb") + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _EDITOR_LICENSE_H\n") + g.write("#define _EDITOR_LICENSE_H\n") + g.write("static const char *about_license =") + + for line in f: + g.write("\n\t\"" + line.strip().replace("\"", "\\\"") + "\\n\"") + + g.write(";\n") + g.write("#endif\n") + if (env["tools"] == "yes"): # Register exporters @@ -235,6 +253,10 @@ if (env["tools"] == "yes"): env.Depends('#editor/authors.gen.h', "../AUTHORS.md") env.Command('#editor/authors.gen.h', "../AUTHORS.md", make_authors_header) + # License + env.Depends('#editor/license.gen.h', "../LICENSE.txt") + env.Command('#editor/license.gen.h', "../LICENSE.txt", make_license_header) + env.add_source_files(env.editor_sources, "*.cpp") diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4525c8f8e5..c52a133e78 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -43,6 +43,7 @@ #include "io/config_file.h" #include "io/stream_peer_ssl.h" #include "io/zip_io.h" +#include "license.gen.h" #include "main/input_default.h" #include "message_queue.h" #include "os/file_access.h" @@ -6109,6 +6110,15 @@ EditorNode::EditorNode() { dev_base->set_v_size_flags(Control::SIZE_EXPAND); tc->add_child(dev_base); + TextEdit *license = memnew(TextEdit); + license->set_name(TTR("License")); + license->set_h_size_flags(Control::SIZE_EXPAND_FILL); + license->set_v_size_flags(Control::SIZE_EXPAND_FILL); + license->set_wrap(true); + license->set_readonly(true); + license->set_text(String::utf8(about_license)); + tc->add_child(license); + VBoxContainer *dev_vbc = memnew(VBoxContainer); dev_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); dev_base->add_child(dev_vbc); diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp index 7f56286f08..f567abc5b1 100644 --- a/editor/plugins/item_list_editor_plugin.cpp +++ b/editor/plugins/item_list_editor_plugin.cpp @@ -193,6 +193,45 @@ ItemListPopupMenuPlugin::ItemListPopupMenuPlugin() { } /////////////////////////////////////////////////////////////// + +void ItemListItemListPlugin::set_object(Object *p_object) { + + pp = p_object->cast_to<ItemList>(); +} + +bool ItemListItemListPlugin::handles(Object *p_object) const { + + return p_object->is_class("ItemList"); +} + +int ItemListItemListPlugin::get_flags() const { + + return FLAG_ICON | FLAG_ENABLE; +} + +void ItemListItemListPlugin::add_item() { + + pp->add_item(vformat(TTR("Item %d"), pp->get_item_count())); + _change_notify(); +} + +int ItemListItemListPlugin::get_item_count() const { + + return pp->get_item_count(); +} + +void ItemListItemListPlugin::erase(int p_idx) { + + pp->remove_item(p_idx); + _change_notify(); +} + +ItemListItemListPlugin::ItemListItemListPlugin() { + + pp = NULL; +} + +/////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// @@ -373,6 +412,7 @@ ItemListEditorPlugin::ItemListEditorPlugin(EditorNode *p_node) { item_list_editor->hide(); item_list_editor->add_plugin(memnew(ItemListOptionButtonPlugin)); item_list_editor->add_plugin(memnew(ItemListPopupMenuPlugin)); + item_list_editor->add_plugin(memnew(ItemListItemListPlugin)); } ItemListEditorPlugin::~ItemListEditorPlugin() { diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h index 042e88839f..4fed8e49f5 100644 --- a/editor/plugins/item_list_editor_plugin.h +++ b/editor/plugins/item_list_editor_plugin.h @@ -167,6 +167,35 @@ public: /////////////////////////////////////////////////////////////// +class ItemListItemListPlugin : public ItemListPlugin { + + GDCLASS(ItemListItemListPlugin, ItemListPlugin); + + ItemList *pp; + +public: + virtual void set_object(Object *p_object); + virtual bool handles(Object *p_object) const; + virtual int get_flags() const; + + virtual void set_item_text(int p_idx, const String &p_text) { pp->set_item_text(p_idx, p_text); } + virtual String get_item_text(int p_idx) const { return pp->get_item_text(p_idx); } + + virtual void set_item_icon(int p_idx, const Ref<Texture> &p_tex) { pp->set_item_icon(p_idx, p_tex); } + virtual Ref<Texture> get_item_icon(int p_idx) const { return pp->get_item_icon(p_idx); } + + virtual void set_item_enabled(int p_idx, int p_enabled) { pp->set_item_disabled(p_idx, !p_enabled); } + virtual bool is_item_enabled(int p_idx) const { return !pp->is_item_disabled(p_idx); } + + virtual void add_item(); + virtual int get_item_count() const; + virtual void erase(int p_idx); + + ItemListItemListPlugin(); +}; + +/////////////////////////////////////////////////////////////// + class ItemListEditor : public HBoxContainer { GDCLASS(ItemListEditor, HBoxContainer); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 563de78415..6f613981b8 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -382,10 +382,6 @@ EditorSettingsDialog::EditorSettingsDialog() { press_a_key->add_child(l); press_a_key->connect("gui_input", this, "_wait_for_key"); press_a_key->connect("confirmed", this, "_press_a_key_confirm"); - //Button *load = memnew( Button ); - - //load->set_text("Load.."); - //hbc->add_child(load); //get_ok()->set_text("Apply"); set_hide_on_ok(true); |