Exemple #1
0
void EditorFileDialog::_go_up() {

	dir_access->change_dir("..");
	update_file_list();
	update_dir();
	_push_history();
}
Exemple #2
0
void FileDialog::invalidate() {

	if (is_visible_in_tree()) {
		update_file_list();
		invalidated = false;
	} else {
		invalidated = true;
	}
}
void EditorFileDialog::_recent_selected(int p_idx) {

	Vector<String> recentd = EditorSettings::get_singleton()->get_recent_dirs();
	ERR_FAIL_INDEX(p_idx,recentd.size());

	dir_access->change_dir(recent->get_item_metadata(p_idx));
	update_file_list();
	update_dir();
	_push_history();
}
Exemple #4
0
void FileDialog::_post_popup() {

	ConfirmationDialog::_post_popup();
	if (invalidated) {
		update_file_list();
		invalidated=false;
	}
	if (mode==MODE_SAVE_FILE)
		file->grab_focus();
	else
		tree->grab_focus();

}
void EditorFileDialog::_go_back(){

	if (local_history_pos<=0) {
		return;
	}

	local_history_pos--;
	dir_access->change_dir(local_history[local_history_pos]);
	update_file_list();
	update_dir();

	dir_prev->set_disabled(local_history_pos==0);
	dir_next->set_disabled(local_history_pos==local_history.size()-1);
}
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() && get_current_file()!="")
		_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));

	if (is_visible()) {
		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);

}
Exemple #7
0
void FileDialog::_post_popup() {

	ConfirmationDialog::_post_popup();
	if (invalidated) {
		update_file_list();
		invalidated = false;
	}
	if (mode == MODE_SAVE_FILE)
		file->grab_focus();
	else
		tree->grab_focus();

	set_process_unhandled_input(true);

	// For open dir mode, deselect all items on file dialog open.
	if (mode == MODE_OPEN_DIR)
		deselect_items();
}
Exemple #8
0
void EditorFileDialog::_favorite_move_down() {

	int current = favorites->get_current();

	if (current >= 0 && current < favorites->get_item_count() - 1) {
		Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();

		int a_idx = favorited.find(String(favorites->get_item_metadata(current + 1)));
		int b_idx = favorited.find(String(favorites->get_item_metadata(current)));

		if (a_idx == -1 || b_idx == -1)
			return;
		SWAP(favorited[a_idx], favorited[b_idx]);

		EditorSettings::get_singleton()->set_favorite_dirs(favorited);

		_update_favorites();
		update_file_list();
	}
}
Exemple #9
0
void
dlg_edit_metadata (GthBrowser *browser,
		   GType       dialog_type,
		   const char *dialog_name)
{
	DialogData *data;

	if (gth_browser_get_dialog (browser, dialog_name)) {
		gtk_window_present (GTK_WINDOW (gth_browser_get_dialog (browser, dialog_name)));
		return;
	}

	data = g_new0 (DialogData, 1);
	data->ref = 1;
	data->browser = browser;
	data->dialog = g_object_new (dialog_type, 0);
	data->dialog_name = g_strdup (dialog_name);
	data->never_shown = TRUE;

	gth_browser_set_dialog (browser, data->dialog_name, data->dialog);

	g_signal_connect (G_OBJECT (data->dialog),
			  "delete-event",
			  G_CALLBACK (gtk_true),
			  NULL);
	g_signal_connect (data->dialog,
			  "response",
			  G_CALLBACK (edit_metadata_dialog__response_cb),
			  data);
	data->file_selection_changed_event =
			g_signal_connect (gth_browser_get_file_list_view (data->browser),
					  "file-selection-changed",
					  G_CALLBACK (file_selection_changed_cb),
					  data);

	update_file_list (data);
}
Exemple #10
0
void FileDialog::_filter_selected(int) {
	
	update_file_list();
}
Exemple #11
0
void FileDialog::_go_up() {

	dir_access->change_dir("..");
	update_file_list();
	update_dir();
}