#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#define PACKAGE_EXAMPLES_DIR "."
#endif
#include <Ecore.h>
#include <stdio.h>
#include <errno.h>
#include "evas-common.h"
#define WIDTH         320
#define HEIGHT        480
static const char *border_img_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/red.png";
static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/aspect.edj";
struct test_data
{
   Ecore_Evas  *ee;
};
static struct test_data d = {0};
static void
_canvas_resize_cb(Ecore_Evas *ee)
{
   int w, h;
   evas_object_resize(d.bg, w, h);
}
static const char *
{
   switch (aspect)
     {
      case 0:
        return "NONE";
      case 1:
        return "NEITHER";
      case 2:
        return "HORIZONTAL";
      case 3:
        return "VERTICAL";
      case 4:
        return "BOTH";
      default:
        return "INVALID";
     }
}
static void
            void        *einfo)
{
       strcmp(ev->
key, 
"h") == 0) 
     {
        printf("commands are:\n"
               "\tc - cycle aspect control on object\n"
               "\th - change horizontal aspect component\n"
               "\tv - change vertical aspect component\n"
               "\ts - print current object's status\n"
               "\tH - print help\n");
        return;
     }
   if (strcmp(ev->
key, 
"s") == 0) 
      {
        evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h);
        printf("Object has aspect %s, with horizontal compontent %d"
               " and vertical component %d\n",
               _get_aspect_name(aspect), w, h);
        return;
     }
   if (strcmp(ev->
key, 
"c") == 0) 
      {
        evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h);
        aspect = (aspect + 1) % 5;
        evas_object_size_hint_aspect_set(d.rect, aspect, w, h);
        printf("Changing aspect control to %s\n",
               _get_aspect_name(aspect));
        return;
     }
   if (strcmp(ev->
key, 
"h") == 0) 
      {
        evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h);
        w = (w + 1) % 3;
        evas_object_size_hint_aspect_set(d.rect, aspect, w, h);
        printf("Changing horizontal aspect component to %d\n", w);
        return;
     }
   if (strcmp(ev->
key, 
"v") == 0) 
      {
        evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h);
        h = (h + 1) % 3;
        evas_object_size_hint_aspect_set(d.rect, aspect, w, h);
        printf("Changing vertical aspect component to %d\n", h);
        return;
     }
}
int
main(void)
{
     return EXIT_FAILURE;
     return EXIT_FAILURE;
   
   if (!d.ee)
     goto error;
   
   evas_object_move(d.bg, 0, 0); 
   evas_object_resize(d.bg, WIDTH, HEIGHT); 
   d.container = edje_object_add(d.canvas);
   ret = edje_object_file_set(d.container, edje_file_path, "main");
   if (!ret)
     {
        Edje_Load_Error err = edje_object_load_error_get(d.container);
        const char *msg = edje_load_error_str(err);
        fprintf(stderr, "could not load 'main' from %s: %s",
                edje_file_path, msg);
        goto panic;
     }
   evas_object_move(d.container, (WIDTH / 4), (HEIGHT / 4));
   evas_object_resize(d.container, (WIDTH / 2), (HEIGHT / 2));
   evas_object_size_hint_aspect_set(d.rect, EVAS_ASPECT_CONTROL_NONE, 1, 1);
   edje_object_part_swallow(d.container, "content", d.rect);
   
   d.border = evas_object_image_filled_add(d.canvas);
   evas_object_image_file_set(d.border, border_img_path, NULL);
   evas_object_image_border_set(d.border, 3, 3, 3, 3);
   evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE);
   evas_object_move(d.border, (WIDTH / 4) - 3, (HEIGHT / 4) - 3);
   evas_object_resize(d.border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6);
   return 0;
error:
   fprintf(stderr, "error: Requires at least one Evas engine built and linked"
                   " to ecore-evas for this example to run properly.\n");
panic:
   return -1;
}