summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/doc_tools.cpp97
-rw-r--r--editor/editor_help.cpp8
-rw-r--r--editor/editor_help_search.cpp4
-rw-r--r--editor/editor_help_search.h4
4 files changed, 61 insertions, 52 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index c752d0d4fd..56a9d2c258 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -145,15 +145,15 @@ void DocTools::merge_from(const DocTools &p_data) {
}
for (int i = 0; i < c.theme_properties.size(); i++) {
- DocData::PropertyDoc &p = c.theme_properties.write[i];
+ DocData::ThemeItemDoc &ti = c.theme_properties.write[i];
for (int j = 0; j < cf.theme_properties.size(); j++) {
- if (cf.theme_properties[j].name != p.name) {
+ if (cf.theme_properties[j].name != ti.name || cf.theme_properties[j].data_type != ti.data_type) {
continue;
}
- const DocData::PropertyDoc &pf = cf.theme_properties[j];
+ const DocData::ThemeItemDoc &pf = cf.theme_properties[j];
- p.description = pf.description;
+ ti.description = pf.description;
break;
}
}
@@ -464,60 +464,69 @@ void DocTools::generate(bool p_basic_types) {
c.constants.push_back(constant);
}
- //theme stuff
-
+ // Theme items.
{
List<StringName> l;
- Theme::get_default()->get_constant_list(cname, &l);
- for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "int";
- pd.default_value = itos(Theme::get_default()->get_constant(E, cname));
- c.theme_properties.push_back(pd);
- }
- l.clear();
Theme::get_default()->get_color_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "Color";
- pd.default_value = Variant(Theme::get_default()->get_color(E, cname)).get_construct_string();
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "Color";
+ tid.data_type = "color";
+ tid.default_value = Variant(Theme::get_default()->get_color(E, cname)).get_construct_string();
+ c.theme_properties.push_back(tid);
}
l.clear();
- Theme::get_default()->get_icon_list(cname, &l);
+ Theme::get_default()->get_constant_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "Texture2D";
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "int";
+ tid.data_type = "constant";
+ tid.default_value = itos(Theme::get_default()->get_constant(E, cname));
+ c.theme_properties.push_back(tid);
}
+
l.clear();
Theme::get_default()->get_font_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "Font";
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "Font";
+ tid.data_type = "font";
+ c.theme_properties.push_back(tid);
}
+
l.clear();
Theme::get_default()->get_font_size_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "int";
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "int";
+ tid.data_type = "font_size";
+ c.theme_properties.push_back(tid);
+ }
+
+ l.clear();
+ Theme::get_default()->get_icon_list(cname, &l);
+ for (const StringName &E : l) {
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "Texture2D";
+ tid.data_type = "icon";
+ c.theme_properties.push_back(tid);
}
+
l.clear();
Theme::get_default()->get_stylebox_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "StyleBox";
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "StyleBox";
+ tid.data_type = "style";
+ c.theme_properties.push_back(tid);
}
}
@@ -1069,12 +1078,14 @@ Error DocTools::_load(Ref<XMLParser> parser) {
String name3 = parser->get_node_name();
if (name3 == "theme_item") {
- DocData::PropertyDoc prop2;
+ DocData::ThemeItemDoc prop2;
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
prop2.name = parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
prop2.type = parser->get_attribute_value("type");
+ ERR_FAIL_COND_V(!parser->has_attribute("data_type"), ERR_FILE_CORRUPT);
+ prop2.data_type = parser->get_attribute_value("data_type");
if (!parser->is_empty()) {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT) {
@@ -1312,15 +1323,15 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
_write_string(f, 1, "<theme_items>");
for (int i = 0; i < c.theme_properties.size(); i++) {
- const DocData::PropertyDoc &p = c.theme_properties[i];
+ const DocData::ThemeItemDoc &ti = c.theme_properties[i];
- if (p.default_value != "") {
- _write_string(f, 2, "<theme_item name=\"" + p.name + "\" type=\"" + p.type + "\" default=\"" + p.default_value.xml_escape(true) + "\">");
+ if (ti.default_value != "") {
+ _write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\" default=\"" + ti.default_value.xml_escape(true) + "\">");
} else {
- _write_string(f, 2, "<theme_item name=\"" + p.name + "\" type=\"" + p.type + "\">");
+ _write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\">");
}
- _write_string(f, 3, p.description.strip_edges().xml_escape());
+ _write_string(f, 3, ti.description.strip_edges().xml_escape());
_write_string(f, 2, "</theme_item>");
}
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 569a28215c..f92b9ac8ba 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -758,8 +758,8 @@ void EditorHelp::_update_doc() {
if (cd.theme_properties[i].description != "") {
class_desc->push_font(doc_font);
- class_desc->add_text(" ");
class_desc->push_color(comment_color);
+ class_desc->add_text(U" – ");
_add_text(DTR(cd.theme_properties[i].description));
class_desc->pop();
class_desc->pop();
@@ -941,8 +941,7 @@ void EditorHelp::_update_doc() {
if (enum_list[i].description != "") {
class_desc->push_font(doc_font);
class_desc->push_color(comment_color);
- static const char32_t dash[6] = { ' ', ' ', 0x2013 /* en dash */, ' ', ' ', 0 };
- class_desc->add_text(String(dash));
+ class_desc->add_text(U" – ");
_add_text(DTR(enum_list[i].description));
class_desc->pop();
class_desc->pop();
@@ -1011,8 +1010,7 @@ void EditorHelp::_update_doc() {
if (constants[i].description != "") {
class_desc->push_font(doc_font);
class_desc->push_color(comment_color);
- static const char32_t dash[6] = { ' ', ' ', 0x2013 /* en dash */, ' ', ' ', 0 };
- class_desc->add_text(String(dash));
+ class_desc->add_text(U" – ");
_add_text(DTR(constants[i].description));
class_desc->pop();
class_desc->pop();
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index fabbf97f49..57f0345dad 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -367,7 +367,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
if (search_flags & SEARCH_THEME_ITEMS) {
for (int i = 0; i < class_doc.theme_properties.size(); i++) {
if (_match_string(term, class_doc.theme_properties[i].name)) {
- match.theme_properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.theme_properties[i]));
+ match.theme_properties.push_back(const_cast<DocData::ThemeItemDoc *>(&class_doc.theme_properties[i]));
}
}
}
@@ -571,7 +571,7 @@ TreeItem *EditorHelpSearch::Runner::_create_property_item(TreeItem *p_parent, co
return _create_member_item(p_parent, p_class_doc->name, "MemberProperty", p_doc->name, p_doc->name, TTRC("Property"), "property", tooltip);
}
-TreeItem *EditorHelpSearch::Runner::_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc) {
+TreeItem *EditorHelpSearch::Runner::_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ThemeItemDoc *p_doc) {
String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name;
return _create_member_item(p_parent, p_class_doc->name, "MemberTheme", p_doc->name, p_doc->name, TTRC("Theme Property"), "theme_item", tooltip);
}
diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h
index 75da2d5aba..bc57c0e3c6 100644
--- a/editor/editor_help_search.h
+++ b/editor/editor_help_search.h
@@ -103,7 +103,7 @@ class EditorHelpSearch::Runner : public RefCounted {
Vector<DocData::MethodDoc *> signals;
Vector<DocData::ConstantDoc *> constants;
Vector<DocData::PropertyDoc *> properties;
- Vector<DocData::PropertyDoc *> theme_properties;
+ Vector<DocData::ThemeItemDoc *> theme_properties;
bool required() {
return name || methods.size() || signals.size() || constants.size() || properties.size() || theme_properties.size();
@@ -145,7 +145,7 @@ class EditorHelpSearch::Runner : public RefCounted {
TreeItem *_create_signal_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::MethodDoc *p_doc);
TreeItem *_create_constant_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ConstantDoc *p_doc);
TreeItem *_create_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc);
- TreeItem *_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc);
+ TreeItem *_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ThemeItemDoc *p_doc);
TreeItem *_create_member_item(TreeItem *p_parent, const String &p_class_name, const String &p_icon, const String &p_name, const String &p_text, const String &p_type, const String &p_metatype, const String &p_tooltip);
public: