Esempio n. 1
0
static void __CDECL menu_save_page(short item, short title, void *data)
{
	LOG(("%s", __FUNCTION__));
	static bool init = true;
	bool is_folder=false;
	const char * path;

	if( !input_window )
		return;

	if( init ){
		init = false;
		save_complete_init();
	}

	do {
		// TODO: localize string
		path = file_select("Select folder", "");
		if (path)
			is_folder = is_dir(path);
	} while( !is_folder && path != NULL );

	if( path != NULL ){
		save_complete( input_window->browser->bw->current_content, path, NULL );
	}

}
Esempio n. 2
0
/**
 * main - entry point for SPU-side context save.
 *
 * This code deviates from the documented sequence as follows:
 *
 *      1. The EA for LSCSA is passed from PPE in the
 *         signal notification channels.
 *      2. All 128 registers are saved by crt0.o.
 */
int main()
{
	addr64 lscsa_ea;

	lscsa_ea.ui[0] = spu_readch(SPU_RdSigNotify1);
	lscsa_ea.ui[1] = spu_readch(SPU_RdSigNotify2);

	/* Step 1: done by exit(). */
	save_event_mask();	/* Step 2.  */
	save_tag_mask();	/* Step 3.  */
	set_event_mask();	/* Step 4.  */
	set_tag_mask();		/* Step 5.  */
	build_dma_list(lscsa_ea);	/* Step 6.  */
	save_upper_240kb(lscsa_ea);	/* Step 7.  */
	/* Step 8: done by exit(). */
	save_fpcr();		/* Step 9.  */
	save_decr();		/* Step 10. */
	save_srr0();		/* Step 11. */
	enqueue_putllc(lscsa_ea);	/* Step 12. */
	spill_regs_to_mem(lscsa_ea);	/* Step 13. */
	enqueue_sync(lscsa_ea);	/* Step 14. */
	set_tag_update();	/* Step 15. */
	read_tag_status();	/* Step 16. */
	read_llar_status();	/* Step 17. */
	save_complete();	/* Step 18. */

	return 0;
}
Esempio n. 3
0
static void __CDECL menu_save_page(WINDOW *win, int item, int title, void *data)
{
	LOG(("%s", __FUNCTION__));
	static bool init = true;
	bool is_folder=false;
	const char * path;

	if( !input_window )
		return;

	if( init ){
		init = false;
		save_complete_init();
	}

	do {
		// TODO: localize string
		path = file_select( "Select folder", "" );
		if( path ) {
			printf("testing: %s\n", path );
			// dumb check if the selection is an folder:
			/*FILE * fp;
			fp = fopen( path, "r" );
			if( !fp ){
				is_folder = true;
			} else {
				fclose( fp );
				form_alert(1, "[1][Please select an folder or abort!][OK]");
			}
			*/
			is_folder = true;
		}
	} while( !is_folder && path != NULL );

	if( path != NULL ){
		save_complete( input_window->browser->bw->current_content, path );
	}

}
Esempio n. 4
0
void ami_file_save(int type, char *fname, struct Window *win,
		struct hlcache_handle *object, struct hlcache_handle *favicon,
		struct browser_window *bw)
{
	BPTR lock, fh;
	const char *source_data;
	ULONG source_size;
	struct bitmap *bm;

	ami_update_pointer(win, GUI_POINTER_WAIT);

	if(ami_download_check_overwrite(fname, win, 0)) {
		switch(type) {
			case AMINS_SAVE_SOURCE:
				if((source_data = content_get_source_data(object, &source_size))) {
					BPTR fh;
					if(fh = FOpen(fname, MODE_NEWFILE,0)) {
						FWrite(fh, source_data, 1, source_size);
						FClose(fh);
					}
				}
			break;

			case AMINS_SAVE_TEXT:
				save_as_text(object, fname);
			break;

			case AMINS_SAVE_COMPLETE:
				if(lock = CreateDir(fname)) {
					UnLock(lock);
					save_complete(object, fname, ami_file_set_type);
					amiga_icon_superimpose_favicon(fname, favicon, NULL);
				}
			break;

			case AMINS_SAVE_PDF:
#ifdef WITH_PDF_EXPORT
				if(save_as_pdf(object, fname))
					amiga_icon_superimpose_favicon(fname, favicon, "pdf");
#endif
			break;

			case AMINS_SAVE_IFF:
				if((bm = content_get_bitmap(object))) {
					bm->url = (char *)nsurl_access(hlcache_handle_get_url(object));
					bm->title = (char *)content_get_title(object);
					bitmap_save(bm, fname, 0);
				}
#ifdef WITH_NS_SVG
				else if(ami_mime_compare(object, "svg") == true) {
					ami_save_svg(object, fname);
				}
#endif
			break;

			case AMINS_SAVE_SELECTION:
				if(source_data = browser_window_get_selection(bw)) {
					if(fh = FOpen(fname, MODE_NEWFILE,0)) {
						FWrite(fh, source_data, 1, strlen(source_data));
						FClose(fh);
					}
					free((void *)source_data);
				}
			break;
		}
		if(object) SetComment(fname, nsurl_access(hlcache_handle_get_url(object)));
	}

	ami_update_pointer(win, GUI_POINTER_DEFAULT);
}