void ResourcePreloaderEditor::_notification(int p_what) { if (p_what == NOTIFICATION_PHYSICS_PROCESS) { } if (p_what == NOTIFICATION_ENTER_TREE) { load->set_icon(get_icon("Folder", "EditorIcons")); } if (p_what == NOTIFICATION_READY) { //NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true); } if (p_what == NOTIFICATION_DRAW) { } }
void EditorFileDialog::_post_popup() { ConfirmationDialog::_post_popup(); if (invalidated) { update_file_list(); invalidated = false; } if (mode == MODE_SAVE_FILE) file->grab_focus(); else item_list->grab_focus(); if (is_visible_in_tree() && get_current_file() != "") _request_single_thumbnail(get_current_dir().plus_file(get_current_file())); if (is_visible_in_tree()) { Ref<Texture> folder = get_icon("folder", "FileDialog"); recent->clear(); bool res = access == ACCESS_RESOURCES; Vector<String> recentd = EditorSettings::get_singleton()->get_recent_dirs(); for (int i = 0; i < recentd.size(); i++) { bool cres = recentd[i].begins_with("res://"); if (cres != res) continue; String name = recentd[i]; if (res && name == "res://") { name = "/"; } else { name = name.get_file() + "/"; } //print_line("file: "+name); recent->add_item(name, folder); recent->set_item_metadata(recent->get_item_count() - 1, recentd[i]); } local_history.clear(); local_history_pos = -1; _push_history(); _update_favorites(); } set_process_unhandled_input(true); }
void Polygon2DEditor::_uv_draw() { Ref<Texture> base_tex = node->get_texture(); if (base_tex.is_null()) return; Matrix32 mtx; mtx.elements[2]=-uv_draw_ofs; mtx.scale_basis(Vector2(uv_draw_zoom,uv_draw_zoom)); VS::get_singleton()->canvas_item_set_clip(uv_edit_draw->get_canvas_item(),true); VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(),mtx); uv_edit_draw->draw_texture(base_tex,Point2()); VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(),Matrix32()); DVector<Vector2> uvs = node->get_uv(); Ref<Texture> handle = get_icon("EditorHandle","EditorIcons"); Rect2 rect(Point2(),mtx.basis_xform(base_tex->get_size())); rect.expand_to(mtx.basis_xform(uv_edit_draw->get_size())); for(int i=0;i<uvs.size();i++) { int next = (i+1)%uvs.size(); uv_edit_draw->draw_line(mtx.xform(uvs[i]),mtx.xform(uvs[next]),Color(0.9,0.5,0.5),2); uv_edit_draw->draw_texture(handle,mtx.xform(uvs[i])-handle->get_size()*0.5); rect.expand_to(mtx.basis_xform(uvs[i])); } rect=rect.grow(200); updating_uv_scroll=true; uv_hscroll->set_min(rect.pos.x); uv_hscroll->set_max(rect.pos.x+rect.size.x); uv_hscroll->set_page(uv_edit_draw->get_size().x); uv_hscroll->set_val(uv_draw_ofs.x); uv_hscroll->set_step(0.001); uv_vscroll->set_min(rect.pos.y); uv_vscroll->set_max(rect.pos.y+rect.size.y); uv_vscroll->set_page(uv_edit_draw->get_size().y); uv_vscroll->set_val(uv_draw_ofs.y); uv_vscroll->set_step(0.001); updating_uv_scroll=false; }
static void get_size_compact( TorrentCellRenderer * cell, GtkWidget * widget, gint * width, gint * height ) { int xpad, ypad; GtkRequisition icon_size; GtkRequisition name_size; GtkRequisition stat_size; const char * name; GdkPixbuf * icon; struct TorrentCellRendererPrivate * p = cell->priv; const tr_torrent * tor = p->tor; const tr_stat * st = tr_torrentStatCached( (tr_torrent*)tor ); GString * gstr_stat = p->gstr1; icon = get_icon( tor, COMPACT_ICON_SIZE, widget ); name = tr_torrentName( tor ); g_string_truncate( gstr_stat, 0 ); getShortStatusString( gstr_stat, tor, st, p->upload_speed_KBps, p->download_speed_KBps ); gtk_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad ); /* get the idealized cell dimensions */ g_object_set( p->icon_renderer, "pixbuf", icon, NULL ); gtr_cell_renderer_get_preferred_size( p->icon_renderer, widget, NULL, &icon_size ); g_object_set( p->text_renderer, "text", name, "ellipsize", PANGO_ELLIPSIZE_NONE, "scale", 1.0, NULL ); gtr_cell_renderer_get_preferred_size( p->text_renderer, widget, NULL, &name_size ); g_object_set( p->text_renderer, "text", gstr_stat->str, "scale", SMALL_SCALE, NULL ); gtr_cell_renderer_get_preferred_size( p->text_renderer, widget, NULL, &stat_size ); /** *** LAYOUT **/ #define BAR_WIDTH 50 if( width != NULL ) *width = xpad * 2 + icon_size.width + GUI_PAD + name_size.width + GUI_PAD + BAR_WIDTH + GUI_PAD + stat_size.width; if( height != NULL ) *height = ypad * 2 + MAX( name_size.height, p->bar_height ); /* cleanup */ g_object_unref( icon ); }
void FileDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { refresh->set_icon(get_icon("reload")); } if (p_what==NOTIFICATION_DRAW) { //RID ci = get_canvas_item(); //get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); } if (p_what==NOTIFICATION_POPUP_HIDE) { set_process_unhandled_input(false); } }
void EditorLog::add_message(const String &p_msg, bool p_error) { if (p_error) { Ref<Texture> icon = get_icon("Error", "EditorIcons"); log->add_image(icon); //button->set_icon(icon); log->push_color(get_color("fg_error", "Editor")); } else { //button->set_icon(Ref<Texture>()); } log->add_newline(); log->add_text(p_msg); //button->set_text(p_msg); if (p_error) log->pop(); }
void NavigationPolygonEditor::_canvas_draw() { if (!node) return; Control *vpc = canvas_item_editor->get_viewport_control(); if (node->get_navigation_polygon().is_null()) return; Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); for(int j=-1;j<node->get_navigation_polygon()->get_outline_count();j++) { Vector<Vector2> poly; if (wip_active && j==edited_outline) { poly=wip; } else { if (j==-1) continue; poly = Variant(node->get_navigation_polygon()->get_outline(j)); } for(int i=0;i<poly.size();i++) { Vector2 p,p2; p = (j==edited_outline && i==edited_point) ? edited_point_pos : poly[i]; if (j==edited_outline && ((wip_active && i==poly.size()-1) || (((i+1)%poly.size())==edited_point))) p2=edited_point_pos; else p2 = poly[(i+1)%poly.size()]; Vector2 point = xform.xform(p); Vector2 next_point = xform.xform(p2); Color col=Color(1,0.3,0.1,0.8); vpc->draw_line(point,next_point,col,2); vpc->draw_texture(handle,point-handle->get_size()*0.5); } } }
Size2 Tabs::get_minimum_size() const { Ref<StyleBox> tab_bg = get_stylebox("tab_bg"); Ref<StyleBox> tab_fg = get_stylebox("tab_fg"); Ref<Font> font = get_font("font"); Size2 ms(0, MAX(tab_bg->get_minimum_size().height, tab_fg->get_minimum_size().height) + font->get_height()); for (int i = 0; i < tabs.size(); i++) { Ref<Texture> tex = tabs[i].icon; if (tex.is_valid()) { ms.height = MAX(ms.height, tex->get_size().height); if (tabs[i].text != "") ms.width += get_constant("hseparation"); } ms.width += font->get_string_size(tabs[i].text).width; if (current == i) ms.width += tab_fg->get_minimum_size().width; else ms.width += tab_bg->get_minimum_size().width; if (tabs[i].right_button.is_valid()) { Ref<Texture> rb = tabs[i].right_button; Size2 bms = rb->get_size(); bms.width += get_constant("hseparation"); ms.width += bms.width; ms.height = MAX(bms.height + tab_bg->get_minimum_size().height, ms.height); } if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) { Ref<Texture> cb = get_icon("close"); Size2 bms = cb->get_size(); bms.width += get_constant("hseparation"); ms.width += bms.width; ms.height = MAX(bms.height + tab_bg->get_minimum_size().height, ms.height); } } ms.width = 0; //TODO: should make this optional return ms; }
void TileMapEditor::_notification(int p_what) { switch(p_what) { case NOTIFICATION_ENTER_TREE: { transp->set_icon(get_icon("Transpose","EditorIcons")); mirror_x->set_icon(get_icon("MirrorX","EditorIcons")); mirror_y->set_icon(get_icon("MirrorY","EditorIcons")); rotate_0->set_icon(get_icon("Rotate0","EditorIcons")); rotate_90->set_icon(get_icon("Rotate90","EditorIcons")); rotate_180->set_icon(get_icon("Rotate180","EditorIcons")); rotate_270->set_icon(get_icon("Rotate270","EditorIcons")); } break; } }
void LightOccluder2DEditor::_canvas_draw() { if (!node || !node->get_occluder_polygon().is_valid()) return; Control *vpc = canvas_item_editor->get_viewport_control(); Vector<Vector2> poly; if (wip_active) poly=wip; else poly=Variant(node->get_occluder_polygon()->get_polygon()); Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); int len = poly.size(); for(int i=0;i<poly.size();i++) { Vector2 p,p2; p = i==edited_point ? edited_point_pos : poly[i]; if ((wip_active && i==poly.size()-1) || (((i+1)%poly.size())==edited_point)) p2=edited_point_pos; else p2 = poly[(i+1)%poly.size()]; Vector2 point = xform.xform(p); Vector2 next_point = xform.xform(p2); Color col=Color(1,0.3,0.1,0.8); if (i==poly.size()-1 && (!node->get_occluder_polygon()->is_closed() || wip_active)) { } else { vpc->draw_line(point,next_point,col,2); } vpc->draw_texture(handle,point-handle->get_size()*0.5); } }
void ResourcePreloaderEditor::_update_library() { tree->clear(); tree->set_hide_root(true); TreeItem *root = tree->create_item(NULL); List<StringName> rnames; preloader->get_resource_list(&rnames); List<String> names; for(List<StringName>::Element *E=rnames.front();E;E=E->next()) { names.push_back(E->get()); } names.sort(); for(List<String>::Element *E=names.front();E;E=E->next()) { TreeItem *ti = tree->create_item(root); ti->set_cell_mode(0,TreeItem::CELL_MODE_STRING); ti->set_editable(0,true); ti->set_selectable(0,true); ti->set_text(0,E->get()); ti->set_metadata(0,E->get()); RES r = preloader->get_resource(E->get()); ERR_CONTINUE(r.is_null()); ti->set_tooltip(0,r->get_path()); String type = r->get_type(); ti->set_text(1,type); ti->set_selectable(1,false); if (has_icon(type,"EditorIcons")) ti->set_icon( 1, get_icon(type,"EditorIcons") ); } //player->add_resource("default",resource); }
void SplitContainer::_notification(int p_what) { switch(p_what) { case NOTIFICATION_SORT_CHILDREN: { _resort(); } break; case NOTIFICATION_MOUSE_ENTER: { mouse_inside=true; update(); } break; case NOTIFICATION_MOUSE_EXIT: { mouse_inside=false; update(); } break; case NOTIFICATION_DRAW: { if (!_getch(0) || !_getch(1)) return; if (collapsed || (!mouse_inside && get_constant("autohide"))) return; int sep=dragger_visible?get_constant("separation"):0; Ref<Texture> tex = get_icon("grabber"); Size2 size=get_size(); if (vertical) { //draw_style_box( get_stylebox("bg"), Rect2(0,middle_sep,get_size().width,sep)); if (dragger_visible) draw_texture(tex,Point2i((size.x-tex->get_width())/2,middle_sep+(sep-tex->get_height())/2)); } else { //draw_style_box( get_stylebox("bg"), Rect2(middle_sep,0,sep,get_size().height)); if (dragger_visible) draw_texture(tex,Point2i(middle_sep+(sep-tex->get_width())/2,(size.y-tex->get_height())/2)); } } break; } }
bool GraphNode::has_point(const Point2& p_point) const { if (comment) { Ref<StyleBox> comment = get_stylebox("comment"); Ref<Texture> resizer =get_icon("resizer"); if (Rect2(get_size()-resizer->get_size(), resizer->get_size()).has_point(p_point)) { return true; } if (Rect2(0,0,get_size().width,comment->get_margin(MARGIN_TOP)).has_point(p_point)) { return true; } return false; } else { return Control::has_point(p_point); } }
void ColorPicker::_hsv_draw(int p_which, Control *c) { if (!c) return; if (p_which == 0) { Vector<Point2> points; points.push_back(Vector2()); points.push_back(Vector2(c->get_size().x, 0)); points.push_back(c->get_size()); points.push_back(Vector2(0, c->get_size().y)); Vector<Color> colors; colors.push_back(Color(1, 1, 1, 1)); colors.push_back(Color(1, 1, 1, 1)); colors.push_back(Color(0, 0, 0, 1)); colors.push_back(Color(0, 0, 0, 1)); c->draw_polygon(points, colors); Vector<Color> colors2; Color col = color; col.set_hsv(h, 1, 1); col.a = 0; colors2.push_back(col); col.a = 1; colors2.push_back(col); col.set_hsv(h, 1, 0); colors2.push_back(col); col.a = 0; colors2.push_back(col); c->draw_polygon(points, colors2); int x = CLAMP(c->get_size().x * s, 0, c->get_size().x); int y = CLAMP(c->get_size().y - c->get_size().y * v, 0, c->get_size().y); col = color; col.a = 1; c->draw_line(Point2(x, 0), Point2(x, c->get_size().y), col.inverted()); c->draw_line(Point2(0, y), Point2(c->get_size().x, y), col.inverted()); c->draw_line(Point2(x, y), Point2(x, y), Color(1, 1, 1), 2); } else if (p_which == 1) { Ref<Texture> hue = get_icon("color_hue", "ColorPicker"); c->draw_texture_rect(hue, Rect2(Point2(), c->get_size())); int y = c->get_size().y - c->get_size().y * (1.0 - h); Color col = Color(); col.set_hsv(h, 1, 1); c->draw_line(Point2(0, y), Point2(c->get_size().x, y), col.inverted()); } }
Point2 AnimationTreeEditor::_get_slot_pos(const StringName& p_node,bool p_input,int p_slot) { Ref<StyleBox> style = get_stylebox("panel","PopupMenu"); Ref<Font> font = get_font("font","PopupMenu"); Ref<Texture> slot_icon = get_icon("NodeRealSlot","EditorIcons"); Size2 size=get_node_size(p_node); Point2 pos = anim_tree->node_get_pos(p_node); if (click_type==CLICK_NODE && click_node==p_node) { pos+=click_motion-click_pos; if (pos.x<5) pos.x=5; if (pos.y<5) pos.y=5; } pos-=Point2(h_scroll->get_val(),v_scroll->get_val()); float w = size.width-style->get_minimum_size().width; float h = font->get_height()+get_constant("vseparation","PopupMenu"); pos+=style->get_offset(); pos.y+=h*2; pos.y+=h*p_slot; pos+=Point2( -slot_icon->get_width()/2.0, h/2.0).floor(); if(!p_input) { pos.x+=w+slot_icon->get_width(); } return pos; }
void SceneTreeDock::_notification(int p_what) { switch(p_what) { case NOTIFICATION_READY: { if (!first_enter) break; first_enter=false; CanvasItemEditorPlugin *canvas_item_plugin = editor_data->get_editor("2D")->cast_to<CanvasItemEditorPlugin>(); if (canvas_item_plugin) { canvas_item_plugin->get_canvas_item_editor()->connect("item_lock_status_changed", scene_tree, "_update_tree"); canvas_item_plugin->get_canvas_item_editor()->connect("item_group_status_changed", scene_tree, "_update_tree"); scene_tree->connect("node_changed", canvas_item_plugin->get_canvas_item_editor()->get_viewport_control(), "update"); } static const char* button_names[TOOL_BUTTON_MAX]={ "New", "Add", "Replace", "Connect", "Groups", "Script", "MoveUp", "MoveDown", "Duplicate", "Reparent", "CreateNewSceneFrom", "MultiNodeEdit", "Remove", }; for(int i=0;i<TOOL_BUTTON_MAX;i++) tool_buttons[i]->set_icon(get_icon(button_names[i],"EditorIcons")); EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed",this,"_selection_changed"); } break; } }
void Path2DEditor::_canvas_draw() { if (!node) return ; if (!node->is_visible()) return; if (!node->get_curve().is_valid()) return ; Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); Size2 handle_size = handle->get_size(); Ref<Curve2D> curve = node->get_curve(); int len = curve->get_point_count(); Control *vpc = canvas_item_editor->get_viewport_control(); for(int i=0;i<len;i++) { Vector2 point = xform.xform(curve->get_point_pos(i)); vpc->draw_texture_rect(handle,Rect2(point-handle_size*0.5,handle_size),false,Color(1,1,1,1)); if (i<len-1) { Vector2 pointout = xform.xform(curve->get_point_pos(i)+curve->get_point_out(i)); vpc->draw_line(point,pointout,Color(0.5,0.5,1.0,0.8),1.0); vpc->draw_texture_rect(handle, Rect2(pointout-handle_size*0.5,handle_size),false,Color(1,0.5,1,0.3)); } if (i>0) { Vector2 pointin = xform.xform(curve->get_point_pos(i)+curve->get_point_in(i)); vpc->draw_line(point,pointin,Color(0.5,0.5,1.0,0.8),1.0); vpc->draw_texture_rect(handle, Rect2(pointin-handle_size*0.5,handle_size),false,Color(1,0.5,1,0.3)); } } }
void MonoBuildTab::on_build_exec_failed(const String &p_cause, const String &p_detailed) { build_exited = true; build_result = RESULT_ERROR; issues_list->clear(); String tooltip; tooltip += "Message: " + (p_detailed.length() ? p_detailed : p_cause); tooltip += "\nType: error"; int line_break_idx = p_cause.find("\n"); issues_list->add_item(line_break_idx == -1 ? p_cause : p_cause.substr(0, line_break_idx), get_icon("Error", "EditorIcons")); int index = issues_list->get_item_count() - 1; issues_list->set_item_tooltip(index, tooltip); MonoBottomPanel::get_singleton()->raise_build_tab(this); }
Size2 SplitContainer::get_minimum_size() const { /* Calculate MINIMUM SIZE */ Size2i minimum; int sep=get_constant("separation"); Ref<Texture> g = get_icon("grabber"); sep=dragger_visible?MAX(sep,vertical?g->get_height():g->get_width()):0; for(int i=0;i<2;i++) { if (!_getch(i)) break; if (i==1) { if (vertical) minimum.height+=sep; else minimum.width+=sep; } Size2 ms = _getch(i)->get_combined_minimum_size(); if (vertical) { minimum.height+=ms.height; minimum.width=MAX(minimum.width,ms.width); } else { minimum.width+=ms.width; minimum.height=MAX(minimum.height,ms.height); } } return minimum; }
int Tabs::get_tab_width(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, tabs.size(), 0); Ref<StyleBox> tab_bg = get_stylebox("tab_bg"); Ref<StyleBox> tab_fg = get_stylebox("tab_fg"); Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled"); Ref<Font> font = get_font("font"); int x = 0; Ref<Texture> tex = tabs[p_idx].icon; if (tex.is_valid()) { x += tex->get_width(); if (tabs[p_idx].text != "") x += get_constant("hseparation"); } x += font->get_string_size(tabs[p_idx].text).width; if (tabs[p_idx].disabled) x += tab_disabled->get_minimum_size().width; else if (current == p_idx) x += tab_fg->get_minimum_size().width; else x += tab_bg->get_minimum_size().width; if (tabs[p_idx].right_button.is_valid()) { Ref<Texture> rb = tabs[p_idx].right_button; x += rb->get_width(); x += get_constant("hseparation"); } if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && p_idx == current)) { Ref<Texture> cb = get_icon("close"); x += cb->get_width(); x += get_constant("hseparation"); } return x; }
void CreateDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("confirmed", this, "_confirmed"); favorite->set_icon(get_icon("Favorites", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", this, "_confirmed"); } break; case NOTIFICATION_VISIBILITY_CHANGED: { if (is_visible_in_tree()) { search_box->call_deferred("grab_focus"); // still not visible search_box->select_all(); } } break; case NOTIFICATION_POPUP_HIDE: { EditorSettings::get_singleton()->set("interface/dialogs/create_new_node_bounds", get_rect()); } break; } }
void EditorSubScene::_fill_tree(Node* p_node,TreeItem *p_parent) { TreeItem *it = tree->create_item(p_parent); it->set_metadata(0,p_node); it->set_text(0,p_node->get_name()); it->set_editable(0,false); it->set_selectable(0,true); if (has_icon(p_node->get_type(),"EditorIcons")) { it->set_icon(0,get_icon(p_node->get_type(),"EditorIcons")); } for(int i=0;i<p_node->get_child_count();i++) { Node *c = p_node->get_child(i); if (c->get_owner()!=scene) continue; _fill_tree(c,it); } }
void CreateDialog::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { connect("confirmed", this, "_confirmed"); favorite->set_icon(get_icon("Favorites", "EditorIcons")); } if (p_what == NOTIFICATION_EXIT_TREE) { disconnect("confirmed", this, "_confirmed"); } if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { if (is_visible()) { search_box->call_deferred("grab_focus"); // still not visible search_box->select_all(); } } }
static int read_option(int fd, struct device_context *dev_ctx) { struct boot_option *opt = malloc(sizeof(*opt)); twin_pixmap_t *icon; int index = -1; if (!opt) return TWIN_FALSE; if (!read_strings(fd, (*opt))) return TWIN_FALSE; LOG("got option: '%s'\n", opt->name); icon = get_icon(opt->icon_file); if (icon) index = pboot_add_option(dev_ctx->device_idx, opt->name, opt->description, icon, opt); return index != -1; }
void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root) { if (p_types.has(p_type)) return; if (!ObjectTypeDB::is_type(p_type,base) || p_type==base) return; String inherits=ObjectTypeDB::type_inherits_from(p_type); TreeItem *parent=p_root; if (inherits.length()) { if (!p_types.has(inherits)) { add_type(inherits,p_types,p_root); } if (p_types.has(inherits) ) parent=p_types[inherits]; } TreeItem *item = tree->create_item(parent); item->set_text(0,p_type); if (!ObjectTypeDB::can_instance(p_type)) { item->set_custom_color(0, Color(0.5,0.5,0.5) ); item->set_selectable(0,false); } if (has_icon(p_type,"EditorIcons")) { item->set_icon(0, get_icon(p_type,"EditorIcons")); } p_types[p_type]=item; }
void Polygon2DEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { button_uv->set_icon(get_icon("Uv", "EditorIcons")); uv_button[UV_MODE_EDIT_POINT]->set_icon(get_icon("ToolSelect", "EditorIcons")); uv_button[UV_MODE_MOVE]->set_icon(get_icon("ToolMove", "EditorIcons")); uv_button[UV_MODE_ROTATE]->set_icon(get_icon("ToolRotate", "EditorIcons")); uv_button[UV_MODE_SCALE]->set_icon(get_icon("ToolScale", "EditorIcons")); b_snap_grid->set_icon(get_icon("Grid", "EditorIcons")); b_snap_enable->set_icon(get_icon("SnapGrid", "EditorIcons")); uv_icon_zoom->set_texture(get_icon("Zoom", "EditorIcons")); } break; case NOTIFICATION_PHYSICS_PROCESS: { } break; } }
void SplitContainer::_notification(int p_what) { switch (p_what) { case NOTIFICATION_SORT_CHILDREN: { _resort(); } break; case NOTIFICATION_MOUSE_ENTER: { mouse_inside = true; update(); } break; case NOTIFICATION_MOUSE_EXIT: { mouse_inside = false; update(); } break; case NOTIFICATION_DRAW: { if (!_getch(0) || !_getch(1)) return; if (collapsed || (!mouse_inside && get_constant("autohide"))) return; int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_constant("separation") : 0; Ref<Texture> tex = get_icon("grabber"); Size2 size = get_size(); if (dragger_visibility == DRAGGER_VISIBLE) { if (vertical) draw_texture(tex, Point2i((size.x - tex->get_width()) / 2, middle_sep + (sep - tex->get_height()) / 2)); else draw_texture(tex, Point2i(middle_sep + (sep - tex->get_width()) / 2, (size.y - tex->get_height()) / 2)); } } break; } }
// ------------------------------------------------------- // artifact as it appears on the adventure map // ------------------------------------------------------- void t_adv_artifact::activate_trigger( t_army* army, t_adv_map_point const& point, t_direction direction, t_adventure_frame* frame ) { destroy(); // we should not be deleted by this, because the caller has a reference. if (!army->get_owner()->is_computer()) { army->add( m_artifact ); std::string text = m_artifact.get_pickup_text(); std::string name = m_artifact.get_name(); t_adventure_map* map = get_map(); t_adventure_map_window* map_window = frame->get_map_window(); t_level_map_point_2d location = get_position(); t_screen_point screen_point = get_screen_point( *map, *this, location ) - map_window->get_view_pos(); t_artifact_type type = m_artifact.get_icon(); t_bitmap_layer_ptr icon = get_icon( type ); //t_bitmap_layer_cache_window_ptr icon_window; t_counted_ptr<t_basic_dialog> dialog = new t_basic_dialog( frame ); dialog->add_ok_button(); //icon_window = new t_bitmap_layer_cache_window( icon, t_screen_point(0,0), dialog, false ); //icon_window->set_help_balloon_text( m_artifact.get_name() ); //icon_window->set_right_click_text( m_artifact.get_help_text() ); dialog->add_artifact( m_artifact, 1, true ); dialog->set_text( text ); //dialog->add_display_window( icon_window, name ); dialog->set_title( get_name() ); dialog->open( screen_point, true, k_align_bottom ); t_sound_cache music = get_music_playing(); stop_music(); get_dialog_sound( k_dialog_sound_treasure )->play( get_sound_volume() ); dialog->run_modal(); play_music( music ); } else ai_give_artifact_to_army( *army, m_artifact ); }
void EditorFileDialog::_update_favorites() { bool res = access==ACCESS_RESOURCES; String current = get_current_dir(); Ref<Texture> star = get_icon("Favorites","EditorIcons"); favorites->clear(); favorite->set_pressed(false); Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs(); for(int i=0;i<favorited.size();i++) { bool cres = favorited[i].begins_with("res://"); if (cres!=res) continue; String name = favorited[i]; bool setthis = name==current; if (res && name=="res://") { name="/"; } else { name=name.get_file()+"/"; } //print_line("file: "+name); favorites->add_item(name,star); favorites->set_item_metadata( favorites->get_item_count()-1,favorited[i]); if (setthis) { favorite->set_pressed(true); favorites->set_current(favorites->get_item_count()-1); } } }
bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> ¤t, bool p_only_scenes) { p_item->set_icon(0, get_icon("folder", "FileDialog")); p_item->set_text(0, p_dir->get_name() + "/"); bool used = false; for (int i = 0; i < p_dir->get_subdir_count(); i++) { TreeItem *subdir = include_files->create_item(p_item); if (_fill_tree(p_dir->get_subdir(i), subdir, current, p_only_scenes)) { used = true; } else { memdelete(subdir); } } for (int i = 0; i < p_dir->get_file_count(); i++) { String type = p_dir->get_file_type(i); if (p_only_scenes && type != "PackedScene") continue; TreeItem *file = include_files->create_item(p_item); file->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); file->set_text(0, p_dir->get_file(i)); String path = p_dir->get_file_path(i); file->set_icon(0, EditorNode::get_singleton()->get_class_icon(type)); file->set_editable(0, true); file->set_checked(0, current->has_export_file(path)); file->set_metadata(0, path); used = true; } return used; }