Skip to content

Commit

Permalink
Several visual improvements.
Browse files Browse the repository at this point in the history
Added proper label sizing
Improved text editor status bar
Fixed some issues with ItemList and also some style fixes
Added background to color picker samples (the mrcdk fix)
Fixed slider ticks.
Added VS breakpoint and error styleboxes.
  • Loading branch information
djrm committed Sep 28, 2017
1 parent 4f39ce3 commit 15986ea
Show file tree
Hide file tree
Showing 40 changed files with 191 additions and 1,152 deletions.
20 changes: 11 additions & 9 deletions editor/code_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,17 +1197,9 @@ CodeTextEditor::CodeTextEditor() {
text_editor->set_brace_matching(true);
text_editor->set_auto_indent(true);

MarginContainer *status_mc = memnew(MarginContainer);
add_child(status_mc);
status_mc->set("custom_constants/margin_left", 2);
status_mc->set("custom_constants/margin_top", 5);
status_mc->set("custom_constants/margin_right", 2);
status_mc->set("custom_constants/margin_bottom", 1);

HBoxContainer *status_bar = memnew(HBoxContainer);
status_mc->add_child(status_bar);
add_child(status_bar);
status_bar->set_h_size_flags(SIZE_EXPAND_FILL);
status_bar->add_child(memnew(Label)); //to keep the height if the other labels are not visible

idle = memnew(Timer);
add_child(idle);
Expand All @@ -1226,14 +1218,18 @@ CodeTextEditor::CodeTextEditor() {
error->set_clip_text(true); //do not change, or else very long errors can push the whole container to the right
error->set_valign(Label::VALIGN_CENTER);
error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
error->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
error->set_h_size_flags(SIZE_EXPAND_FILL); //required for it to display, given now it's clipping contents, do not touch

status_bar->add_child(memnew(Label)); //to keep the height if the other labels are not visible

Label *line_txt = memnew(Label);
status_bar->add_child(line_txt);
line_txt->set_align(Label::ALIGN_RIGHT);
line_txt->set_valign(Label::VALIGN_CENTER);
line_txt->set_v_size_flags(SIZE_FILL);
line_txt->set_text(TTR("Line:"));
line_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));

line_nb = memnew(Label);
status_bar->add_child(line_nb);
Expand All @@ -1242,13 +1238,16 @@ CodeTextEditor::CodeTextEditor() {
line_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch
line_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch
line_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE);
line_nb->set_align(Label::ALIGN_RIGHT);
line_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));

Label *col_txt = memnew(Label);
status_bar->add_child(col_txt);
col_txt->set_align(Label::ALIGN_RIGHT);
col_txt->set_valign(Label::VALIGN_CENTER);
col_txt->set_v_size_flags(SIZE_FILL);
col_txt->set_text(TTR("Col:"));
col_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));

col_nb = memnew(Label);
status_bar->add_child(col_nb);
Expand All @@ -1257,6 +1256,9 @@ CodeTextEditor::CodeTextEditor() {
col_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch
col_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch
col_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE);
col_nb->set_align(Label::ALIGN_RIGHT);
col_nb->set("custom_constants/margin_right", 0);
col_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));

