<commit_before>#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#ifndef ELM_LIB_QUICKLAUNCH

static void drop_cb(void *mydata, Evas_Object *obj, void *evdata);
static void drag_stop_cb(void *mydata, Evas_Object *obj, void *evdata);
static void drag_start_cb(void *mydata, Evas_Object *obj, void *evdata);

void
test_photo(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
   Evas_Object *win, *bg, *sc, *tb, *ph;
   int i, j, n;
   char buf[PATH_MAX];
   const char *img[9] =
     {
        "panel_01.jpg",
          "mystrale.jpg",
          "mystrale_2.jpg",
          "rock_02.jpg",
          "sky_01.jpg",
          "sky_02.jpg",
          "sky_03.jpg",
          "sky_04.jpg",
          "wood_01.jpg"
     };

   win = elm_win_add(NULL, "photo", ELM_WIN_BASIC);
   elm_win_title_set(win, "Photo");
   elm_win_autodel_set(win, EINA_TRUE);

   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   tb = elm_table_add(win);
   evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

   n = 0;
   for (j = 0; j < 12; j++)
     {
        for (i = 0; i < 12; i++)
          {
             ph = elm_photo_add(win);
             snprintf(buf, sizeof(buf), "%s/images/%s",
                      PACKAGE_DATA_DIR, img[n]);
             n++;
             if (n >= 9) n = 0;
             elm_photo_size_set(ph, 80);
             elm_photo_file_set(ph, buf);
	     elm_photo_editable_set(ph, 1);
             evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND,
                                              EVAS_HINT_EXPAND);
             evas_object_size_hint_align_set(ph, EVAS_HINT_FILL,
                                             EVAS_HINT_FILL);
	     evas_object_smart_callback_add(ph, "drop",
                                            drop_cb, NULL);
             evas_object_smart_callback_add(ph, "drag,start",
                                            drag_start_cb, NULL);
             evas_object_smart_callback_add(ph, "drag,stop",
                                            drag_stop_cb, NULL);

             if((n == 2) || (n == 3)) {
            	 elm_photo_fill_inside_set(ph, EINA_TRUE);
            	 elm_object_style_set(ph, "shadow");
             }
             elm_table_pack(tb, ph, i, j, 1, 1);
             evas_object_show(ph);
          }
     }

   sc = elm_scroller_add(win);
   evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, sc);

   elm_scroller_content_set(sc, tb);
   evas_object_show(tb);
   evas_object_show(sc);

   evas_object_resize(win, 300, 300);
   evas_object_show(win);
}

/* Never called, elm_photo never call "drop" smart cb */
static void
drop_cb(void *mydata __UNUSED__, Evas_Object *obj, void *evdata __UNUSED__){
   printf("Drop on obj %p\n", obj);
}

static void
drag_start_cb(void *mydata __UNUSED__, Evas_Object *obj __UNUSED__, void *evdata __UNUSED__){

}

static void
drag_stop_cb(void *mydata __UNUSED__, Evas_Object *obj __UNUSED__, void *evdata __UNUSED__){
<commit_msg>elm test_photo.c: Fixed indentations. Applied coding conventions.<commit_after>#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#ifndef ELM_LIB_QUICKLAUNCH

static void drop_cb(void *mydata, Evas_Object *obj, void *evdata);
static void drag_stop_cb(void *mydata, Evas_Object *obj, void *evdata);
static void drag_start_cb(void *mydata, Evas_Object *obj, void *evdata);

void
test_photo(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
   Evas_Object *win, *bg, *sc, *tb, *ph;
   int i, j, n;
   char buf[PATH_MAX];
   const char *img[9] =
     {
        "panel_01.jpg",
        "mystrale.jpg",
        "mystrale_2.jpg",
        "rock_02.jpg",
        "sky_01.jpg",
        "sky_02.jpg",
        "sky_03.jpg",
        "sky_04.jpg",
        "wood_01.jpg"
     };

   win = elm_win_add(NULL, "photo", ELM_WIN_BASIC);
   elm_win_title_set(win, "Photo");
   elm_win_autodel_set(win, EINA_TRUE);

   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   tb = elm_table_add(win);
   evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

   n = 0;
   for (j = 0; j < 12; j++)
     {
        for (i = 0; i < 12; i++)
          {
             ph = elm_photo_add(win);
             snprintf(buf, sizeof(buf), "%s/images/%s",
                      PACKAGE_DATA_DIR, img[n]);
             n++;
             if (n >= 9) n = 0;
             elm_photo_size_set(ph, 80);
             elm_photo_file_set(ph, buf);
             elm_photo_editable_set(ph, 1);
             evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND,
                                              EVAS_HINT_EXPAND);
             evas_object_size_hint_align_set(ph, EVAS_HINT_FILL,
                                             EVAS_HINT_FILL);
             evas_object_smart_callback_add(ph, "drop",
                                            drop_cb, NULL);
             evas_object_smart_callback_add(ph, "drag,start",
                                            drag_start_cb, NULL);
             evas_object_smart_callback_add(ph, "drag,stop",
                                            drag_stop_cb, NULL);

             if((n == 2) || (n == 3)) {
                  elm_photo_fill_inside_set(ph, EINA_TRUE);
                  elm_object_style_set(ph, "shadow");
             }
             elm_table_pack(tb, ph, i, j, 1, 1);
             evas_object_show(ph);
          }
     }

   sc = elm_scroller_add(win);
   evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, sc);

   elm_scroller_content_set(sc, tb);
   evas_object_show(tb);
   evas_object_show(sc);

   evas_object_resize(win, 300, 300);
   evas_object_show(win);
}

/* Never called, elm_photo never call "drop" smart cb */
static void
drop_cb(void *mydata __UNUSED__, Evas_Object *obj, void *evdata __UNUSED__){
     printf("Drop on obj %p\n", obj);
}

static void
drag_start_cb(void *mydata __UNUSED__, Evas_Object *obj __UNUSED__, void *evdata __UNUSED__){

}

static void
drag_stop_cb(void *mydata __UNUSED__, Evas_Object *obj __UNUSED__, void *evdata __UNUSED__){

{'fraction_non_alphanumeric': 0.11080074487895716, 'fraction_numerical': 0.011793916821849782, 'mean_word_length': 2.3602711157455682, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7279812', 'n_tokens_mistral': 2401, 'n_tokens_neox': 2307, 'n_words': 434}