From 7b9f2d9929d0e8516d42379962533df823c7c550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 14 Jan 2017 10:52:54 +0100 Subject: Finish renaming *Frame GUI classes to *Rect ReferenceFrame had been overlooked, and the cpp files still used the old names. Also ripgrep'ed it all to find some forgotten references. --- doc/base/classes.xml | 6 +- main/tests/test_gui.cpp | 2 +- scene/gui/color_picker.h | 2 +- scene/gui/color_rect.cpp | 31 +++- scene/gui/color_rect.h | 34 +++- scene/gui/graph_edit.h | 2 +- scene/gui/patch_9_frame.cpp | 184 --------------------- scene/gui/patch_9_frame.h | 68 -------- scene/gui/patch_9_rect.cpp | 184 +++++++++++++++++++++ scene/gui/patch_9_rect.h | 68 ++++++++ scene/gui/reference_frame.cpp | 44 ----- scene/gui/reference_frame.h | 45 ----- scene/gui/reference_rect.cpp | 44 +++++ scene/gui/reference_rect.h | 45 +++++ scene/gui/texture_frame.cpp | 170 ------------------- scene/gui/texture_frame.h | 78 --------- scene/gui/texture_rect.cpp | 170 +++++++++++++++++++ scene/gui/texture_rect.h | 78 +++++++++ scene/register_scene_types.cpp | 8 +- scene/resources/default_theme/default_theme.cpp | 4 +- tools/editor/animation_editor.h | 2 +- tools/editor/editor_file_dialog.h | 2 +- tools/editor/editor_log.h | 2 +- tools/editor/editor_profiler.h | 2 +- tools/editor/icons/2x/icon_patch_9_frame.png | Bin 162 -> 0 bytes tools/editor/icons/2x/icon_patch_9_rect.png | Bin 0 -> 162 bytes tools/editor/icons/2x/icon_reference_frame.png | Bin 160 -> 0 bytes tools/editor/icons/2x/icon_reference_rect.png | Bin 0 -> 160 bytes tools/editor/icons/2x/icon_texture_frame.png | Bin 201 -> 0 bytes tools/editor/icons/2x/icon_texture_rect.png | Bin 0 -> 201 bytes tools/editor/icons/icon_patch_9_frame.png | Bin 128 -> 0 bytes tools/editor/icons/icon_patch_9_rect.png | Bin 0 -> 128 bytes tools/editor/icons/icon_reference_frame.png | Bin 128 -> 0 bytes tools/editor/icons/icon_reference_rect.png | Bin 0 -> 128 bytes tools/editor/icons/icon_texture_frame.png | Bin 158 -> 0 bytes tools/editor/icons/icon_texture_rect.png | Bin 0 -> 158 bytes tools/editor/icons/source/icon_patch_9_frame.svg | 130 --------------- tools/editor/icons/source/icon_patch_9_rect.svg | 130 +++++++++++++++ tools/editor/icons/source/icon_reference_frame.svg | 100 ----------- tools/editor/icons/source/icon_reference_rect.svg | 100 +++++++++++ tools/editor/icons/source/icon_texture_frame.svg | 105 ------------ tools/editor/icons/source/icon_texture_rect.svg | 105 ++++++++++++ tools/editor/plugins/canvas_item_editor_plugin.cpp | 12 +- tools/editor/plugins/style_box_editor_plugin.h | 2 +- .../plugins/texture_region_editor_plugin.cpp | 2 +- .../editor/plugins/texture_region_editor_plugin.h | 2 +- tools/editor/plugins/theme_editor_plugin.h | 2 +- tools/editor/project_manager.cpp | 2 +- tools/editor/property_editor.h | 2 +- 49 files changed, 1011 insertions(+), 958 deletions(-) delete mode 100644 scene/gui/patch_9_frame.cpp delete mode 100644 scene/gui/patch_9_frame.h create mode 100644 scene/gui/patch_9_rect.cpp create mode 100644 scene/gui/patch_9_rect.h delete mode 100644 scene/gui/reference_frame.cpp delete mode 100644 scene/gui/reference_frame.h create mode 100644 scene/gui/reference_rect.cpp create mode 100644 scene/gui/reference_rect.h delete mode 100644 scene/gui/texture_frame.cpp delete mode 100644 scene/gui/texture_frame.h create mode 100644 scene/gui/texture_rect.cpp create mode 100644 scene/gui/texture_rect.h delete mode 100644 tools/editor/icons/2x/icon_patch_9_frame.png create mode 100644 tools/editor/icons/2x/icon_patch_9_rect.png delete mode 100644 tools/editor/icons/2x/icon_reference_frame.png create mode 100644 tools/editor/icons/2x/icon_reference_rect.png delete mode 100644 tools/editor/icons/2x/icon_texture_frame.png create mode 100644 tools/editor/icons/2x/icon_texture_rect.png delete mode 100644 tools/editor/icons/icon_patch_9_frame.png create mode 100644 tools/editor/icons/icon_patch_9_rect.png delete mode 100644 tools/editor/icons/icon_reference_frame.png create mode 100644 tools/editor/icons/icon_reference_rect.png delete mode 100644 tools/editor/icons/icon_texture_frame.png create mode 100644 tools/editor/icons/icon_texture_rect.png delete mode 100644 tools/editor/icons/source/icon_patch_9_frame.svg create mode 100644 tools/editor/icons/source/icon_patch_9_rect.svg delete mode 100644 tools/editor/icons/source/icon_reference_frame.svg create mode 100644 tools/editor/icons/source/icon_reference_rect.svg delete mode 100644 tools/editor/icons/source/icon_texture_frame.svg create mode 100644 tools/editor/icons/source/icon_texture_rect.svg diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 368cd1bcba..0088f576f0 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -8816,7 +8816,7 @@ - + @@ -26354,7 +26354,7 @@ - + @@ -32557,7 +32557,7 @@ - + Reference frame for GUI. diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp index ab3df3b022..da0ff5d1ca 100644 --- a/main/tests/test_gui.cpp +++ b/main/tests/test_gui.cpp @@ -46,7 +46,7 @@ #include "scene/gui/tab_container.h" #include "scene/gui/tree.h" #include "scene/gui/rich_text_label.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "io/image_loader.h" #include "print_string.h" #include "scene/2d/sprite.h" diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h index bb8a4a8dbd..b6f9e9a070 100644 --- a/scene/gui/color_picker.h +++ b/scene/gui/color_picker.h @@ -36,7 +36,7 @@ #include "scene/gui/button.h" #include "scene/gui/popup.h" #include "scene/gui/box_container.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" #include "scene/gui/check_button.h" diff --git a/scene/gui/color_rect.cpp b/scene/gui/color_rect.cpp index ce12a27460..99797aa9c1 100644 --- a/scene/gui/color_rect.cpp +++ b/scene/gui/color_rect.cpp @@ -1,8 +1,34 @@ +/*************************************************************************/ +/* color_rect.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "color_rect.h" - - void ColorRect::set_frame_color(const Color& p_color) { color=p_color; @@ -33,4 +59,3 @@ ColorRect::ColorRect() { color=Color(1,1,1); } - diff --git a/scene/gui/color_rect.h b/scene/gui/color_rect.h index 9d8b958130..55e413ce27 100644 --- a/scene/gui/color_rect.h +++ b/scene/gui/color_rect.h @@ -1,5 +1,33 @@ -#ifndef COLORRECT_H -#define COLORRECT_H +/*************************************************************************/ +/* color_rect.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef COLOR_RECT_H +#define COLOR_RECT_H #include "scene/gui/control.h" @@ -19,4 +47,4 @@ public: ColorRect(); }; -#endif // COLORRECT_H +#endif // COLOR_RECT_H diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index 86b976c4fe..3e9944332f 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -34,7 +34,7 @@ #include "scene/gui/slider.h" #include "scene/gui/tool_button.h" #include "scene/gui/spin_box.h" -#include "texture_frame.h" +#include "scene/gui/texture_rect.h" class GraphEdit; diff --git a/scene/gui/patch_9_frame.cpp b/scene/gui/patch_9_frame.cpp deleted file mode 100644 index 1f6145d5db..0000000000 --- a/scene/gui/patch_9_frame.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/*************************************************************************/ -/* patch_9_frame.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "patch_9_frame.h" - -#include "servers/visual_server.h" - -void NinePatchRect::_notification(int p_what) { - - if (p_what==NOTIFICATION_DRAW) { - - if (texture.is_null()) - return; - - Size2 s=get_size(); - RID ci = get_canvas_item(); - VS::get_singleton()->canvas_item_add_nine_patch(ci,Rect2(Point2(),s),region_rect,texture->get_rid(),Vector2(margin[MARGIN_LEFT],margin[MARGIN_TOP]),Vector2(margin[MARGIN_RIGHT],margin[MARGIN_BOTTOM]),VS::NINE_PATCH_STRETCH,VS::NINE_PATCH_STRETCH,draw_center); -// draw_texture_rect(texture,Rect2(Point2(),s),false,modulate); - -/* - Vector points; - points.resize(4); - points[0]=Point2(0,0); - points[1]=Point2(s.x,0); - points[2]=Point2(s.x,s.y); - points[3]=Point2(0,s.y); - Vector uvs; - uvs.resize(4); - uvs[0]=Point2(0,0); - uvs[1]=Point2(1,0); - uvs[2]=Point2(1,1); - uvs[3]=Point2(0,1); - - VisualServer::get_singleton()->canvas_item_add_primitive(ci,points,Vector(),uvs,texture->get_rid()); -*/ - } -} - -Size2 NinePatchRect::get_minimum_size() const { - - return Size2(margin[MARGIN_LEFT]+margin[MARGIN_RIGHT],margin[MARGIN_TOP]+margin[MARGIN_BOTTOM]); -} -void NinePatchRect::_bind_methods() { - - - ClassDB::bind_method(_MD("set_texture","texture"), & NinePatchRect::set_texture ); - ClassDB::bind_method(_MD("get_texture"), & NinePatchRect::get_texture ); - ClassDB::bind_method(_MD("set_patch_margin","margin","value"), & NinePatchRect::set_patch_margin ); - ClassDB::bind_method(_MD("get_patch_margin","margin"), & NinePatchRect::get_patch_margin ); - ClassDB::bind_method(_MD("set_region_rect","rect"),&NinePatchRect::set_region_rect); - ClassDB::bind_method(_MD("get_region_rect"),&NinePatchRect::get_region_rect); - ClassDB::bind_method(_MD("set_draw_center","draw_center"), & NinePatchRect::set_draw_center ); - ClassDB::bind_method(_MD("get_draw_center"), & NinePatchRect::get_draw_center ); - - ADD_SIGNAL(MethodInfo("texture_changed")); - - ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), _SCS("set_texture"),_SCS("get_texture") ); - ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "draw_center"), _SCS("set_draw_center"),_SCS("get_draw_center") ); - ADD_PROPERTYNZ( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect")); - - ADD_GROUP("Patch Margin","patch_margin_"); - ADD_PROPERTYINZ( PropertyInfo( Variant::INT, "patch_margin_left",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_patch_margin"),_SCS("get_patch_margin"),MARGIN_LEFT ); - ADD_PROPERTYINZ( PropertyInfo( Variant::INT, "patch_margin_top",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_patch_margin"),_SCS("get_patch_margin"),MARGIN_TOP ); - ADD_PROPERTYINZ( PropertyInfo( Variant::INT, "patch_margin_right",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_patch_margin"),_SCS("get_patch_margin"),MARGIN_RIGHT ); - ADD_PROPERTYINZ( PropertyInfo( Variant::INT, "patch_margin_bottom",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_patch_margin"),_SCS("get_patch_margin"),MARGIN_BOTTOM ); - -} - - -void NinePatchRect::set_texture(const Ref& p_tex) { - - if (texture==p_tex) - return; - texture=p_tex; - update(); - //if (texture.is_valid()) - // texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites - minimum_size_changed(); - emit_signal("texture_changed"); -} - -Ref NinePatchRect::get_texture() const { - - return texture; -} - - - -void NinePatchRect::set_patch_margin(Margin p_margin,int p_size) { - - ERR_FAIL_INDEX(p_margin,4); - margin[p_margin]=p_size; - update(); - minimum_size_changed(); - switch (p_margin) { - case MARGIN_LEFT: - _change_notify("patch_margin/left"); - break; - case MARGIN_TOP: - _change_notify("patch_margin/top"); - break; - case MARGIN_RIGHT: - _change_notify("patch_margin/right"); - break; - case MARGIN_BOTTOM: - _change_notify("patch_margin/bottom"); - break; - } -} - -int NinePatchRect::get_patch_margin(Margin p_margin) const{ - - ERR_FAIL_INDEX_V(p_margin,4,0); - return margin[p_margin]; -} - -void NinePatchRect::set_region_rect(const Rect2& p_region_rect) { - - if (region_rect==p_region_rect) - return; - - region_rect=p_region_rect; - - item_rect_changed(); - _change_notify("region_rect"); -} - -Rect2 NinePatchRect::get_region_rect() const { - - return region_rect; -} - -void NinePatchRect::set_draw_center(bool p_draw) { - - draw_center=p_draw; - update(); -} - -bool NinePatchRect::get_draw_center() const{ - - return draw_center; -} - -NinePatchRect::NinePatchRect() { - - - margin[MARGIN_LEFT]=0; - margin[MARGIN_RIGHT]=0; - margin[MARGIN_BOTTOM]=0; - margin[MARGIN_TOP]=0; - - set_mouse_filter(MOUSE_FILTER_IGNORE); - draw_center=true; -} - - -NinePatchRect::~NinePatchRect() -{ -} diff --git a/scene/gui/patch_9_frame.h b/scene/gui/patch_9_frame.h deleted file mode 100644 index d55f4e4f69..0000000000 --- a/scene/gui/patch_9_frame.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************/ -/* patch_9_frame.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef PATCH_9_FRAME_H -#define PATCH_9_FRAME_H - -#include "scene/gui/control.h" -/** - @author Juan Linietsky -*/ -class NinePatchRect : public Control { - - GDCLASS(NinePatchRect,Control); - - bool draw_center; - int margin[4]; - Rect2 region_rect; - Ref texture; -protected: - - void _notification(int p_what); - virtual Size2 get_minimum_size() const; - static void _bind_methods(); - -public: - - void set_texture(const Ref& p_tex); - Ref get_texture() const; - - void set_patch_margin(Margin p_margin,int p_size); - int get_patch_margin(Margin p_margin) const; - - void set_region_rect(const Rect2& p_region_rect); - Rect2 get_region_rect() const; - - void set_draw_center(bool p_enable); - bool get_draw_center() const; - - NinePatchRect(); - ~NinePatchRect(); - -}; -#endif // PATCH_9_FRAME_H diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp new file mode 100644 index 0000000000..698d4aaf29 --- /dev/null +++ b/scene/gui/patch_9_rect.cpp @@ -0,0 +1,184 @@ +/*************************************************************************/ +/* patch_9_rect.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "patch_9_rect.h" + +#include "servers/visual_server.h" + +void NinePatchRect::_notification(int p_what) { + + if (p_what==NOTIFICATION_DRAW) { + + if (texture.is_null()) + return; + + Size2 s=get_size(); + RID ci = get_canvas_item(); + VS::get_singleton()->canvas_item_add_nine_patch(ci,Rect2(Point2(),s),region_rect,texture->get_rid(),Vector2(margin[MARGIN_LEFT],margin[MARGIN_TOP]),Vector2(margin[MARGIN_RIGHT],margin[MARGIN_BOTTOM]),VS::NINE_PATCH_STRETCH,VS::NINE_PATCH_STRETCH,draw_center); +// draw_texture_rect(texture,Rect2(Point2(),s),false,modulate); + +/* + Vector points; + points.resize(4); + points[0]=Point2(0,0); + points[1]=Point2(s.x,0); + points[2]=Point2(s.x,s.y); + points[3]=Point2(0,s.y); + Vector uvs; + uvs.resize(4); + uvs[0]=Point2(0,0); + uvs[1]=Point2(1,0); + uvs[2]=Point2(1,1); + uvs[3]=Point2(0,1); + + VisualServer::get_singleton()->canvas_item_add_primitive(ci,points,Vector(),uvs,texture->get_rid()); +*/ + } +} + +Size2 NinePatchRect::get_minimum_size() const { + + return Size2(margin[MARGIN_LEFT]+margin[MARGIN_RIGHT],margin[MARGIN_TOP]+margin[MARGIN_BOTTOM]); +} +void NinePatchRect::_bind_methods() { + + + ClassDB::bind_method(_MD("set_texture","texture"), & NinePatchRect::set_texture ); + ClassDB::bind_method(_MD("get_texture"), & NinePatchRect::get_texture ); + ClassDB::bind_method(_MD("set_patch_margin","margin","value"), & NinePatchRect::set_patch_margin ); + ClassDB::bind_method(_MD("get_patch_margin","margin"), & NinePatchRect::get_patch_margin ); + ClassDB::bind_method(_MD("set_region_rect","rect"),&NinePatchRect::set_region_rect); + ClassDB::bind_method(_MD("get_region_rect"),&NinePatchRect::get_region_rect); + ClassDB::bind_method(_MD("set_draw_center","draw_center"), & NinePatchRect::set_draw_center ); + ClassDB::bind_method(_MD("get_draw_center"), & NinePatchRect::get_draw_center ); + + ADD_SIGNAL(MethodInfo("texture_changed")); + + ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), _SCS("set_texture"),_SCS("get_texture") ); + ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "draw_center"), _SCS("set_draw_center"),_SCS("get_draw_center") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect")); + + ADD_GROUP("Patch Margin","patch_margin_"); + ADD_PROPERTYINZ( PropertyInfo( Variant::INT, "patch_margin_left",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_patch_margin"),_SCS("get_patch_margin"),MARGIN_LEFT ); + ADD_PROPERTYINZ( PropertyInfo( Variant::INT, "patch_margin_top",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_patch_margin"),_SCS("get_patch_margin"),MARGIN_TOP ); + ADD_PROPERTYINZ( PropertyInfo( Variant::INT, "patch_margin_right",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_patch_margin"),_SCS("get_patch_margin"),MARGIN_RIGHT ); + ADD_PROPERTYINZ( PropertyInfo( Variant::INT, "patch_margin_bottom",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_patch_margin"),_SCS("get_patch_margin"),MARGIN_BOTTOM ); + +} + + +void NinePatchRect::set_texture(const Ref& p_tex) { + + if (texture==p_tex) + return; + texture=p_tex; + update(); + //if (texture.is_valid()) + // texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites + minimum_size_changed(); + emit_signal("texture_changed"); +} + +Ref NinePatchRect::get_texture() const { + + return texture; +} + + + +void NinePatchRect::set_patch_margin(Margin p_margin,int p_size) { + + ERR_FAIL_INDEX(p_margin,4); + margin[p_margin]=p_size; + update(); + minimum_size_changed(); + switch (p_margin) { + case MARGIN_LEFT: + _change_notify("patch_margin/left"); + break; + case MARGIN_TOP: + _change_notify("patch_margin/top"); + break; + case MARGIN_RIGHT: + _change_notify("patch_margin/right"); + break; + case MARGIN_BOTTOM: + _change_notify("patch_margin/bottom"); + break; + } +} + +int NinePatchRect::get_patch_margin(Margin p_margin) const{ + + ERR_FAIL_INDEX_V(p_margin,4,0); + return margin[p_margin]; +} + +void NinePatchRect::set_region_rect(const Rect2& p_region_rect) { + + if (region_rect==p_region_rect) + return; + + region_rect=p_region_rect; + + item_rect_changed(); + _change_notify("region_rect"); +} + +Rect2 NinePatchRect::get_region_rect() const { + + return region_rect; +} + +void NinePatchRect::set_draw_center(bool p_draw) { + + draw_center=p_draw; + update(); +} + +bool NinePatchRect::get_draw_center() const{ + + return draw_center; +} + +NinePatchRect::NinePatchRect() { + + + margin[MARGIN_LEFT]=0; + margin[MARGIN_RIGHT]=0; + margin[MARGIN_BOTTOM]=0; + margin[MARGIN_TOP]=0; + + set_mouse_filter(MOUSE_FILTER_IGNORE); + draw_center=true; +} + + +NinePatchRect::~NinePatchRect() +{ +} diff --git a/scene/gui/patch_9_rect.h b/scene/gui/patch_9_rect.h new file mode 100644 index 0000000000..b87f2f64ec --- /dev/null +++ b/scene/gui/patch_9_rect.h @@ -0,0 +1,68 @@ +/*************************************************************************/ +/* patch_9_rect.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef PATCH_9_FRAME_H +#define PATCH_9_FRAME_H + +#include "scene/gui/control.h" +/** + @author Juan Linietsky +*/ +class NinePatchRect : public Control { + + GDCLASS(NinePatchRect,Control); + + bool draw_center; + int margin[4]; + Rect2 region_rect; + Ref texture; +protected: + + void _notification(int p_what); + virtual Size2 get_minimum_size() const; + static void _bind_methods(); + +public: + + void set_texture(const Ref& p_tex); + Ref get_texture() const; + + void set_patch_margin(Margin p_margin,int p_size); + int get_patch_margin(Margin p_margin) const; + + void set_region_rect(const Rect2& p_region_rect); + Rect2 get_region_rect() const; + + void set_draw_center(bool p_enable); + bool get_draw_center() const; + + NinePatchRect(); + ~NinePatchRect(); + +}; +#endif // PATCH_9_FRAME_H diff --git a/scene/gui/reference_frame.cpp b/scene/gui/reference_frame.cpp deleted file mode 100644 index 37bc3ae6fb..0000000000 --- a/scene/gui/reference_frame.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************/ -/* reference_frame.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "reference_frame.h" - -void ReferenceFrame::_notification(int p_what) { - - if (p_what==NOTIFICATION_DRAW) { - - if (!is_inside_tree()) - return; - if (get_tree()->is_editor_hint()) - draw_style_box(get_stylebox("border"),Rect2(Point2(),get_size())) ; - } -} - -ReferenceFrame::ReferenceFrame() -{ -} diff --git a/scene/gui/reference_frame.h b/scene/gui/reference_frame.h deleted file mode 100644 index 8b4a16cb43..0000000000 --- a/scene/gui/reference_frame.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************/ -/* reference_frame.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef REFERENCE_FRAME_H -#define REFERENCE_FRAME_H - -#include "scene/gui/control.h" - -class ReferenceFrame : public Control { - - GDCLASS( ReferenceFrame, Control); - -protected: - - void _notification(int p_what); -public: - ReferenceFrame(); -}; - -#endif // REFERENCE_FRAME_H diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp new file mode 100644 index 0000000000..ff4cdf04fd --- /dev/null +++ b/scene/gui/reference_rect.cpp @@ -0,0 +1,44 @@ +/*************************************************************************/ +/* reference_rect.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "reference_rect.h" + +void ReferenceRect::_notification(int p_what) { + + if (p_what==NOTIFICATION_DRAW) { + + if (!is_inside_tree()) + return; + if (get_tree()->is_editor_hint()) + draw_style_box(get_stylebox("border"),Rect2(Point2(),get_size())) ; + } +} + +ReferenceRect::ReferenceRect() +{ +} diff --git a/scene/gui/reference_rect.h b/scene/gui/reference_rect.h new file mode 100644 index 0000000000..be493f346c --- /dev/null +++ b/scene/gui/reference_rect.h @@ -0,0 +1,45 @@ +/*************************************************************************/ +/* reference_rect.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef REFERENCE_RECT_H +#define REFERENCE_RECT_H + +#include "scene/gui/control.h" + +class ReferenceRect : public Control { + + GDCLASS( ReferenceRect, Control); + +protected: + + void _notification(int p_what); +public: + ReferenceRect(); +}; + +#endif // REFERENCE_RECT_H diff --git a/scene/gui/texture_frame.cpp b/scene/gui/texture_frame.cpp deleted file mode 100644 index 6556e487f1..0000000000 --- a/scene/gui/texture_frame.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/*************************************************************************/ -/* texture_frame.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "texture_frame.h" -#include "servers/visual_server.h" - -void TextureRect::_notification(int p_what) { - - if (p_what==NOTIFICATION_DRAW) { - - if (texture.is_null()) - return; - - - switch(stretch_mode) { - case STRETCH_SCALE_ON_EXPAND: { - Size2 s=expand?get_size():texture->get_size(); - draw_texture_rect(texture,Rect2(Point2(),s),false); - } break; - case STRETCH_SCALE: { - draw_texture_rect(texture,Rect2(Point2(),get_size()),false); - } break; - case STRETCH_TILE: { - draw_texture_rect(texture,Rect2(Point2(),get_size()),true); - } break; - case STRETCH_KEEP: { - draw_texture_rect(texture,Rect2(Point2(),texture->get_size()),false); - - } break; - case STRETCH_KEEP_CENTERED: { - - Vector2 ofs = (get_size() - texture->get_size())/2; - draw_texture_rect(texture,Rect2(ofs,texture->get_size()),false); - } break; - case STRETCH_KEEP_ASPECT_CENTERED: - case STRETCH_KEEP_ASPECT: { - - Size2 size=get_size(); - int tex_width = texture->get_width() * size.height / texture ->get_height(); - int tex_height = size.height; - - if (tex_width>size.width) { - tex_width=size.width; - tex_height=texture->get_height() * tex_width / texture->get_width(); - } - - int ofs_x = 0; - int ofs_y = 0; - - if (stretch_mode==STRETCH_KEEP_ASPECT_CENTERED) { - ofs_x+=(size.width - tex_width)/2; - ofs_y+=(size.height - tex_height)/2; - } - - draw_texture_rect(texture,Rect2(ofs_x,ofs_y,tex_width,tex_height)); - } break; - - } - - } -} - -Size2 TextureRect::get_minimum_size() const { - - if (!expand && !texture.is_null()) - return texture->get_size(); - else - return Size2(); -} -void TextureRect::_bind_methods() { - - - ClassDB::bind_method(_MD("set_texture","texture"), & TextureRect::set_texture ); - ClassDB::bind_method(_MD("get_texture"), & TextureRect::get_texture ); - ClassDB::bind_method(_MD("set_expand","enable"), & TextureRect::set_expand ); - ClassDB::bind_method(_MD("has_expand"), & TextureRect::has_expand ); - ClassDB::bind_method(_MD("set_stretch_mode","stretch_mode"), & TextureRect::set_stretch_mode ); - ClassDB::bind_method(_MD("get_stretch_mode"), & TextureRect::get_stretch_mode ); - - ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), _SCS("set_texture"),_SCS("get_texture") ); - ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "expand" ), _SCS("set_expand"),_SCS("has_expand") ); - ADD_PROPERTYNO( PropertyInfo( Variant::INT, "stretch_mode",PROPERTY_HINT_ENUM,"Scale On Expand (Compat),Scale,Tile,Keep,Keep Centered,Keep Aspect,Keep Aspect Centered"), _SCS("set_stretch_mode"),_SCS("get_stretch_mode") ); - - BIND_CONSTANT( STRETCH_SCALE_ON_EXPAND ); - BIND_CONSTANT( STRETCH_SCALE ); - BIND_CONSTANT( STRETCH_TILE ); - BIND_CONSTANT( STRETCH_KEEP ); - BIND_CONSTANT( STRETCH_KEEP_CENTERED ); - BIND_CONSTANT( STRETCH_KEEP_ASPECT ); - BIND_CONSTANT( STRETCH_KEEP_ASPECT_CENTERED ); - -} - - -void TextureRect::set_texture(const Ref& p_tex) { - - texture=p_tex; - update(); - //if (texture.is_valid()) - // texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites - minimum_size_changed(); -} - -Ref TextureRect::get_texture() const { - - return texture; -} - - -void TextureRect::set_expand(bool p_expand) { - - expand=p_expand; - update(); - minimum_size_changed(); -} -bool TextureRect::has_expand() const { - - return expand; -} - -void TextureRect::set_stretch_mode(StretchMode p_mode) { - - stretch_mode=p_mode; - update(); -} - -TextureRect::StretchMode TextureRect::get_stretch_mode() const { - - return stretch_mode; -} - -TextureRect::TextureRect() { - - - expand=false; - set_mouse_filter(MOUSE_FILTER_IGNORE); - stretch_mode=STRETCH_SCALE_ON_EXPAND; -} - - -TextureRect::~TextureRect() -{ -} - - diff --git a/scene/gui/texture_frame.h b/scene/gui/texture_frame.h deleted file mode 100644 index dea5b3b0ac..0000000000 --- a/scene/gui/texture_frame.h +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************/ -/* texture_frame.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef TEXTURE_FRAME_H -#define TEXTURE_FRAME_H - -#include "scene/gui/control.h" -/** - @author Juan Linietsky -*/ -class TextureRect : public Control { - - GDCLASS(TextureRect,Control); -public: - enum StretchMode { - STRETCH_SCALE_ON_EXPAND, //default, for backwards compatibility - STRETCH_SCALE, - STRETCH_TILE, - STRETCH_KEEP, - STRETCH_KEEP_CENTERED, - STRETCH_KEEP_ASPECT, - STRETCH_KEEP_ASPECT_CENTERED, - - }; -private: - bool expand; - Ref texture; - StretchMode stretch_mode; -protected: - - void _notification(int p_what); - virtual Size2 get_minimum_size() const; - static void _bind_methods(); - -public: - - void set_texture(const Ref& p_tex); - Ref get_texture() const; - - - void set_expand(bool p_expand); - bool has_expand() const; - - void set_stretch_mode(StretchMode p_mode); - StretchMode get_stretch_mode() const; - - TextureRect(); - ~TextureRect(); - -}; - -VARIANT_ENUM_CAST( TextureRect::StretchMode ); -#endif // TEXTURE_FRAME_H diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp new file mode 100644 index 0000000000..68755c0ac2 --- /dev/null +++ b/scene/gui/texture_rect.cpp @@ -0,0 +1,170 @@ +/*************************************************************************/ +/* texture_rect.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "texture_rect.h" +#include "servers/visual_server.h" + +void TextureRect::_notification(int p_what) { + + if (p_what==NOTIFICATION_DRAW) { + + if (texture.is_null()) + return; + + + switch(stretch_mode) { + case STRETCH_SCALE_ON_EXPAND: { + Size2 s=expand?get_size():texture->get_size(); + draw_texture_rect(texture,Rect2(Point2(),s),false); + } break; + case STRETCH_SCALE: { + draw_texture_rect(texture,Rect2(Point2(),get_size()),false); + } break; + case STRETCH_TILE: { + draw_texture_rect(texture,Rect2(Point2(),get_size()),true); + } break; + case STRETCH_KEEP: { + draw_texture_rect(texture,Rect2(Point2(),texture->get_size()),false); + + } break; + case STRETCH_KEEP_CENTERED: { + + Vector2 ofs = (get_size() - texture->get_size())/2; + draw_texture_rect(texture,Rect2(ofs,texture->get_size()),false); + } break; + case STRETCH_KEEP_ASPECT_CENTERED: + case STRETCH_KEEP_ASPECT: { + + Size2 size=get_size(); + int tex_width = texture->get_width() * size.height / texture ->get_height(); + int tex_height = size.height; + + if (tex_width>size.width) { + tex_width=size.width; + tex_height=texture->get_height() * tex_width / texture->get_width(); + } + + int ofs_x = 0; + int ofs_y = 0; + + if (stretch_mode==STRETCH_KEEP_ASPECT_CENTERED) { + ofs_x+=(size.width - tex_width)/2; + ofs_y+=(size.height - tex_height)/2; + } + + draw_texture_rect(texture,Rect2(ofs_x,ofs_y,tex_width,tex_height)); + } break; + + } + + } +} + +Size2 TextureRect::get_minimum_size() const { + + if (!expand && !texture.is_null()) + return texture->get_size(); + else + return Size2(); +} +void TextureRect::_bind_methods() { + + + ClassDB::bind_method(_MD("set_texture","texture"), & TextureRect::set_texture ); + ClassDB::bind_method(_MD("get_texture"), & TextureRect::get_texture ); + ClassDB::bind_method(_MD("set_expand","enable"), & TextureRect::set_expand ); + ClassDB::bind_method(_MD("has_expand"), & TextureRect::has_expand ); + ClassDB::bind_method(_MD("set_stretch_mode","stretch_mode"), & TextureRect::set_stretch_mode ); + ClassDB::bind_method(_MD("get_stretch_mode"), & TextureRect::get_stretch_mode ); + + ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), _SCS("set_texture"),_SCS("get_texture") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "expand" ), _SCS("set_expand"),_SCS("has_expand") ); + ADD_PROPERTYNO( PropertyInfo( Variant::INT, "stretch_mode",PROPERTY_HINT_ENUM,"Scale On Expand (Compat),Scale,Tile,Keep,Keep Centered,Keep Aspect,Keep Aspect Centered"), _SCS("set_stretch_mode"),_SCS("get_stretch_mode") ); + + BIND_CONSTANT( STRETCH_SCALE_ON_EXPAND ); + BIND_CONSTANT( STRETCH_SCALE ); + BIND_CONSTANT( STRETCH_TILE ); + BIND_CONSTANT( STRETCH_KEEP ); + BIND_CONSTANT( STRETCH_KEEP_CENTERED ); + BIND_CONSTANT( STRETCH_KEEP_ASPECT ); + BIND_CONSTANT( STRETCH_KEEP_ASPECT_CENTERED ); + +} + + +void TextureRect::set_texture(const Ref& p_tex) { + + texture=p_tex; + update(); + //if (texture.is_valid()) + // texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites + minimum_size_changed(); +} + +Ref TextureRect::get_texture() const { + + return texture; +} + + +void TextureRect::set_expand(bool p_expand) { + + expand=p_expand; + update(); + minimum_size_changed(); +} +bool TextureRect::has_expand() const { + + return expand; +} + +void TextureRect::set_stretch_mode(StretchMode p_mode) { + + stretch_mode=p_mode; + update(); +} + +TextureRect::StretchMode TextureRect::get_stretch_mode() const { + + return stretch_mode; +} + +TextureRect::TextureRect() { + + + expand=false; + set_mouse_filter(MOUSE_FILTER_IGNORE); + stretch_mode=STRETCH_SCALE_ON_EXPAND; +} + + +TextureRect::~TextureRect() +{ +} + + diff --git a/scene/gui/texture_rect.h b/scene/gui/texture_rect.h new file mode 100644 index 0000000000..e95d742759 --- /dev/null +++ b/scene/gui/texture_rect.h @@ -0,0 +1,78 @@ +/*************************************************************************/ +/* texture_rect.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef TEXTURE_FRAME_H +#define TEXTURE_FRAME_H + +#include "scene/gui/control.h" +/** + @author Juan Linietsky +*/ +class TextureRect : public Control { + + GDCLASS(TextureRect,Control); +public: + enum StretchMode { + STRETCH_SCALE_ON_EXPAND, //default, for backwards compatibility + STRETCH_SCALE, + STRETCH_TILE, + STRETCH_KEEP, + STRETCH_KEEP_CENTERED, + STRETCH_KEEP_ASPECT, + STRETCH_KEEP_ASPECT_CENTERED, + + }; +private: + bool expand; + Ref texture; + StretchMode stretch_mode; +protected: + + void _notification(int p_what); + virtual Size2 get_minimum_size() const; + static void _bind_methods(); + +public: + + void set_texture(const Ref& p_tex); + Ref get_texture() const; + + + void set_expand(bool p_expand); + bool has_expand() const; + + void set_stretch_mode(StretchMode p_mode); + StretchMode get_stretch_mode() const; + + TextureRect(); + ~TextureRect(); + +}; + +VARIANT_ENUM_CAST( TextureRect::StretchMode ); +#endif // TEXTURE_FRAME_H diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index ca3aef6262..3e5af50b36 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -54,9 +54,9 @@ #include "scene/gui/spin_box.h" #include "scene/gui/option_button.h" #include "scene/gui/color_picker.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/color_rect.h" -#include "scene/gui/patch_9_frame.h" +#include "scene/gui/patch_9_rect.h" #include "scene/gui/menu_button.h" #include "scene/gui/check_box.h" #include "scene/gui/check_button.h" @@ -81,7 +81,7 @@ #include "scene/gui/grid_container.h" #include "scene/gui/split_container.h" #include "scene/gui/video_player.h" -#include "scene/gui/reference_frame.h" +#include "scene/gui/reference_rect.h" #include "scene/gui/graph_node.h" #include "scene/gui/graph_edit.h" #include "scene/gui/tool_button.h" @@ -383,7 +383,7 @@ void register_scene_types() { ClassDB::register_virtual_class(); ClassDB::register_class(); ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 3c6e65bf41..da8fbafde3 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -934,12 +934,12 @@ void fill_default_theme(Ref& t, const Ref & default_font, const Ref t->set_stylebox("focus","VButtonArray", focus ); - // ReferenceFrame + // ReferenceRect Ref ttnc = make_stylebox( full_panel_bg_png,8,8,8,8); ttnc->set_draw_center(false); - t->set_stylebox("border","ReferenceFrame", make_stylebox( reference_border_png,4,4,4,4) ); + t->set_stylebox("border","ReferenceRect", make_stylebox( reference_border_png,4,4,4,4) ); t->set_stylebox("panelnc","Panel", ttnc ); t->set_stylebox("panelf","Panel", tc_sb ); diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h index 8ae706dfa8..c4539cd763 100644 --- a/tools/editor/animation_editor.h +++ b/tools/editor/animation_editor.h @@ -33,7 +33,7 @@ #include "scene/gui/slider.h" #include "scene/gui/menu_button.h" #include "scene/gui/spin_box.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/scroll_bar.h" #include "scene/gui/tool_button.h" #include "scene/gui/file_dialog.h" diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h index 04ee0cc55f..193cbc513c 100644 --- a/tools/editor/editor_file_dialog.h +++ b/tools/editor/editor_file_dialog.h @@ -35,7 +35,7 @@ #include "scene/gui/option_button.h" #include "os/dir_access.h" #include "scene/gui/box_container.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" /** @author Juan Linietsky diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h index e59b877ea0..914b5d0c57 100644 --- a/tools/editor/editor_log.h +++ b/tools/editor/editor_log.h @@ -36,7 +36,7 @@ //#include "scene/gui/empty_control.h" #include "scene/gui/box_container.h" #include "scene/gui/panel_container.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" #include "pane_drag.h" #include "os/thread.h" diff --git a/tools/editor/editor_profiler.h b/tools/editor/editor_profiler.h index ec1cd9fb5b..52b38cdae8 100644 --- a/tools/editor/editor_profiler.h +++ b/tools/editor/editor_profiler.h @@ -3,7 +3,7 @@ #include "scene/gui/box_container.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/button.h" #include "scene/gui/label.h" #include "scene/gui/tree.h" diff --git a/tools/editor/icons/2x/icon_patch_9_frame.png b/tools/editor/icons/2x/icon_patch_9_frame.png deleted file mode 100644 index 5762a0392e..0000000000 Binary files a/tools/editor/icons/2x/icon_patch_9_frame.png and /dev/null differ diff --git a/tools/editor/icons/2x/icon_patch_9_rect.png b/tools/editor/icons/2x/icon_patch_9_rect.png new file mode 100644 index 0000000000..5762a0392e Binary files /dev/null and b/tools/editor/icons/2x/icon_patch_9_rect.png differ diff --git a/tools/editor/icons/2x/icon_reference_frame.png b/tools/editor/icons/2x/icon_reference_frame.png deleted file mode 100644 index 63fe559fa7..0000000000 Binary files a/tools/editor/icons/2x/icon_reference_frame.png and /dev/null differ diff --git a/tools/editor/icons/2x/icon_reference_rect.png b/tools/editor/icons/2x/icon_reference_rect.png new file mode 100644 index 0000000000..63fe559fa7 Binary files /dev/null and b/tools/editor/icons/2x/icon_reference_rect.png differ diff --git a/tools/editor/icons/2x/icon_texture_frame.png b/tools/editor/icons/2x/icon_texture_frame.png deleted file mode 100644 index 50d715dd09..0000000000 Binary files a/tools/editor/icons/2x/icon_texture_frame.png and /dev/null differ diff --git a/tools/editor/icons/2x/icon_texture_rect.png b/tools/editor/icons/2x/icon_texture_rect.png new file mode 100644 index 0000000000..50d715dd09 Binary files /dev/null and b/tools/editor/icons/2x/icon_texture_rect.png differ diff --git a/tools/editor/icons/icon_patch_9_frame.png b/tools/editor/icons/icon_patch_9_frame.png deleted file mode 100644 index bdd1467144..0000000000 Binary files a/tools/editor/icons/icon_patch_9_frame.png and /dev/null differ diff --git a/tools/editor/icons/icon_patch_9_rect.png b/tools/editor/icons/icon_patch_9_rect.png new file mode 100644 index 0000000000..bdd1467144 Binary files /dev/null and b/tools/editor/icons/icon_patch_9_rect.png differ diff --git a/tools/editor/icons/icon_reference_frame.png b/tools/editor/icons/icon_reference_frame.png deleted file mode 100644 index b253af477f..0000000000 Binary files a/tools/editor/icons/icon_reference_frame.png and /dev/null differ diff --git a/tools/editor/icons/icon_reference_rect.png b/tools/editor/icons/icon_reference_rect.png new file mode 100644 index 0000000000..b253af477f Binary files /dev/null and b/tools/editor/icons/icon_reference_rect.png differ diff --git a/tools/editor/icons/icon_texture_frame.png b/tools/editor/icons/icon_texture_frame.png deleted file mode 100644 index 84e4a90bfb..0000000000 Binary files a/tools/editor/icons/icon_texture_frame.png and /dev/null differ diff --git a/tools/editor/icons/icon_texture_rect.png b/tools/editor/icons/icon_texture_rect.png new file mode 100644 index 0000000000..84e4a90bfb Binary files /dev/null and b/tools/editor/icons/icon_texture_rect.png differ diff --git a/tools/editor/icons/source/icon_patch_9_frame.svg b/tools/editor/icons/source/icon_patch_9_frame.svg deleted file mode 100644 index f12789c19e..0000000000 --- a/tools/editor/icons/source/icon_patch_9_frame.svg +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - diff --git a/tools/editor/icons/source/icon_patch_9_rect.svg b/tools/editor/icons/source/icon_patch_9_rect.svg new file mode 100644 index 0000000000..c5a09603a6 --- /dev/null +++ b/tools/editor/icons/source/icon_patch_9_rect.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/tools/editor/icons/source/icon_reference_frame.svg b/tools/editor/icons/source/icon_reference_frame.svg deleted file mode 100644 index 76c3247f1b..0000000000 --- a/tools/editor/icons/source/icon_reference_frame.svg +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - diff --git a/tools/editor/icons/source/icon_reference_rect.svg b/tools/editor/icons/source/icon_reference_rect.svg new file mode 100644 index 0000000000..cee814360d --- /dev/null +++ b/tools/editor/icons/source/icon_reference_rect.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/tools/editor/icons/source/icon_texture_frame.svg b/tools/editor/icons/source/icon_texture_frame.svg deleted file mode 100644 index afab41de41..0000000000 --- a/tools/editor/icons/source/icon_texture_frame.svg +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/tools/editor/icons/source/icon_texture_rect.svg b/tools/editor/icons/source/icon_texture_rect.svg new file mode 100644 index 0000000000..88d9b4081f --- /dev/null +++ b/tools/editor/icons/source/icon_texture_rect.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 45f97383a3..65fdababbd 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -41,7 +41,7 @@ #include "os/input.h" #include "tools/editor/editor_settings.h" #include "scene/gui/grid_container.h" -#include "scene/gui/patch_9_frame.h" +#include "scene/gui/patch_9_rect.h" #include "tools/editor/animation_editor.h" #include "tools/editor/plugins/animation_player_editor_plugin.h" #include "tools/editor/script_editor_debugger.h" @@ -3767,7 +3767,7 @@ void CanvasItemEditorViewport::_create_nodes(Node* parent, Node* child, String& editor_data->get_undo_redo().add_do_property(child,property,texture); // make visible for certain node type - if (default_type=="Patch9Frame") { + if (default_type=="Patch9Rect") { editor_data->get_undo_redo().add_do_property(child,"rect/size",texture_size); } else if (default_type=="Polygon2D") { PoolVector list; @@ -3785,7 +3785,7 @@ void CanvasItemEditorViewport::_create_nodes(Node* parent, Node* child, String& } Transform2D trans=canvas->get_canvas_transform(); Point2 target_pos = (p_point-trans.get_origin())/trans.get_scale().x-pos; - if (default_type=="Polygon2D" || default_type=="TouchScreenButton" || default_type=="TextureRect" || default_type=="Patch9Frame") { + if (default_type=="Polygon2D" || default_type=="TouchScreenButton" || default_type=="TextureRect" || default_type=="Patch9Rect") { target_pos -= texture_size/2; } editor_data->get_undo_redo().add_do_method(child,"set_pos",target_pos); @@ -3857,8 +3857,8 @@ void CanvasItemEditorViewport::_perform_drop_data(){ else if (default_type=="Particles2D") child=memnew(Particles2D); else if (default_type=="Polygon2D") child=memnew(Polygon2D); else if (default_type=="TouchScreenButton") child=memnew(TouchScreenButton); - else if (default_type=="TextureRect") child=memnew(TextureRect); - else if (default_type=="Patch9Frame") child=memnew(NinePatchRect); + else if (default_type=="TextureRect") child=memnew(TextureRect); + else if (default_type=="Patch9Rect") child=memnew(NinePatchRect); else child=memnew(Sprite); // default _create_nodes(target_node, child, path, drop_pos); @@ -3993,7 +3993,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte types.push_back("TouchScreenButton"); // Control types.push_back("TextureRect"); - types.push_back("Patch9Frame"); + types.push_back("Patch9Rect"); target_node=NULL; editor=p_node; diff --git a/tools/editor/plugins/style_box_editor_plugin.h b/tools/editor/plugins/style_box_editor_plugin.h index b2288b8e74..29e98efd8b 100644 --- a/tools/editor/plugins/style_box_editor_plugin.h +++ b/tools/editor/plugins/style_box_editor_plugin.h @@ -30,7 +30,7 @@ #define STYLE_BOX_EDITOR_PLUGIN_H #include "scene/resources/style_box.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/option_button.h" #include "tools/editor/editor_node.h" diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index ca49684063..1ad880c4d6 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -935,7 +935,7 @@ void TextureRegionEditorPlugin::edit(Object *p_node) bool TextureRegionEditorPlugin::handles(Object *p_obj) const { - return p_obj->is_class("Sprite") || p_obj->is_class("Patch9Frame") || p_obj->is_class("StyleBoxTexture") || p_obj->is_class("AtlasTexture"); + return p_obj->is_class("Sprite") || p_obj->is_class("Patch9Rect") || p_obj->is_class("StyleBoxTexture") || p_obj->is_class("AtlasTexture"); } void TextureRegionEditorPlugin::make_visible(bool p_visible) diff --git a/tools/editor/plugins/texture_region_editor_plugin.h b/tools/editor/plugins/texture_region_editor_plugin.h index c529e54dd1..35c0f18efa 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.h +++ b/tools/editor/plugins/texture_region_editor_plugin.h @@ -36,7 +36,7 @@ #include "tools/editor/editor_plugin.h" #include "tools/editor/editor_node.h" #include "scene/2d/sprite.h" -#include "scene/gui/patch_9_frame.h" +#include "scene/gui/patch_9_rect.h" #include "scene/resources/style_box.h" #include "scene/resources/texture.h" diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h index 0af9128bf2..9251da8e07 100644 --- a/tools/editor/plugins/theme_editor_plugin.h +++ b/tools/editor/plugins/theme_editor_plugin.h @@ -30,7 +30,7 @@ #define THEME_EDITOR_PLUGIN_H #include "scene/resources/theme.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/option_button.h" #include "scene/gui/file_dialog.h" #include "scene/gui/check_box.h" diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index da12e8d671..01dca396c8 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -42,7 +42,7 @@ #include "scene/gui/center_container.h" #include "io/stream_peer_ssl.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/margin_container.h" #include "io/resource_saver.h" diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 305da055a4..900d06497f 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -37,7 +37,7 @@ #include "scene/gui/dialogs.h" #include "scene/gui/color_picker.h" #include "scene/gui/menu_button.h" -#include "scene/gui/texture_frame.h" +#include "scene/gui/texture_rect.h" #include "scene/gui/text_edit.h" #include "scene/gui/check_button.h" #include "scene/gui/split_container.h" -- cgit v1.2.3