@ -140,8 +140,8 @@ void Button::_notification(int p_what) {
|
||||
|
||||
if (has_focus()) {
|
||||
|
||||
Ref<StyleBox> style = get_stylebox("focus");
|
||||
style->draw(ci, Rect2(Point2(), size));
|
||||
Ref<StyleBox> style2 = get_stylebox("focus");
|
||||
style2->draw(ci, Rect2(Point2(), size));
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font");
|
||||
|
||||
@ -221,8 +221,8 @@ void GraphEdit::_graph_node_raised(Node *p_gn) {
|
||||
}
|
||||
int first_not_comment = 0;
|
||||
for (int i = 0; i < get_child_count(); i++) {
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
|
||||
if (gn && !gn->is_comment()) {
|
||||
GraphNode *gn2 = Object::cast_to<GraphNode>(get_child(i));
|
||||
if (gn2 && !gn2->is_comment()) {
|
||||
first_not_comment = i;
|
||||
break;
|
||||
}
|
||||
@ -958,33 +958,33 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||
previus_selected.clear();
|
||||
for (int i = get_child_count() - 1; i >= 0; i--) {
|
||||
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
|
||||
if (!gn || !gn->is_selected())
|
||||
GraphNode *gn2 = Object::cast_to<GraphNode>(get_child(i));
|
||||
if (!gn2 || !gn2->is_selected())
|
||||
continue;
|
||||
|
||||
previus_selected.push_back(gn);
|
||||
previus_selected.push_back(gn2);
|
||||
}
|
||||
} else if (b->get_shift()) {
|
||||
box_selection_mode_aditive = false;
|
||||
previus_selected.clear();
|
||||
for (int i = get_child_count() - 1; i >= 0; i--) {
|
||||
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
|
||||
if (!gn || !gn->is_selected())
|
||||
GraphNode *gn2 = Object::cast_to<GraphNode>(get_child(i));
|
||||
if (!gn2 || !gn2->is_selected())
|
||||
continue;
|
||||
|
||||
previus_selected.push_back(gn);
|
||||
previus_selected.push_back(gn2);
|
||||
}
|
||||
} else {
|
||||
box_selection_mode_aditive = true;
|
||||
previus_selected.clear();
|
||||
for (int i = get_child_count() - 1; i >= 0; i--) {
|
||||
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
|
||||
if (!gn)
|
||||
GraphNode *gn2 = Object::cast_to<GraphNode>(get_child(i));
|
||||
if (!gn2)
|
||||
continue;
|
||||
|
||||
gn->set_selected(false);
|
||||
gn2->set_selected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1114,13 +1114,13 @@ void ItemList::_notification(int p_what) {
|
||||
|
||||
int max_len = -1;
|
||||
|
||||
Vector2 size = font->get_string_size(items[i].text);
|
||||
Vector2 size2 = font->get_string_size(items[i].text);
|
||||
if (fixed_column_width)
|
||||
max_len = fixed_column_width;
|
||||
else if (same_column_width)
|
||||
max_len = items[i].rect_cache.size.x;
|
||||
else
|
||||
max_len = size.x;
|
||||
max_len = size2.x;
|
||||
|
||||
Color modulate = items[i].selected ? font_color_selected : (items[i].custom_fg != Color() ? items[i].custom_fg : font_color);
|
||||
if (items[i].disabled)
|
||||
@ -1170,12 +1170,12 @@ void ItemList::_notification(int p_what) {
|
||||
} else {
|
||||
|
||||
if (fixed_column_width > 0)
|
||||
size.x = MIN(size.x, fixed_column_width);
|
||||
size2.x = MIN(size2.x, fixed_column_width);
|
||||
|
||||
if (icon_mode == ICON_MODE_TOP) {
|
||||
text_ofs.x += (items[i].rect_cache.size.width - size.x) / 2;
|
||||
text_ofs.x += (items[i].rect_cache.size.width - size2.x) / 2;
|
||||
} else {
|
||||
text_ofs.y += (items[i].rect_cache.size.height - size.y) / 2;
|
||||
text_ofs.y += (items[i].rect_cache.size.height - size2.y) / 2;
|
||||
}
|
||||
|
||||
text_ofs.y += font->get_ascent();
|
||||
|
||||
@ -519,9 +519,9 @@ void PopupMenu::_notification(int p_what) {
|
||||
|
||||
if (items[i].accel || (items[i].shortcut.is_valid() && items[i].shortcut->is_valid())) {
|
||||
//accelerator
|
||||
String text = _get_accel_text(i);
|
||||
item_ofs.x = size.width - style->get_margin(MARGIN_RIGHT) - font->get_string_size(text).width;
|
||||
font->draw(ci, item_ofs + Point2(0, Math::floor((h - font_h) / 2.0)), text, i == mouse_over ? font_color_hover : font_color_accel);
|
||||
String text2 = _get_accel_text(i);
|
||||
item_ofs.x = size.width - style->get_margin(MARGIN_RIGHT) - font->get_string_size(text2).width;
|
||||
font->draw(ci, item_ofs + Point2(0, Math::floor((h - font_h) / 2.0)), text2, i == mouse_over ? font_color_hover : font_color_accel);
|
||||
}
|
||||
|
||||
items.write[i]._ofs_cache = ofs.y;
|
||||
|
||||
@ -544,7 +544,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
|
||||
Vector2 draw_ofs = Point2(wofs, y);
|
||||
Color font_color_shadow = get_color("font_color_shadow");
|
||||
bool use_outline = get_constant("shadow_as_outline");
|
||||
Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
|
||||
Point2 shadow_ofs2(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
|
||||
|
||||
if (p_mode == PROCESS_CACHE) {
|
||||
|
||||
@ -568,7 +568,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
|
||||
|
||||
for (int i = 0; i < frame->lines.size(); i++) {
|
||||
|
||||
_process_line(frame, Point2(), ly, available_width, i, PROCESS_CACHE, cfont, Color(), font_color_shadow, use_outline, shadow_ofs);
|
||||
_process_line(frame, Point2(), ly, available_width, i, PROCESS_CACHE, cfont, Color(), font_color_shadow, use_outline, shadow_ofs2);
|
||||
table->columns.write[column].min_width = MAX(table->columns[column].min_width, frame->lines[i].minimum_width);
|
||||
table->columns.write[column].max_width = MAX(table->columns[column].max_width, frame->lines[i].maximum_width);
|
||||
}
|
||||
@ -641,7 +641,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
|
||||
for (int i = 0; i < frame->lines.size(); i++) {
|
||||
|
||||
int ly = 0;
|
||||
_process_line(frame, Point2(), ly, table->columns[column].width, i, PROCESS_CACHE, cfont, Color(), font_color_shadow, use_outline, shadow_ofs);
|
||||
_process_line(frame, Point2(), ly, table->columns[column].width, i, PROCESS_CACHE, cfont, Color(), font_color_shadow, use_outline, shadow_ofs2);
|
||||
frame->lines.write[i].height_cache = ly; //actual height
|
||||
frame->lines.write[i].height_accum_cache = ly; //actual height
|
||||
}
|
||||
@ -674,9 +674,9 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
|
||||
|
||||
if (visible) {
|
||||
if (p_mode == PROCESS_DRAW) {
|
||||
nonblank_line_count += _process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_DRAW, cfont, ccolor, font_color_shadow, use_outline, shadow_ofs);
|
||||
nonblank_line_count += _process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_DRAW, cfont, ccolor, font_color_shadow, use_outline, shadow_ofs2);
|
||||
} else if (p_mode == PROCESS_POINTER) {
|
||||
_process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_POINTER, cfont, ccolor, font_color_shadow, use_outline, shadow_ofs, p_click_pos, r_click_item, r_click_char, r_outside);
|
||||
_process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_POINTER, cfont, ccolor, font_color_shadow, use_outline, shadow_ofs2, p_click_pos, r_click_item, r_click_char, r_outside);
|
||||
if (r_click_item && *r_click_item) {
|
||||
RETURN; // exit early
|
||||
}
|
||||
|
||||
@ -1384,8 +1384,8 @@ void TextEdit::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
Size2 size = Size2(max_w, sc * font->get_height() + spacing);
|
||||
Size2 minsize = size + sb->get_minimum_size();
|
||||
Size2 size2 = Size2(max_w, sc * font->get_height() + spacing);
|
||||
Size2 minsize = size2 + sb->get_minimum_size();
|
||||
|
||||
if (completion_hint_offset == -0xFFFF) {
|
||||
completion_hint_offset = cursor_pos.x - offset;
|
||||
@ -1717,10 +1717,10 @@ void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) co
|
||||
col = get_char_pos_for_line(colx, row, wrap_index);
|
||||
if (is_wrap_enabled() && wrap_index < times_line_wraps(row)) {
|
||||
// move back one if we are at the end of the row
|
||||
Vector<String> rows = get_wrap_rows_text(row);
|
||||
Vector<String> rows2 = get_wrap_rows_text(row);
|
||||
int row_end_col = 0;
|
||||
for (int i = 0; i < wrap_index + 1; i++) {
|
||||
row_end_col += rows[i].length();
|
||||
row_end_col += rows2[i].length();
|
||||
}
|
||||
if (col >= row_end_col)
|
||||
col -= 1;
|
||||
@ -3375,20 +3375,20 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i
|
||||
String preinsert_text = text[p_line].substr(0, p_char);
|
||||
String postinsert_text = text[p_line].substr(p_char, text[p_line].size());
|
||||
|
||||
for (int i = 0; i < substrings.size(); i++) {
|
||||
for (int j = 0; j < substrings.size(); j++) {
|
||||
//insert the substrings
|
||||
|
||||
if (i == 0) {
|
||||
if (j == 0) {
|
||||
|
||||
text.set(p_line, preinsert_text + substrings[i]);
|
||||
text.set(p_line, preinsert_text + substrings[j]);
|
||||
} else {
|
||||
|
||||
text.insert(p_line + i, substrings[i]);
|
||||
text.insert(p_line + j, substrings[j]);
|
||||
}
|
||||
|
||||
if (i == substrings.size() - 1) {
|
||||
if (j == substrings.size() - 1) {
|
||||
|
||||
text.set(p_line + i, text[p_line + i] + postinsert_text);
|
||||
text.set(p_line + j, text[p_line + j] + postinsert_text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -206,8 +206,8 @@ void TextureButton::_notification(int p_what) {
|
||||
Size2 scaleSize(size.width / tex_size.width, size.height / tex_size.height);
|
||||
float scale = scaleSize.width > scaleSize.height ? scaleSize.width : scaleSize.height;
|
||||
Size2 scaledTexSize = tex_size * scale;
|
||||
Point2 ofs = ((scaledTexSize - size) / scale).abs() / 2.0f;
|
||||
_texture_region = Rect2(ofs, size / scale);
|
||||
Point2 ofs2 = ((scaledTexSize - size) / scale).abs() / 2.0f;
|
||||
_texture_region = Rect2(ofs2, size / scale);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1071,11 +1071,11 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
|
||||
int font_ascent = font->get_ascent();
|
||||
|
||||
int ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
|
||||
int skip = 0;
|
||||
int skip2 = 0;
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
|
||||
if (skip) {
|
||||
skip--;
|
||||
if (skip2) {
|
||||
skip2--;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1102,7 +1102,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
|
||||
while (i + plus < columns.size() && !p_item->cells[i + plus].editable && p_item->cells[i + plus].mode == TreeItem::CELL_MODE_STRING && p_item->cells[i + plus].text == "" && p_item->cells[i + plus].icon.is_null()) {
|
||||
w += get_column_width(i + plus);
|
||||
plus++;
|
||||
skip++;
|
||||
skip2++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1165,8 +1165,8 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
|
||||
cache.selected->draw(ci, r);
|
||||
}
|
||||
if (text_editor->is_visible_in_tree()) {
|
||||
Vector2 ofs(0, (text_editor->get_size().height - r.size.height) / 2);
|
||||
text_editor->set_position(get_global_position() + r.position - ofs);
|
||||
Vector2 ofs2(0, (text_editor->get_size().height - r.size.height) / 2);
|
||||
text_editor->set_position(get_global_position() + r.position - ofs2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2698,8 +2698,8 @@ bool Tree::edit_selected() {
|
||||
popup_menu->clear();
|
||||
for (int i = 0; i < c.text.get_slice_count(","); i++) {
|
||||
|
||||
String s = c.text.get_slicec(',', i);
|
||||
popup_menu->add_item(s.get_slicec(':', 0), s.get_slicec(':', 1).empty() ? i : s.get_slicec(':', 1).to_int());
|
||||
String s2 = c.text.get_slicec(',', i);
|
||||
popup_menu->add_item(s2.get_slicec(':', 0), s2.get_slicec(':', 1).empty() ? i : s2.get_slicec(':', 1).to_int());
|
||||
}
|
||||
|
||||
popup_menu->set_size(Size2(rect.size.width, 0));
|
||||
@ -2951,14 +2951,14 @@ void Tree::_notification(int p_what) {
|
||||
if (show_column_titles) {
|
||||
|
||||
//title buttons
|
||||
int ofs = cache.bg->get_margin(MARGIN_LEFT);
|
||||
int ofs2 = cache.bg->get_margin(MARGIN_LEFT);
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
|
||||
Ref<StyleBox> sb = (cache.click_type == Cache::CLICK_TITLE && cache.click_index == i) ? cache.title_button_pressed : ((cache.hover_type == Cache::CLICK_TITLE && cache.hover_index == i) ? cache.title_button_hover : cache.title_button);
|
||||
Ref<Font> f = cache.tb_font;
|
||||
Rect2 tbrect = Rect2(ofs - cache.offset.x, bg->get_margin(MARGIN_TOP), get_column_width(i), tbh);
|
||||
Rect2 tbrect = Rect2(ofs2 - cache.offset.x, bg->get_margin(MARGIN_TOP), get_column_width(i), tbh);
|
||||
sb->draw(ci, tbrect);
|
||||
ofs += tbrect.size.width;
|
||||
ofs2 += tbrect.size.width;
|
||||
//text
|
||||
int clip_w = tbrect.size.width - sb->get_minimum_size().width;
|
||||
f->draw_halign(ci, tbrect.position + Point2i(sb->get_offset().x, (tbrect.size.height - f->get_height()) / 2 + f->get_ascent()), HALIGN_CENTER, clip_w, columns[i].title, cache.title_button_color);
|
||||
|
||||
Reference in New Issue
Block a user