diff options
| author | volzhs | 2017-05-03 06:02:06 +0900 |
|---|---|---|
| committer | volzhs | 2017-05-03 06:19:15 +0900 |
| commit | 17e8e343fb900c3b308b3a6cb8611a16b476e71e (patch) | |
| tree | 55c64ec319ab91f9ba8468c7f4c65d92044ef385 /scene/gui | |
| parent | 5a6ccce97d350011b599e793cea95aa4e7899395 (diff) | |
| download | godot-17e8e343fb900c3b308b3a6cb8611a16b476e71e.tar.gz godot-17e8e343fb900c3b308b3a6cb8611a16b476e71e.tar.zst godot-17e8e343fb900c3b308b3a6cb8611a16b476e71e.zip | |
Revert "Add new editor and default theme (WIP)"
This reverts commit f045efe007cffb87238ee519b7f33d710814ded7.
Diffstat (limited to 'scene/gui')
| -rw-r--r-- | scene/gui/button.cpp | 29 | ||||
| -rw-r--r-- | scene/gui/graph_edit.cpp | 4 | ||||
| -rw-r--r-- | scene/gui/item_list.cpp | 18 | ||||
| -rw-r--r-- | scene/gui/item_list.h | 4 | ||||
| -rw-r--r-- | scene/gui/line_edit.cpp | 4 | ||||
| -rw-r--r-- | scene/gui/option_button.cpp | 19 | ||||
| -rw-r--r-- | scene/gui/spin_box.cpp | 7 | ||||
| -rw-r--r-- | scene/gui/tab_container.cpp | 9 | ||||
| -rw-r--r-- | scene/gui/tool_button.cpp | 4 | ||||
| -rw-r--r-- | scene/gui/tool_button.h | 3 |
10 files changed, 26 insertions, 75 deletions
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index f57b3d0fd..6fcc878e1 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -69,48 +69,49 @@ void Button::_notification(int p_what) { RID ci = get_canvas_item(); Size2 size = get_size(); Color color; - Color icon_color = Color(1, 1, 1); //print_line(get_text()+": "+itos(is_flat())+" hover "+itos(get_draw_mode())); - String style_name = ""; + Ref<StyleBox> style = get_stylebox("normal"); + switch (get_draw_mode()) { case DRAW_NORMAL: { - style_name = "normal"; + style = get_stylebox("normal"); + if (!flat) + style->draw(ci, Rect2(Point2(0, 0), size)); color = get_color("font_color"); - } break; case DRAW_PRESSED: { - style_name = "pressed"; - if (has_color("font_color_pressed")) { + style = get_stylebox("pressed"); + style->draw(ci, Rect2(Point2(0, 0), size)); + if (has_color("font_color_pressed")) color = get_color("font_color_pressed"); - icon_color = color; - } else + else color = get_color("font_color"); } break; case DRAW_HOVER: { - style_name = "hover"; + style = get_stylebox("hover"); + style->draw(ci, Rect2(Point2(0, 0), size)); color = get_color("font_color_hover"); } break; case DRAW_DISABLED: { - style_name = "disabled"; + style = get_stylebox("disabled"); + style->draw(ci, Rect2(Point2(0, 0), size)); color = get_color("font_color_disabled"); } break; } - if (style_name != "" && !flat) get_stylebox(style_name)->draw(ci, Rect2(Point2(0, 0), size)); - - Ref<StyleBox> style = get_stylebox(style_name); if (has_focus()) { + Ref<StyleBox> style = get_stylebox("focus"); style->draw(ci, Rect2(Point2(), size)); } @@ -148,7 +149,7 @@ void Button::_notification(int p_what) { int valign = size.height - style->get_minimum_size().y; - _icon->draw(ci, style->get_offset() + Point2(0, Math::floor((valign - _icon->get_height()) / 2.0)), is_disabled() ? Color(1, 1, 1, 0.4) : icon_color); + _icon->draw(ci, style->get_offset() + Point2(0, Math::floor((valign - _icon->get_height()) / 2.0)), is_disabled() ? Color(1, 1, 1, 0.4) : Color(1, 1, 1)); } } } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 0bc48677d..0c092a4e1 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -579,7 +579,7 @@ void GraphEdit::_bake_segment2d(CanvasItem *p_where, float p_begin, float p_end, if (p_depth >= p_min_depth && (dp < p_tol || p_depth >= p_max_depth)) { - p_where->draw_line(beg, end, p_color.linear_interpolate(p_to_color, mp), 4, true); + p_where->draw_line(beg, end, p_color.linear_interpolate(p_to_color, mp), 2, true); lines++; } else { _bake_segment2d(p_where, p_begin, mp, p_a, p_out, p_b, p_in, p_depth + 1, p_min_depth, p_max_depth, p_tol, p_color, p_to_color, lines); @@ -598,7 +598,7 @@ void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const int cp_neg_len = get_constant("bezier_len_neg"); if (diff > 0) { - cp_offset = MIN(cp_len, diff * 0.5); + cp_offset = MAX(cp_len, diff * 0.5); } else { cp_offset = MAX(MIN(cp_len - diff, cp_neg_len), -diff * 0.5); } diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 1dc4230d2..c2d5775b6 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -42,7 +42,6 @@ void ItemList::add_item(const String &p_item, const Ref<Texture> &p_texture, boo item.disabled = false; item.tooltip_enabled = true; item.custom_bg = Color(0, 0, 0, 0); - item.custom_font_color = get_color("font_color"); items.push_back(item); update(); @@ -152,20 +151,6 @@ Color ItemList::get_item_custom_bg_color(int p_idx) const { return items[p_idx].custom_bg; } -void ItemList::set_item_custom_font_color(int p_idx, const Color &p_custom_font_color) { - - ERR_FAIL_INDEX(p_idx, items.size()); - - items[p_idx].custom_font_color = p_custom_font_color; -} - -Color ItemList::get_item_custom_font_color(int p_idx) const { - - ERR_FAIL_INDEX_V(p_idx, items.size(), Color()); - - return items[p_idx].custom_font_color; -} - void ItemList::set_item_tag_icon(int p_idx, const Ref<Texture> &p_tag_icon) { ERR_FAIL_INDEX(p_idx, items.size()); @@ -1028,8 +1013,7 @@ void ItemList::_notification(int p_what) { else max_len = size.x; - Color font_color_2 = items[i].custom_font_color; - Color modulate = items[i].selected ? font_color_selected : font_color_2; + Color modulate = items[i].selected ? font_color_selected : font_color; if (items[i].disabled) modulate.a *= 0.5; diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index 96a894d3f..4b896de77 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -62,7 +62,6 @@ private: Variant metadata; String tooltip; Color custom_bg; - Color custom_font_color; Rect2 rect_cache; Rect2 min_rect_cache; @@ -145,9 +144,6 @@ public: void set_item_custom_bg_color(int p_idx, const Color &p_custom_bg_color); Color get_item_custom_bg_color(int p_idx) const; - void set_item_custom_font_color(int p_idx, const Color &p_custom_font_color); - Color get_item_custom_font_color(int p_idx) const; - void select(int p_idx, bool p_single = true); void unselect(int p_idx); bool is_selected(int p_idx) const; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 0acb7265e..9abf9649c 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -576,7 +576,7 @@ void LineEdit::_notification(int p_what) { RID ci = get_canvas_item(); - Ref<StyleBox> style = has_focus() ? get_stylebox("active") : get_stylebox("normal"); + Ref<StyleBox> style = get_stylebox("normal"); if (!is_editable()) style = get_stylebox("read_only"); @@ -617,7 +617,7 @@ void LineEdit::_notification(int p_what) { int font_ascent = font->get_ascent(); Color selection_color = get_color("selection_color"); - Color font_color = is_editable() ? has_focus() ? get_color("font_color_active") : get_color("font_color") : get_color("font_color_read_only"); + Color font_color = get_color("font_color"); Color font_color_selected = get_color("font_color_selected"); Color cursor_color = get_color("cursor_color"); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index b967a1a7c..0806d35d4 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -56,24 +56,7 @@ void OptionButton::_notification(int p_what) { Size2 size = get_size(); Point2 ofs(size.width - arrow->get_width() - get_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2))); - - Color arrow_color = get_color("font_color"); - switch (get_draw_mode()) { - case DRAW_NORMAL: { - arrow_color = get_color("font_color"); - } break; - case DRAW_PRESSED: { - arrow_color = get_color("font_color_pressed"); - } break; - case DRAW_HOVER: { - arrow_color = get_color("font_color_hover"); - } break; - case DRAW_DISABLED: { - arrow_color = get_color("font_color_disabled"); - } break; - } - - arrow->draw(ci, ofs, arrow_color); + arrow->draw(ci, ofs); } break; } diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index ba8ca6372..049adc6fb 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -192,12 +192,7 @@ void SpinBox::_notification(int p_what) { RID ci = get_canvas_item(); Size2i size = get_size(); - Color color = has_focus() ? line_edit->get_color("font_color_active") : line_edit->get_color("font_color"); - if (!is_editable()) - color = line_edit->get_color("font_color_read_only"); - updown->draw(ci, Point2i(size.width - updown->get_width(), (size.height - updown->get_height()) / 2), color); - - } else if (p_what == NOTIFICATION_FOCUS_EXIT) { + updown->draw(ci, Point2i(size.width - updown->get_width(), (size.height - updown->get_height()) / 2)); } else if (p_what == NOTIFICATION_FOCUS_EXIT) { diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 952f2a971..0c7a58dc1 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -206,9 +206,6 @@ void TabContainer::_notification(int p_what) { break; } - // Draw the tab area. - panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height)); - // Draw all visible tabs. int x = 0; for (int i = 0; i < tab_widths.size(); i++) { @@ -227,7 +224,7 @@ void TabContainer::_notification(int p_what) { // Draw the tab background. int tab_width = tab_widths[i]; - Rect2 tab_rect(tabs_ofs_cache + x, 2, tab_width, header_height); + Rect2 tab_rect(tabs_ofs_cache + x, 0, tab_width, header_height); tab_style->draw(canvas, tab_rect); // Draw the tab contents. @@ -282,6 +279,8 @@ void TabContainer::_notification(int p_what) { Color(1, 1, 1, first_tab_cache > 0 ? 1.0 : 0.5)); } + // Draw the tab area. + panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height)); } break; case NOTIFICATION_THEME_CHANGED: { if (get_tab_count() > 0) { @@ -660,7 +659,7 @@ TabContainer::TabContainer() { current = 0; previous = 0; mouse_x_cache = 0; - align = ALIGN_LEFT; + align = ALIGN_CENTER; tabs_visible = true; popup = NULL; }
\ No newline at end of file diff --git a/scene/gui/tool_button.cpp b/scene/gui/tool_button.cpp index 7e8a426d1..5fc4b6ecf 100644 --- a/scene/gui/tool_button.cpp +++ b/scene/gui/tool_button.cpp @@ -29,10 +29,6 @@ /*************************************************************************/ #include "tool_button.h" -void ToolButton::_notification(int p_what) { - // set_self_modulate(get_color("pressed")); -} - ToolButton::ToolButton() { set_flat(true); } diff --git a/scene/gui/tool_button.h b/scene/gui/tool_button.h index 58948f798..d243b5559 100644 --- a/scene/gui/tool_button.h +++ b/scene/gui/tool_button.h @@ -37,9 +37,6 @@ class ToolButton : public Button { public: ToolButton(); - -protected: - void _notification(int p_what); }; #endif // TOOL_BUTTON_H |
