Esempio n. 1
0
int
main(void)
{
   Ecore_Evas *ee;
   Evas *canvas;
   Evas_Object *bg;
   Eina_List *engines, *l;
   char *data;

   if (ecore_evas_init() <= 0)
     return 1;

   engines = ecore_evas_engines_get();
   printf("Available engines:\n");
   EINA_LIST_FOREACH(engines, l, data)
     printf("%s\n", data);
   ecore_evas_engines_free(engines);

   ee = ecore_evas_new(NULL, 0, 0, 200, 200, NULL);
   ecore_evas_title_set(ee, "Ecore Evas basics Example");
   ecore_evas_show(ee);

   data = malloc(sizeof(char) * 6);
   sprintf(data, "%s", "hello");
   ecore_evas_data_set(ee, "key", data);
   ecore_evas_callback_delete_request_set(ee, _on_delete);

   printf("Using %s engine!\n", ecore_evas_engine_name_get(ee));

   canvas = ecore_evas_get(ee);
   if (ecore_evas_ecore_evas_get(canvas) == ee)
     printf("Everything is sane!\n");

   bg = evas_object_rectangle_add(canvas);
   evas_object_color_set(bg, 0, 0, 255, 255);
   evas_object_resize(bg, 200, 200);
   evas_object_show(bg);
   ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);

   ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ, _stdin_cb, NULL, NULL, NULL);

   ecore_main_loop_begin();

   ecore_evas_free(ee);
   ecore_evas_shutdown();

   return 0;
}
Esempio n. 2
0
int
main(void)
{
   Ecore_Evas *ee;
   Evas_Object *bg, *cursor, *obj;
   int layer, x, y;

   ecore_evas_init();

   ee = ecore_evas_new(NULL, 0, 0, 200, 200, NULL);
   ecore_evas_title_set(ee, "Ecore Evas Object Example");
   ecore_evas_show(ee);

   bg = evas_object_rectangle_add(ecore_evas_get(ee));
   evas_object_color_set(bg, 0, 0, 255, 255);
   evas_object_resize(bg, 200, 200);
   evas_object_show(bg);
   ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);

   if (bg == ecore_evas_object_associate_get(ee))
     printf("Association worked!\n");

   cursor = evas_object_rectangle_add(ecore_evas_get(ee));
   evas_object_color_set(cursor, 0, 255, 0, 255);
   evas_object_resize(cursor, 5, 10);
   ecore_evas_object_cursor_set(ee, cursor, 0, 1, 1);

   ecore_evas_cursor_get(ee, &obj, &layer, &x, &y);
   if (obj == cursor && layer == 0 && x == 1 && y == 1)
     printf("Set cursor worked!\n");

   ecore_main_loop_begin();

   ecore_evas_free(ee);
   ecore_evas_shutdown();

   return 0;
}
Esempio n. 3
0
int
main(int argc, char *argv[])
{
   char         edje_file_path[PATH_MAX];
   const char  *edje_file = "codegen.edj";
   Ecore_Evas  *ee;
   Evas        *evas;
   Evas_Object *bg;
   Evas_Object *edje_obj;
   Evas_Object *red_rect;
   Eina_Prefix *pfx;

   if (!ecore_evas_init())
     return EXIT_FAILURE;

   if (!edje_init())
     goto shutdown_ecore_evas;

   pfx = eina_prefix_new(argv[0], main,
                         "EDJE_EXAMPLES",
                         "edje/examples",
                         edje_file,
                         PACKAGE_BIN_DIR,
                         PACKAGE_LIB_DIR,
                         PACKAGE_DATA_DIR,
                         PACKAGE_DATA_DIR);
   if (!pfx)
     goto shutdown_edje;

   /* this will give you a window with an Evas canvas under the first
    * engine available */
   ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
   if (!ee)
     goto free_prefix;

   ecore_evas_callback_delete_request_set(ee, _on_delete);
   ecore_evas_title_set(ee, "Edje text Example");

   evas = ecore_evas_get(ee);

   bg = evas_object_rectangle_add(evas);
   evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
   evas_object_move(bg, 0, 0); /* at canvas' origin */
   evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
   evas_object_show(bg);
   ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);

   edje_obj = codegen_example_object_add(evas, NULL);
   evas_object_move(edje_obj, 20, 20);
   evas_object_resize(edje_obj, WIDTH - 40, HEIGHT - 40);
   evas_object_show(edje_obj);

   codegen_example_part_one_set(edje_obj, "CODEGEN_EXAMPLE");
   codegen_example_part_below_over_callback_add(edje_obj, _on_mouse_over, NULL);

   red_rect = evas_object_rectangle_add(evas);
   evas_object_color_set(red_rect, 255, 0, 0, 255); /* white bg */
   codegen_example_part_two_set(edje_obj, red_rect);
   evas_object_show(red_rect);

   ecore_evas_show(ee);

   ecore_main_loop_begin();

   eina_prefix_free(pfx);
   ecore_evas_free(ee);
   ecore_evas_shutdown();
   edje_shutdown();

   return EXIT_SUCCESS;

 free_prefix:
   eina_prefix_free(pfx);
 shutdown_edje:
   edje_shutdown();
 shutdown_ecore_evas:
   ecore_evas_shutdown();

   return EXIT_FAILURE;
}
Esempio n. 4
0
int main(int argc, char *argv[]){
	/*
	 * Here i need to get the TV resolution
	 */
	ecore_psl1ght_optimal_screen_resolution_get(&REAL_WIDTH, &REAL_HEIGHT);
	
	if(REAL_HEIGHT > 720){
		REAL_WIDTH  = 1280;
		REAL_HEIGHT = 720;
	}
	
	init_core(&core, REAL_WIDTH, REAL_HEIGHT, "Playstation Channel");
	edje_start();
	init_core_file();
	
	Cursor_Y[0] = 0.25972*REAL_HEIGHT;
	Cursor_Y[1] = 0.5445 *REAL_HEIGHT;
	
	Cursor_X[0] = 0.1*REAL_WIDTH;		// APPS      (APP 1) || MEDIA     (APP 4)
	Cursor_X[1] = 0.37421875*REAL_WIDTH;	// BMANAGERS (APP 2) || RETRO     (APP 5)
	Cursor_X[2] = 0.65*REAL_WIDTH;		// GAMES     (APP 3) || OPTIONS   (APP 6)


	
	load_edj_from_file(&core, &info, PSC_INFO_SCREEN_PATH, "information", REAL_WIDTH, REAL_HEIGHT);
	load_edj_from_file(&core, &menu[0], PSC_OPTION_MENU_PATH, "menu", REAL_WIDTH, REAL_HEIGHT); //OPTIONS
	load_edj_from_file(&core, &menu[1], PSC_SUB_MENU_PATH, "menu", REAL_WIDTH, REAL_HEIGHT);    //SUB MENU

	main_layer = evas_object_rectangle_add(get_main_object(&core));
	evas_object_resize(main_layer, REAL_WIDTH, REAL_HEIGHT);
	evas_object_color_set(main_layer, 0, 0, 0, 0);
	evas_object_show(main_layer);

	ecore_evas_object_associate(core.ee_core, main_layer, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
	override_text(&info, "information_download", " ");
	draw_edj(&info, 0, 0);

//-----------------------------------------------------------------------------------------------------

	dir_make(CACHE_PATH);
	if(file_exist(CACHE_PATH"/files.zip"))
		file_delete(CACHE_PATH"/files.zip");

	{
		char url[20];
		sprintf(url,"%s",MAINURL);
//		if(!ecore_file_download(url,CACHE_PATH"/files.zip", download_main_is_finished, download_main_func, NULL, NULL))
		download_file(url,CACHE_PATH"/files.zip", download_main_func_curl, download_main_is_finished);
		if(get_download_status()==DOWNLOAD_FAILED)
			goto end;
	}
	LoadStrings(PSC_MAIN_MENU_LANG_PATH, Categories_Names, 6);
	{
		string XML_files[5];
		LoadMainStringsFromXML(CACHE_PATH"/files.xml",XML_files);
		for(int i=0;i<5;i++){
			char tmp_char[250];
			sprintf(tmp_char,"%s/%s",CACHE_PATH,XML_files[i].c_str());
			LoadStringsFromXML(tmp_char,&Apps[i]);
			Applications[i].Image = new EFL_Image [Apps[i].n_elem];
			Applications[i].x = new int [Apps[i].n_elem];
			Applications[i].y = new int [Apps[i].n_elem];
			for(int j=0, k=0, h=0;j<Apps[i].n_elem;j++,(k>1) ? h=!h : h=h,(k>1) ? k=0 : k++ ){
				sprintf(tmp_char,"%s/%s",CACHE_PATH,Apps[i].img_file[j].c_str());
				create_image_obj(&core, &Applications[i].Image[j], tmp_char, REAL_WIDTH*0.25, REAL_HEIGHT*0.246);
				Applications[i].x[j] = Cursor_X[k];
				Applications[i].y[j] = Cursor_Y[h];
				draw_image(&Applications[i].Image[j], Applications[i].x[j], Applications[i].y[j]);
				hide_obj(Applications[i].Image[j].obj);
			}
		}
	}
//-----------------------------------------------------------------------------------------------------
	load_edj_from_file(&core, &menu[2], PSC_MAIN_MENU_PATH, "menu", REAL_WIDTH, REAL_HEIGHT);                                 //MAIN MENU
	load_edj_from_file(&core, &bar, PSC_MAIN_MENU_BAR_PATH, "main_menu_bar", REAL_WIDTH*0.25, REAL_HEIGHT*0.246);             //(Main/Sub) Menu bar
	load_edj_from_file(&core, &download, PSC_DOWNLOAD_MASK_PATH, "download_mask", REAL_WIDTH*0.3125, REAL_HEIGHT*0.3055);     //DOWNLOAD MENU

	override_text(&menu[2], "error_text", "");

	down = evas_object_rectangle_add(get_main_object(&core));
	evas_object_move(down, (REAL_WIDTH-(REAL_WIDTH*0.3125))/2 +REAL_WIDTH*0.03125,REAL_HEIGHT*0.08861 +(REAL_HEIGHT-(REAL_HEIGHT*0.3055))/2);
	Bar_X_Val = REAL_WIDTH*0.25;
	Bar_Y_Val = REAL_HEIGHT*0.058;
	evas_object_resize(down, 1, Bar_Y_Val);
	evas_object_color_set(down, 0, 0, 255, 255); //blue
	hide_obj(down);
	load_edj_from_file(&core, &download_perc, PSC_DOWNLOADPERC_MASK_PATH, "download_perc", REAL_WIDTH*0.3125, REAL_HEIGHT*0.3055);    //DOWNLOAD MENU
	load_edj_from_file(&core, &download_ask, PSC_DOWNLOAD_MASK_PATH, "download_mask_ask", REAL_WIDTH*0.3125, REAL_HEIGHT*0.3055);     //DOWNLOAD MENU ASK XMB

	ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, on_exit_handler, NULL);
	information_timer = ecore_timer_add(PSC_INFO_SCREEN_TIMER, delete_info, NULL);
	enable_callback(&core, main_layer, EVAS_CALLBACK_KEY_DOWN , user_menu_handler);
	
	override_text(&menu[0], "ps3_version_edit", get_ps3_version());
	char space [100];

	if(get_ps3_free_space()>1000000000)
		sprintf(space,"%ld/%ld Gigabytes",get_ps3_free_space()/1000000000,get_ps3_total_space()/1000000000);
	else if(get_ps3_free_space()>1000000)
		sprintf(space,"%ld/%ld Megabytes",get_ps3_free_space()/1000000,get_ps3_total_space()/1000000);
	else if(get_ps3_free_space()>1000)
		sprintf(space,"%ld/%ld Kilobytes",get_ps3_free_space()/1000,get_ps3_total_space()/1000);
	else
		sprintf(space,"%ld/%ld Bytes",get_ps3_free_space(),get_ps3_total_space());

	override_text(&menu[0], "ps3_hdd_free_space_edit", space);
#ifdef PSCHANNEL_VERSION
	sprintf(space,"%f",PSCHANNEL_VERSION);
	override_text(&menu[0], "software_version", space);
#else
	override_text(&menu[0], "software_version", " ");
#endif
	if(sysModuleIsLoaded(SYSMODULE_NET))
		override_text(&menu[2], "error_text", "SYSMODULE_NET NOT LOADED!!");



	start_core_loop();
	disable_callback(main_layer,EVAS_CALLBACK_KEY_DOWN, user_menu_handler);
	
end:
	dir_recursive_delete(CACHE_PATH);

	for(int i=0;i<3;i++)
		delete_edj(&menu[i]);
	for(int i=0;i<5;i++)
		for(int j=0;j<Apps[i].n_elem;j++)
			delete_obj(Applications[i].Image[j].obj);
	delete_edj(&bar);
	delete_edj(&download);
	delete_edj(&download_perc);
	delete_obj(down);


	edje_stop();
	stop_core_file();
	ecore_psl1ght_shutdown();
//	stop_core(&core);  not needed on ps3.

	if(pkg_is_installed)
		reboot_sys();
	

	return 0;
}