rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=569cfb5f3232900129b25cc954ab5036c6ef82db

commit 569cfb5f3232900129b25cc954ab5036c6ef82db
Author: Elizabeth Shevchenko <l.shevche...@samsung.com>
Date:   Mon Nov 16 17:02:18 2015 +0200

    Property: start to fill sound sample/tone info content into property
---
 src/bin/ui/editors/sound_editor.c |  14 +++-
 src/bin/ui/editors/sound_editor.h |   5 ++
 src/bin/ui/property_sound.c       | 145 ++++++++++++++++++++++++++++++++++----
 3 files changed, 147 insertions(+), 17 deletions(-)

diff --git a/src/bin/ui/editors/sound_editor.c 
b/src/bin/ui/editors/sound_editor.c
index da1f075..f4a79e7 100644
--- a/src/bin/ui/editors/sound_editor.c
+++ b/src/bin/ui/editors/sound_editor.c
@@ -753,7 +753,7 @@ _grid_del(void *data,
    eina_stringshare_del(it->format);
    free(it);
 }
-
+/*
 static Evas_Object *
 _sound_info_label_add(Evas_Object *box,
                       const char *label)
@@ -832,7 +832,7 @@ _sound_info_create(Evas_Object *parent, Sound_Editor *edit)
    _sample_info_create(parent, edit);
    _tone_info_create(parent, edit);
 }
-
+*/
 Eina_Stringshare *
 _sound_format_get(Eina_Stringshare *snd_src)
 {
@@ -891,6 +891,8 @@ _sample_info_setup(Sound_Editor *edit,
    eina_stringshare_del(duration);
    eina_stringshare_del(type);
    eina_stringshare_del(type_show);
+
+   evas_object_smart_callback_call(ap.win, SIGNAL_SOUND_SELECTED, (void 
*)SOUND_TYPE_SAMPLE);
 }
 
 static void
@@ -914,6 +916,8 @@ _tone_info_setup(Sound_Editor *edit, const Item *it)
    elm_object_part_text_set(edit->snd_data.tone_duration, "label.value", 
duration);
    evas_object_show(edit->tone_box);
    eina_stringshare_del(duration);
+
+   evas_object_smart_callback_call(ap.win, SIGNAL_SOUND_SELECTED, (void 
*)SOUND_TYPE_TONE);
 }
 #ifdef HAVE_AUDIO
 
@@ -1655,7 +1659,11 @@ sound_editor_window_add(Sound_Editor_Mode mode)
 
    _create_gengrid(edit->markup, edit);
 
-   _sound_info_create(edit->markup, edit);
+   /*
+    * TODO: there is necessary to remove this function from the file
+    * when it's implementation in 'property_sound.c' will be finished
+    */
+   //_sound_info_create(edit->markup, edit);
 
 #ifdef HAVE_AUDIO
    _sound_player_create(edit->markup, edit);
diff --git a/src/bin/ui/editors/sound_editor.h 
b/src/bin/ui/editors/sound_editor.h
index dc3090e..817d26b 100644
--- a/src/bin/ui/editors/sound_editor.h
+++ b/src/bin/ui/editors/sound_editor.h
@@ -37,6 +37,11 @@ typedef enum {
    SOUND_EDITOR_TONE_SELECT
 } Sound_Editor_Mode;
 