text_editor->connect("gui_input", this, "_text_editor_gui_input");
text_editor->connect("cursor_changed", this, "_line_col_changed");
Expand Down
19 changes: 11 additions & 8 deletions editor/editor_file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ void EditorFileDialog::_notification(int p_what) {
//_update_icons
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
dir_prev->set_icon(get_icon("ArrowLeft", "EditorIcons"));
dir_next->set_icon(get_icon("ArrowRight", "EditorIcons"));
dir_prev->set_icon(get_icon("Back", "EditorIcons"));
dir_next->set_icon(get_icon("Forward", "EditorIcons"));
dir_up->set_icon(get_icon("ArrowUp", "EditorIcons"));
refresh->set_icon(get_icon("Reload", "EditorIcons"));
favorite->set_icon(get_icon("Favorites", "EditorIcons"));

fav_up->set_icon(get_icon("MoveUp", "EditorIcons"));
fav_down->set_icon(get_icon("MoveDown", "EditorIcons"));
fav_rm->set_icon(get_icon("RemoveSmall", "EditorIcons"));
fav_rm->set_icon(get_icon("Remove", "EditorIcons"));

} else if (p_what == NOTIFICATION_PROCESS) {

Expand Down Expand Up @@ -97,15 +97,15 @@ void EditorFileDialog::_notification(int p_what) {
//_update_icons
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
dir_prev->set_icon(get_icon("ArrowLeft", "EditorIcons"));
dir_next->set_icon(get_icon("ArrowRight", "EditorIcons"));
dir_prev->set_icon(get_icon("Back", "EditorIcons"));
dir_next->set_icon(get_icon("Forward", "EditorIcons"));
dir_up->set_icon(get_icon("ArrowUp", "EditorIcons"));
refresh->set_icon(get_icon("Reload", "EditorIcons"));
favorite->set_icon(get_icon("Favorites", "EditorIcons"));

fav_up->set_icon(get_icon("MoveUp", "EditorIcons"));
fav_down->set_icon(get_icon("MoveDown", "EditorIcons"));
fav_rm->set_icon(get_icon("RemoveSmall", "EditorIcons"));
fav_rm->set_icon(get_icon("Remove", "EditorIcons"));

update_file_list();
}
Expand Down Expand Up @@ -1281,6 +1281,7 @@ EditorFileDialog::EditorFileDialog() {
dir_prev = memnew(ToolButton);
dir_next = memnew(ToolButton);
dir_up = memnew(ToolButton);
dir_up->set_tooltip(TTR("Go to parent folder"));

pathhb->add_child(dir_prev);
pathhb->add_child(dir_next);
Expand All @@ -1290,6 +1291,8 @@ EditorFileDialog::EditorFileDialog() {
dir_next->connect("pressed", this, "_go_forward");
dir_up->connect("pressed", this, "_go_up");

pathhb->add_child(memnew(Label(TTR("Path:"))));

dir = memnew(LineEdit);
pathhb->add_child(dir);
dir->set_h_size_flags(SIZE_EXPAND_FILL);
Expand Down Expand Up @@ -1330,9 +1333,9 @@ EditorFileDialog::EditorFileDialog() {
makedir->connect("pressed", this, "_make_dir");
pathhb->add_child(makedir);

list_hb = memnew(HBoxContainer);
list_hb = memnew(HSplitContainer);

vbc->add_margin_child(TTR("Path:"), pathhb);
vbc->add_child(pathhb);
vbc->add_child(list_hb);
list_hb->set_v_size_flags(SIZE_EXPAND_FILL);

Expand Down
3 changes: 2 additions & 1 deletion editor/editor_file_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "scene/gui/item_list.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
#include "scene/gui/split_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
/**
Expand Down Expand Up @@ -92,7 +93,7 @@ class EditorFileDialog : public ConfirmationDialog {
ItemList *item_list;
TextureRect *preview;
VBoxContainer *preview_vb;
HBoxContainer *list_hb;
HSplitContainer *list_hb;
LineEdit *file;
AcceptDialog *mkdirerr;
AcceptDialog *exterr;
Expand Down
9 changes: 9 additions & 0 deletions editor/editor_fonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ void editor_register_fonts(Ref<Theme> p_theme) {

p_theme->set_font("output_source", "EditorFonts", df_output_code);

Ref<DynamicFont> df_text_editor_status_code;
df_output_code.instance();
df_output_code->set_size(14 * EDSCALE);
df_output_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE);
df_output_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE);
df_output_code->set_font_data(dfmono);
MAKE_FALLBACKS(df_output_code);
p_theme->set_font("status_source", "EditorFonts", df_output_code);

//replace default theme
Ref<Texture> di;
Ref<StyleBox> ds;
Expand Down
4 changes: 2 additions & 2 deletions editor/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/quit_confirmation", true);

_initial_set("interface/theme/preset", 0);
hints["interface/theme/preset"] = PropertyInfo(Variant::INT, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Grey,Godot 2,Arc,Light,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
hints["interface/theme/preset"] = PropertyInfo(Variant::INT, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Grey,Godot 2,Arc,Light,Alien,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/theme/icon_and_font_color", 0);
hints["interface/theme/icon_and_font_color"] = PropertyInfo(Variant::INT, "interface/theme/icon_and_font_color", PROPERTY_HINT_ENUM, "Auto,Dark,Light", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/theme/base_color", Color::html("#323b4f"));
Expand Down Expand Up @@ -668,7 +668,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/grid_map/pick_distance", 5000.0);

_initial_set("editors/3d/grid_color", Color::html("808080"));
hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);

_initial_set("editors/3d/default_fov", 55.0);
_initial_set("editors/3d/default_z_near", 0.1);
Expand Down
Loading

0 comments on commit 15986ea

Please sign in to comment.