1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-23 15:16:17 +00:00

A Whole New World (clang-format edition)

I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
This commit is contained in:
Rémi Verschelde
2017-03-05 16:44:50 +01:00
parent 45438e9918
commit 5dbf1809c6
1318 changed files with 140051 additions and 166004 deletions

View File

@@ -28,16 +28,14 @@
/*************************************************************************/
#include "style_box_editor_plugin.h"
void StyleBoxEditor::edit(const Ref<StyleBox>& p_stylebox) {
void StyleBoxEditor::edit(const Ref<StyleBox> &p_stylebox) {
if (stylebox.is_valid())
stylebox->disconnect("changed",this,"_sb_changed");
stylebox=p_stylebox;
stylebox->disconnect("changed", this, "_sb_changed");
stylebox = p_stylebox;
if (p_stylebox.is_valid()) {
preview->add_style_override("panel",stylebox);
stylebox->connect("changed",this,"_sb_changed");
preview->add_style_override("panel", stylebox);
stylebox->connect("changed", this, "_sb_changed");
}
}
@@ -48,7 +46,7 @@ void StyleBoxEditor::_sb_changed() {
void StyleBoxEditor::_bind_methods() {
ClassDB::bind_method("_sb_changed",&StyleBoxEditor::_sb_changed);
ClassDB::bind_method("_sb_changed", &StyleBoxEditor::_sb_changed);
//ClassDB::bind_method("_import",&StyleBoxEditor::_import);
//ClassDB::bind_method("_import_accept",&StyleBoxEditor::_import_accept);
//ClassDB::bind_method("_preview_text_changed",&StyleBoxEditor::_preview_text_changed);
@@ -56,39 +54,36 @@ void StyleBoxEditor::_bind_methods() {
StyleBoxEditor::StyleBoxEditor() {
panel = memnew( Panel );
panel = memnew(Panel);
add_child(panel);
panel->set_area_as_parent_rect();
Label *l = memnew( Label );
Label *l = memnew(Label);
l->set_text(TTR("StyleBox Preview:"));
l->set_pos(Point2(5,5));
l->set_pos(Point2(5, 5));
panel->add_child(l);
preview = memnew( Panel );
preview = memnew(Panel);
panel->add_child(preview);
preview->set_pos(Point2(50,50));
preview->set_size(Size2(200,100));
preview->set_pos(Point2(50, 50));
preview->set_size(Size2(200, 100));
}
void StyleBoxEditorPlugin::edit(Object *p_node) {
if (p_node && p_node->cast_to<StyleBox>()) {
stylebox_editor->edit( p_node->cast_to<StyleBox>() );
stylebox_editor->edit(p_node->cast_to<StyleBox>());
stylebox_editor->show();
} else
stylebox_editor->hide();
}
bool StyleBoxEditorPlugin::handles(Object *p_node) const{
bool StyleBoxEditorPlugin::handles(Object *p_node) const {
return p_node->is_class("StyleBox");
}
void StyleBoxEditorPlugin::make_visible(bool p_visible){
void StyleBoxEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
button->show();
@@ -103,13 +98,10 @@ void StyleBoxEditorPlugin::make_visible(bool p_visible){
StyleBoxEditorPlugin::StyleBoxEditorPlugin(EditorNode *p_node) {
stylebox_editor = memnew( StyleBoxEditor );
stylebox_editor->set_custom_minimum_size(Size2(0,250));
stylebox_editor = memnew(StyleBoxEditor);
stylebox_editor->set_custom_minimum_size(Size2(0, 250));
//p_node->get_viewport()->add_child(stylebox_editor);
button = p_node->add_bottom_panel_item("StyleBox",stylebox_editor);
button = p_node->add_bottom_panel_item("StyleBox", stylebox_editor);
button->hide();
}