+typedef enum {
+   SOUND_TYPE_SAMPLE,
+   SOUND_TYPE_TONE
+} Sound_Type;
+
 /**
  * Delete added sounds from list
  *
diff --git a/src/bin/ui/property_sound.c b/src/bin/ui/property_sound.c
index 5aac95d..e3c203b 100644
--- a/src/bin/ui/property_sound.c
+++ b/src/bin/ui/property_sound.c
@@ -23,6 +23,7 @@
 #include "string_common.h"
 #include "new_history.h"
 #include "editor.h"
+#include "sound_editor.h"
 #include "validator.h"
 
 #include "signals.h"
@@ -46,28 +47,143 @@ struct _Sound_Prop_Data
 {
    Evas_Object *box;
    Evas_Object *sound_player;
-
-   Evas_Object *name;
-   Evas_Object *location;
-   Evas_Object *type;
-   Evas_Object *size;
-   Evas_Object *compression;
-   Evas_Object *usage_list;
+   Evas_Object *sample_box;
+   Evas_Object *tone_box;
+
+   struct {
+      Evas_Object *tone_name;
+      Evas_Object *tone_frq;
+      Evas_Object *tone_duration;
+      Evas_Object *file_name;
+      Evas_Object *duration;
+      Evas_Object *type;
+      Evas_Object *size;
+      Evas_Object *comp;
+      Evas_Object *quality;
+   } snd_data;
 };
 typedef struct _Sound_Prop_Data Sound_Prop_Data;
 
+#define INFO_ADD(PARENT, ITEM, TEXT, STYLE) \
+   ITEM = elm_layout_add(PARENT); \
+   evas_object_size_hint_weight_set(ITEM, EVAS_HINT_EXPAND, 0.0); \
+   evas_object_size_hint_align_set(ITEM, EVAS_HINT_FILL, 0.0); \
+   elm_layout_theme_set(ITEM, "layout", "sound_editor", STYLE); \
+   elm_object_part_text_set(ITEM, "elm.text", TEXT); \
+   evas_object_show(ITEM);
+
+static Evas_Object *
+_sound_info_label_add(Evas_Object *box,
+                      const char *label)
+{
+   Evas_Object *item;
+   INFO_ADD(box, item, label, "item");
+   elm_box_pack_end(box, item);
+   return item;
+}
+
 static void
-_on_sound_selected(void *data __UNUSED__,
-                   Evas_Object *obj __UNUSED__,
-                   void *event_info __UNUSED__)
+_sample_info_create(Evas_Object *parent, Sound_Prop_Data *edit)
+{
+   Evas_Object *item;
+
+   assert(parent != NULL);
+   assert(edit != NULL);
+
+   BOX_ADD(parent, edit->sample_box, false, false);
+   elm_box_align_set(edit->sample_box, 0.5, 0.5);
+
+   edit->snd_data.file_name = _sound_info_label_add(edit->sample_box, _("file 
name:"));
+   edit->snd_data.duration = _sound_info_label_add(edit->sample_box, 
_("duration:"));
+   edit->snd_data.type = _sound_info_label_add(edit->sample_box, _("type:"));
+   edit->snd_data.size = _sound_info_label_add(edit->sample_box, _("size:"));
+
+   INFO_ADD(edit->sample_box, item, _("compression:"), "item");
+
+   EWE_COMBOBOX_ADD(item, edit->snd_data.comp);
+   ewe_combobox_item_add(edit->snd_data.comp, "NONE");
+   ewe_combobox_item_add(edit->snd_data.comp, "RAW");
+   ewe_combobox_item_add(edit->snd_data.comp, "COMP");
+   ewe_combobox_item_add(edit->snd_data.comp, "LOSSY");
+   ewe_combobox_item_add(edit->snd_data.comp, "AS_IS");
+   elm_object_disabled_set(edit->snd_data.comp, true);
+
+   elm_object_part_text_set(item, "label.property", _("quality:"));
+   SPINNER_ADD(item, edit->snd_data.quality, 45, 1000, 1, false);
+   elm_object_disabled_set(edit->snd_data.quality, true);
+   elm_object_part_content_set(item, "swallow.first", edit->snd_data.comp);
+   elm_object_part_content_set(item, "swallow.second", edit->snd_data.quality);
+
+   elm_box_pack_end(edit->sample_box, item);
+   evas_object_hide(edit->sample_box);
+}
+
+static void
+_tone_info_create(Evas_Object *parent, Sound_Prop_Data *edit)
+{
+   Evas_Object *item;
+
+   assert(parent != NULL);
+   assert(edit != NULL);
+
+   BOX_ADD(parent, edit->tone_box, false, false);
+   elm_box_align_set(edit->tone_box, 0.5, 0.5);
+
+   edit->snd_data.tone_name = _sound_info_label_add(edit->tone_box, 
_("name:"));
+
+   INFO_ADD(edit->tone_box, item, "frequency:", "item");
+   SPINNER_ADD(edit->tone_box, edit->snd_data.tone_frq, 20, 20000, 10, false);
+   elm_object_disabled_set(edit->snd_data.tone_frq, true);
+   elm_object_part_content_set(item, "swallow.first", edit->snd_data.tone_frq);
+
+   edit->snd_data.tone_duration = _sound_info_label_add(edit->tone_box, 
_("duration:"));
+   elm_box_pack_end(edit->tone_box, item);
+   evas_object_hide(edit->tone_box);
+}
+
+#undef INFO_ADD
+
+static void
+_sound_info_create(Evas_Object *parent, Sound_Prop_Data *edit)
 {
+   assert(parent != NULL);
+   assert(edit != NULL);
+
+   _sample_info_create(parent, edit);
+   _tone_info_create(parent, edit);
 }
 
 static void
-_on_tone_selected(void *data __UNUSED__,
-                  Evas_Object *obj __UNUSED__,
-                  void *event_info __UNUSED__)
+_on_sound_selected(void *data,
+                   Evas_Object *obj __UNUSED__,
+                   void *event_info)
 {
+   Sound_Type sound_type = (Sound_Type)event_info;
+
+   Evas_Object *property = data;
+   SOUND_PROP_DATA_GET()
+
+   switch (sound_type)
+     {
+      case SOUND_TYPE_SAMPLE:
+        {
+           evas_object_show(pd->sample_box);
+           evas_object_hide(pd->tone_box);
+
+           elm_box_unpack(pd->box, pd->tone_box);
+           elm_box_pack_end(pd->box, pd->sample_box);
+        }
+      break;
+      case SOUND_TYPE_TONE:
+        {
+           evas_object_hide(pd->sample_box);
+           evas_object_show(pd->tone_box);
+
+           elm_box_unpack(pd->box, pd->sample_box);
+           elm_box_pack_end(pd->box, pd->tone_box);
+        }
+      break;
+     }
 }
 
 Evas_Object *
@@ -91,10 +207,11 @@ ui_property_sound_add(Evas_Object *parent)
    evas_object_size_hint_align_set(pd->sound_player, EVAS_HINT_FILL, 
EVAS_HINT_FILL);
    evas_object_show(pd->sound_player);
 
+   _sound_info_create(parent, pd);
+
    evas_object_data_set(pd->box, SOUND_PROP_DATA, pd);
 
    evas_object_smart_callback_add(ap.win, SIGNAL_SOUND_SELECTED, 
_on_sound_selected, pd->box);
-   evas_object_smart_callback_add(ap.win, SIGNAL_SOUND_SELECTED, 
_on_tone_selected, pd->box);
 
    return pd->box;
 }
\ No newline at end of file

-- 


Reply via email to