Esempio n. 1
0
void ScenesDock::_dir_selected() {

	TreeItem *ti = tree->get_selected();
	if (!ti)
		return;
	String dir = ti->get_metadata(0);
	bool found=false;
	Vector<String> favorites = EditorSettings::get_singleton()->get_favorite_dirs();
	for(int i=0;i<favorites.size();i++) {

		if (favorites[i]==dir) {
			found=true;
			break;
		}
	}


	button_favorite->set_pressed(found);
	if (ti->get_parent() && ti->get_parent()->get_parent()==tree->get_root() && !ti->get_parent()->get_prev()) {

		//a favorite!!!
		button_fav_up->set_disabled(!ti->get_prev());
		button_fav_down->set_disabled(!ti->get_next());
	} else {
		button_fav_up->set_disabled(true);
		button_fav_down->set_disabled(true);


	}

	if (!split_mode) {
		_open_pressed(); //go directly to dir
	}

}
Esempio n. 2
0
void ScenesDock::open(const String& p_path) {


	String npath;
	String nfile;

	if (p_path.ends_with("/")) {

		if (p_path!="res://")
			npath=p_path.substr(0,p_path.length()-1);
		else
			npath="res://";
	} else {
		nfile=p_path.get_file();
		npath=p_path.get_base_dir();
	}

	path=npath;

	if (tree_mode && nfile=="") {
		_update_tree();
		tree->grab_focus();
		tree->call_deferred("ensure_cursor_is_visible");
		_push_to_history();
		return;
	} else if (tree_mode){
		_update_tree();
		tree->grab_focus();
		tree->ensure_cursor_is_visible();
		_open_pressed();
		current_path->set_text(path);
	} else {
		_update_files(false);
		_push_to_history();
	}

	for(int i=0;i<files->get_item_count();i++) {

		String md = files->get_item_metadata(i);
		if (md==p_path) {
			files->select(i,true);
			files->ensure_current_is_visible();
			break;
		}
	}

}
Esempio n. 3
0
void FileSystemDock::_dir_selected() {

	TreeItem *ti = tree->get_selected();
	if (!ti)
		return;
	String dir = ti->get_metadata(0);
	bool found=false;
	Vector<String> favorites = EditorSettings::get_singleton()->get_favorite_dirs();
	for(int i=0;i<favorites.size();i++) {

		if (favorites[i]==dir) {
			found=true;
			break;
		}
	}


	button_favorite->set_pressed(found);

	if (!split_mode) {
		_open_pressed(); //go directly to dir
	}

}
Esempio n. 4
0
void ScenesDock::_select_file(int p_idx) {

	files->select(p_idx,true);
	_open_pressed();
}