Apply modified Listeners 17/34817/7 accepted/tizen/tv/20150204.020428 submit/tizen_tv/20150203.213546
authorKim Tae Soo <taesoo46.kim@samsung.com>
Tue, 3 Feb 2015 07:45:54 +0000 (16:45 +0900)
committerKim Tae Soo <taesoo46.kim@samsung.com>
Tue, 3 Feb 2015 15:04:06 +0000 (00:04 +0900)
Change-Id: I2f6c17009e2e458b6b3d6510288ed09cc4a93479
Signed-off-by: Kim Tae Soo <taesoo46.kim@samsung.com>
include/category-layout.h
include/common.h
include/entry-popup.h
src/views/album-songs-layout.cpp
src/views/base-view.cpp
src/views/category-layout.cpp
src/views/entry-popup.cpp
src/views/folder-layout.cpp
src/views/playback-view.cpp
src/views/playlist-layout.cpp

index ae50715..57eeb59 100644 (file)
@@ -18,7 +18,9 @@
 #define __CATEGORY_LAYOUT_H__
 
 
-class CCategoryLayout : public CExtBaseLayout, public CListenerMgr, public IKeyDownListener {
+class CCategoryLayout : public CExtBaseLayout, public CListenerMgr,
+       public IKeyDownListener, public IMouseMoveListener, public IMouseClickedListener,
+       public IRealizedListener, public IUnrealizedListener {
 private:
        struct SCategoryLayout *m;
 
@@ -54,7 +56,7 @@ protected:
                SContentInfo *ctxtinfo;
                ESelectType sel_type;
                Evas_Object *grid;
-               Evas_Object *epopup;
+               class CEntryPopup *epopup;
                Evas_Object *base;
                Elm_Object_Item *focused_item;
        } t;
@@ -66,24 +68,6 @@ private:
        static void sm_CbEntrynameSet(void *dt, const char *name);
        void m_OnEntrynameSet(const char *name);
 
-       static void sm_CbSelectAllClicked(void *dt, Evas_Object *obj, void *ev);
-       void m_OnSelectAllClicked(Evas_Object *obj, void *ev);
-
-       static void sm_CbDoneBtnClicked(void *dt, Evas_Object *obj, void *ev);
-       void m_OnDoneBtnClicked(Evas_Object *obj, void *ev);
-       
-       static void sm_CbCancelBtnClicked(void *dt, Evas_Object *obj, void *ev);
-       void m_OnCancelBtnClicked(Evas_Object *obj, void *ev);
-
-       static void sm_CbPlayBtnClicked(void *dt, Evas_Object *obj, void *ev);
-       void m_OnPlayBtnClicked(Evas_Object *obj, void *ev);
-
-       static void sm_CbNextBtnClicked(void *dt, Evas_Object *obj, void *ev);
-       void m_OnNextBtnClicked(Evas_Object *obj, void *ev);
-
-       static void sm_CbLastBtnClicked(void *dt, Evas_Object *obj, void *ev);
-       void m_OnLastBtnClicked(Evas_Object *obj, void *ev);
-
        static char *sm_CbGetSelectlistItemText(void *data, Evas_Object *obj, const char *part);
        static char *sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part);
        static void sm_CbRemoveListItem(void *data, Evas_Object *obj);
@@ -111,15 +95,6 @@ private:
        static void sm_CbItemSelect(void *data, Elm_Object_Item *it, const char *emission, const char *source);
        void m_OnItemSelect(Elm_Object_Item *it, const char *emission, const char *source);
 
-       static void sm_CbGengridRealized(void *data, Evas_Object *obj, void *event_info);
-       static void sm_CbGengridUnrealized(void *data, Evas_Object *obj, void *event_info);
-
-       static void sm_CbKeyDown(void *dt, Evas *e, Evas_Object *obj, void *ei);
-       void m_OnKeyDown(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
-
-       static void sm_CbKeyPressed(void *dt, Evas *e, Evas_Object *obj, void *ei);
-       void m_OnKeyPressed(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
-
 private:
        inline int m_ConvertToMin(int milsec);
        void m_RemoveFocusIdler(void);
@@ -159,7 +134,14 @@ protected:
        virtual ECategoryType t_CategoryType(void) = 0;
 
 public:
-       CCategoryLayout(const char *pLayoutId) : CExtBaseLayout(pLayoutId), IKeyDownListener(this), m(0) {
+       CCategoryLayout(const char *pLayoutId) :
+               CExtBaseLayout(pLayoutId),
+               IKeyDownListener(this),
+               IMouseMoveListener(this),
+               IMouseClickedListener(this),
+               IRealizedListener(this),
+               IUnrealizedListener(this),
+               m(0) {
                memset(&t, 0, sizeof(t));
        }
        virtual ~CCategoryLayout() {}
@@ -171,6 +153,10 @@ public:
 
 public:
        virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+       virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev);
+       virtual void OnMouseClicked(int id, Evas_Object *obj);
+       virtual void OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item);
+       virtual void OnUnrealized(int id, Evas_Object *obj, Elm_Object_Item *item);
 };
 
 
index 6f7fae1..bef2530 100644 (file)
@@ -29,15 +29,6 @@ struct SCtxtPlaylistItem {
        int id;
 };
 
-enum {
-       GRP_SONG,
-       GRP_ALBUM,
-       GRP_ARTIST,
-       GRP_GENRE,
-       GRP_FOLDER,
-       GRP_PLAYLISTS
-};
-
 enum ESourceType {
        SOURCE_TYPE_NONE = -1,
        SOURCE_TYPE_ALL,
@@ -60,13 +51,6 @@ enum EAddType {
        ADD_TYPE_END
 };
 
-
-enum ETopBtnType {
-       TOP_BTN_TYPE_PLAYBACK,
-       TOP_BTN_TYPE_SOURCE,
-       TOP_BTN_TYPE_SORT,
-};
-
 enum EPlayStatus {
        PLAY_STATUS_INITIAL = -1,
        PLAY_STATUS_STOP,
index e4bfa24..246f0a0 100644 (file)
 #ifndef __ENTRY_POPUP_H__
 #define __ENTRY_POPUP_H__
 
-Evas_Object *create_entry_popup(Evas_Object *base, const char *text,
-               void (*)(void *, const char *), void *data);
-void destroy_entry_popup(Evas_Object *layout);
+class CEntryPopup : public CListenerMgr, public IKeyDownListener {
+private:
+       struct SEntryPopup *m;
+
+private:
+       static Eina_Bool sm_CbFocusIdler(void *dt);
+       void m_OnFocusIdler(void);
+
+public:
+       CEntryPopup() : IKeyDownListener(this), m(0) {}
+       virtual ~CEntryPopup() {}
+
+       bool Create(Evas_Object *base, const char *text, void(*cbEntryName)(void *, const char *), void *data);
+       virtual void Destroy(void);
+
+       bool FlagCreate(void);
+
+       virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+};
 
 #endif /* __ENTRY_POPUP_H__ */
index cc87998..a9a4cbb 100644 (file)
 
 
 enum EObjectType {
+       ALBUM_SONGS_LAYOUT,
+       ALBUM_SONGS_GENLIST,
        ALBUM_SONGS_PLAY_BUTTON,
        ALBUM_SONGS_NEXT_BUTTON,
        ALBUM_SONGS_LAST_BUTTON,
-       ALBUM_SONGS_LAYOUT,
-       ALBUM_SONGS_GENLIST,
+};
+
+enum EBtnType {
+       BTN_PLAY,
+       BTN_NEXT,
+       BTN_LAST
 };
 
 struct SAlbumSongsItemInfo {
@@ -80,6 +86,7 @@ struct SBtnInfo {
        const char *part;
        const char *style;
        const char *icon;
+       EObjectType type;
 };
 
 
@@ -359,20 +366,23 @@ void CAlbumSongsLayout::m_CreateTopSection(void)
        SBtnInfo btninfo[TOTAL_ADD_BTNS];
        Evas_Object *layout = Layout();
 
-       btninfo[ALBUM_SONGS_PLAY_BUTTON].name = MUSIC_STR_PLAY;
-       btninfo[ALBUM_SONGS_PLAY_BUTTON].part = MUSIC_PART_ALBUM_PLAYBTN;
-       btninfo[ALBUM_SONGS_PLAY_BUTTON].style = MUSIC_STYLE_ADD_PLAY_BTN;
-       btninfo[ALBUM_SONGS_PLAY_BUTTON].icon = MUSIC_IMAGE_ADD_PLAY;
+       btninfo[BTN_PLAY].name = MUSIC_STR_PLAY;
+       btninfo[BTN_PLAY].part = MUSIC_PART_ALBUM_PLAYBTN;
+       btninfo[BTN_PLAY].style = MUSIC_STYLE_ADD_PLAY_BTN;
+       btninfo[BTN_PLAY].icon = MUSIC_IMAGE_ADD_PLAY;
+       btninfo[BTN_PLAY].type = ALBUM_SONGS_PLAY_BUTTON;
 
-       btninfo[ALBUM_SONGS_NEXT_BUTTON].name = MUSIC_STR_ADDNEXT;
-       btninfo[ALBUM_SONGS_NEXT_BUTTON].part = MUSIC_PART_ALBUM_NEXTBTN;
-       btninfo[ALBUM_SONGS_NEXT_BUTTON].style = MUSIC_STYLE_ADD_NEXT_BTN;
-       btninfo[ALBUM_SONGS_NEXT_BUTTON].icon = MUSIC_IMAGE_ADD_NEXT;
+       btninfo[BTN_NEXT].name = MUSIC_STR_ADDNEXT;
+       btninfo[BTN_NEXT].part = MUSIC_PART_ALBUM_NEXTBTN;
+       btninfo[BTN_NEXT].style = MUSIC_STYLE_ADD_NEXT_BTN;
+       btninfo[BTN_NEXT].icon = MUSIC_IMAGE_ADD_NEXT;
+       btninfo[BTN_NEXT].type = ALBUM_SONGS_NEXT_BUTTON;
 
-       btninfo[ALBUM_SONGS_LAST_BUTTON].name = MUSIC_STR_ADDLAST;
-       btninfo[ALBUM_SONGS_LAST_BUTTON].part = MUSIC_PART_ALBUM_LASTBTN;
-       btninfo[ALBUM_SONGS_LAST_BUTTON].style = MUSIC_STYLE_ADD_LAST_BTN;
-       btninfo[ALBUM_SONGS_LAST_BUTTON].icon = MUSIC_IMAGE_ADD_LAST;
+       btninfo[BTN_LAST].name = MUSIC_STR_ADDLAST;
+       btninfo[BTN_LAST].part = MUSIC_PART_ALBUM_LASTBTN;
+       btninfo[BTN_LAST].style = MUSIC_STYLE_ADD_LAST_BTN;
+       btninfo[BTN_LAST].icon = MUSIC_IMAGE_ADD_LAST;
+       btninfo[BTN_LAST].type = ALBUM_SONGS_LAST_BUTTON;
 
        thumb = m_AddAlbumCover();
        if (!thumb)
@@ -388,7 +398,7 @@ void CAlbumSongsLayout::m_CreateTopSection(void)
                elm_object_text_set(btn[i], _(btninfo[i].name));
                elm_object_style_set(btn[i], btninfo[i].style);
 
-               Connect(btn[i], i, TYPE_MOUSE_MOVE | TYPE_CLICKED);
+               Connect(btn[i], btninfo[i].type, TYPE_MOUSE_MOVE | TYPE_CLICKED);
 
                img = elm_image_add(btn[i]);
                if (img) {
index e6033e4..f17c58f 100644 (file)
@@ -103,31 +103,13 @@ const char *g_sourceArg[] = {
        "usb"  // SOURCE_TYPE_USB
 };
 
-
-Evas_Object *s_AddButton(Evas_Object *box)
-{
-       Evas_Object *button;
-
-       if (!box)
-               return NULL;
-
-       button = elm_button_add(box);
-       if (!button)
-               return NULL;
-
-       evas_object_size_hint_weight_set(button,
-               EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_show(button);
-
-       return button;
-}
-
-
 enum EObjectType {
        BASE_VIEW,
+
        BASE_VIEW_PLAY_BUTTON,
        BASE_VIEW_SOURCE_BUTTON,
        BASE_VIEW_SORT_BUTTON,
+
        BASE_VIEW_GROUP_SONG,
        BASE_VIEW_GROUP_ALBUM,
        BASE_VIEW_GROUP_ARTIST,
@@ -136,6 +118,20 @@ enum EObjectType {
        BASE_VIEW_GROUP_PLAYLIST,
 };
 
+enum EBtnType {
+       BTN_PLAY,
+       BTN_SOURCE,
+       BTN_SORT
+};
+
+enum EGroupBtnType {
+       GROUP_BTN_SONG,
+       GROUP_BTN_ALBUM,
+       GROUP_BTN_ARTIST,
+       GROUP_BTN_GENRE,
+       GROUP_BTN_FOLDER,
+       GROUP_BTN_PLAYLIST
+};
 
 struct SMusicBaseView {
        Evas_Object *win;
@@ -182,9 +178,28 @@ struct SBtnInfo {
        const char *part;
        const char *style;
        const char *icon_path;
+       EObjectType type;
 };
 
 
+Evas_Object *s_AddButton(Evas_Object *box)
+{
+       Evas_Object *button;
+
+       if (!box)
+               return NULL;
+
+       button = elm_button_add(box);
+       if (!button)
+               return NULL;
+
+       evas_object_size_hint_weight_set(button,
+               EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_show(button);
+
+       return button;
+}
+
 void CMusicBaseView::sm_CbHandleEmptyStatus(void *cookie, bool emptyStatus)
 {
        CMusicBaseView *root = (CMusicBaseView*)cookie;
@@ -210,8 +225,8 @@ void CMusicBaseView::m_UpdateFocusSequence(void)
                elm_object_focus_next_object_set(m->group_btn[i],
                m->content, ELM_FOCUS_RIGHT);
 
-       elm_object_focus_next_object_set(m->group_btn[GRP_SONG], m->plbackbtn, ELM_FOCUS_UP);
-       elm_object_focus_next_object_set(m->plbackbtn,           m->group_btn[GRP_SONG], ELM_FOCUS_LEFT);
+       elm_object_focus_next_object_set(m->group_btn[GROUP_BTN_SONG], m->plbackbtn, ELM_FOCUS_UP);
+       elm_object_focus_next_object_set(m->plbackbtn,           m->group_btn[GROUP_BTN_SONG], ELM_FOCUS_LEFT);
        elm_object_focus_next_object_set(m->plbackbtn,           m->content, ELM_FOCUS_DOWN);
        elm_object_focus_next_object_set(m->srcbtn,              m->content, ELM_FOCUS_DOWN);
        elm_object_focus_next_object_set(m->sortbtn,             m->content, ELM_FOCUS_DOWN);
@@ -229,11 +244,11 @@ void CMusicBaseView::m_UpdateEmptyFocusSequence(void)
                elm_object_focus_next_object_set(m->group_btn[i],
                m->plbackbtn, ELM_FOCUS_RIGHT);
 
-       elm_object_focus_next_object_set(m->group_btn[GRP_SONG], m->plbackbtn, ELM_FOCUS_UP);
-       elm_object_focus_next_object_set(m->plbackbtn, m->group_btn[GRP_SONG], ELM_FOCUS_LEFT);
-       elm_object_focus_next_object_set(m->plbackbtn, m->group_btn[GRP_SONG], ELM_FOCUS_DOWN);
-       elm_object_focus_next_object_set(m->srcbtn,    m->group_btn[GRP_SONG], ELM_FOCUS_DOWN);
-       elm_object_focus_next_object_set(m->sortbtn,   m->group_btn[GRP_SONG], ELM_FOCUS_DOWN);
+       elm_object_focus_next_object_set(m->group_btn[GROUP_BTN_SONG], m->plbackbtn, ELM_FOCUS_UP);
+       elm_object_focus_next_object_set(m->plbackbtn, m->group_btn[GROUP_BTN_SONG], ELM_FOCUS_LEFT);
+       elm_object_focus_next_object_set(m->plbackbtn, m->group_btn[GROUP_BTN_SONG], ELM_FOCUS_DOWN);
+       elm_object_focus_next_object_set(m->srcbtn,    m->group_btn[GROUP_BTN_SONG], ELM_FOCUS_DOWN);
+       elm_object_focus_next_object_set(m->sortbtn,   m->group_btn[GROUP_BTN_SONG], ELM_FOCUS_DOWN);
 
        elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT,     _(NO_MUSIC_MESSAGE));
        elm_object_part_text_set(m->base, MUSIC_PART_NO_CONTENT_SUB, _(NO_MUSIC_MESSAGE_SUB));
@@ -247,27 +262,27 @@ void CMusicBaseView::m_ShowCurrentLayout(void)
 
        elm_object_part_content_unset(m->base, MUSIC_PART_CONTENT);
 
-       if (m->c_grpbtn == m->group_btn[GRP_SONG]) {
+       if (m->c_grpbtn == m->group_btn[GROUP_BTN_SONG]) {
                layoutId = MUSIC_SONG_LAYOUT;
                evasLayout = m->layoutSong->Layout();
        }
-       else if (m->c_grpbtn == m->group_btn[GRP_ALBUM]) {
+       else if (m->c_grpbtn == m->group_btn[GROUP_BTN_ALBUM]) {
                layoutId = MUSIC_ALBUM_LAYOUT;
                evasLayout = m->layoutAlbum->Layout();
        }
-       else if (m->c_grpbtn == m->group_btn[GRP_ARTIST]) {
+       else if (m->c_grpbtn == m->group_btn[GROUP_BTN_ARTIST]) {
                layoutId = MUSIC_CATEGORY_ARTIST_LAYOUT;
                evasLayout = m->layoutArtist->Layout();
        }
-       else if (m->c_grpbtn == m->group_btn[GRP_GENRE]) {
+       else if (m->c_grpbtn == m->group_btn[GROUP_BTN_GENRE]) {
                layoutId = MUSIC_CATEGORY_GENRE_LAYOUT;
                evasLayout = m->layoutGenre->Layout();
        }
-       else if (m->c_grpbtn == m->group_btn[GRP_PLAYLISTS]) {
+       else if (m->c_grpbtn == m->group_btn[GROUP_BTN_PLAYLIST]) {
                layoutId = MUSIC_CATEGORY_PLAYLISTS_LAYOUT;
                evasLayout = m->layoutPlaylists->Layout();
        }
-       else if (m->c_grpbtn == m->group_btn[GRP_FOLDER]) {
+       else if (m->c_grpbtn == m->group_btn[GROUP_BTN_FOLDER]) {
                layoutId = MUSIC_FOLDER_LAYOUT;
                evasLayout = m->layoutFolder->Layout();
        }
@@ -333,14 +348,14 @@ void CMusicBaseView::m_CreateCtxPopup(int btnType)
        evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0);
        evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0);
 
-       if (btnType == TOP_BTN_TYPE_SOURCE) {
+       if (btnType == BTN_SOURCE) {
                arr = g_sourceText;
                size = ARRAY_SIZE(g_sourceText);
                selected_index = m->mhandle->SourceType();
                m->btntype = btnType;
                part = MUSIC_PART_SOURCE_POPUP;
        }
-       else if (btnType == TOP_BTN_TYPE_SORT) {
+       else if (btnType == BTN_SORT) {
                arr = g_sortText;
                size = ARRAY_SIZE(g_sortText);
                layout_id = m->lmgr->Layout()->LayoutId();
@@ -376,7 +391,7 @@ void CMusicBaseView::m_CreateCtxPopup(int btnType)
        }
 
        for (i = 0; i < size; i++) {
-               if (btnType == TOP_BTN_TYPE_SOURCE && i == SOURCE_TYPE_USB &&
+               if (btnType == BTN_SOURCE && i == SOURCE_TYPE_USB &&
                        !m->mhandle->CheckUsb())
                        continue;
 
@@ -453,7 +468,7 @@ void CMusicBaseView::m_CbCtxPopupBtnClicked(Evas_Object *obj, void *ev)
 
        text = elm_object_text_get(obj);
 
-       if (m->btntype == TOP_BTN_TYPE_SOURCE) {
+       if (m->btntype == BTN_SOURCE) {
                size = ARRAY_SIZE(g_sourceText);
                sm_FindIndex(g_sourceText, size, text, &type);
                m_DestroyCtxPopup();
@@ -497,8 +512,8 @@ void CMusicBaseView::m_CbCtxPopupBtnClicked(Evas_Object *obj, void *ev)
                elm_object_text_set(m->sortbtn, _(text));
        }
 
-       if (m->btntype == TOP_BTN_TYPE_SOURCE) {
-               if (m->c_grpbtn != m->group_btn[GRP_PLAYLISTS])
+       if (m->btntype == BTN_SOURCE) {
+               if (m->c_grpbtn != m->group_btn[GROUP_BTN_PLAYLIST])
                        m_ShowCurrentLayout();
        }
        else {
@@ -650,14 +665,17 @@ void CMusicBaseView::m_CreateTopSection(void)
        Evas_Object *btn = NULL;
        SBtnInfo btninfo[TOTAL_TOP_BTNS];
 
-       btninfo[TOP_BTN_TYPE_PLAYBACK].part = MUSIC_PART_PLAYBACK_BTN;
-       btninfo[TOP_BTN_TYPE_PLAYBACK].style = MUSIC_STYLE_PLAYBACK_BTN;
+       btninfo[BTN_PLAY].part = MUSIC_PART_PLAYBACK_BTN;
+       btninfo[BTN_PLAY].style = MUSIC_STYLE_PLAYBACK_BTN;
+       btninfo[BTN_PLAY].type = BASE_VIEW_PLAY_BUTTON;
 
-       btninfo[TOP_BTN_TYPE_SOURCE].part = MUSIC_PART_SOURCE_HOVERSEL;
-       btninfo[TOP_BTN_TYPE_SOURCE].style = MUSIC_STYLE_SOURCE_BTN;
+       btninfo[BTN_SOURCE].part = MUSIC_PART_SOURCE_HOVERSEL;
+       btninfo[BTN_SOURCE].style = MUSIC_STYLE_SOURCE_BTN;
+       btninfo[BTN_SOURCE].type = BASE_VIEW_SOURCE_BUTTON;
 
-       btninfo[TOP_BTN_TYPE_SORT].part = MUSIC_PART_SORT_HOVERSEL;
-       btninfo[TOP_BTN_TYPE_SORT].style = MUSIC_STYLE_SORT_BTN;
+       btninfo[BTN_SORT].part = MUSIC_PART_SORT_HOVERSEL;
+       btninfo[BTN_SORT].style = MUSIC_STYLE_SORT_BTN;
+       btninfo[BTN_SORT].type = BASE_VIEW_SORT_BUTTON;
 
        elm_object_part_text_set(m->base, MUSIC_PART_TITLE,
                _(MUSIC_TEXT_TITLE));
@@ -674,13 +692,13 @@ void CMusicBaseView::m_CreateTopSection(void)
                elm_object_style_set(btn, btninfo[i].style);
                elm_object_part_content_set(m->base, btninfo[i].part, btn);
 
-               Connect(btn, BASE_VIEW_PLAY_BUTTON + i, TYPE_KEY_DOWN | TYPE_MOUSE_MOVE | TYPE_CLICKED);
+               Connect(btn, btninfo[i].type, TYPE_KEY_DOWN | TYPE_MOUSE_MOVE | TYPE_CLICKED);
 
-               if (i == TOP_BTN_TYPE_PLAYBACK)
+               if (i == BTN_PLAY)
                        m->plbackbtn = btn;
-               else if (i == TOP_BTN_TYPE_SOURCE)
+               else if (i == BTN_SOURCE)
                        m->srcbtn = btn;
-               else if (i == TOP_BTN_TYPE_SORT)
+               else if (i == BTN_SORT)
                        m->sortbtn = btn;
        }
 
@@ -699,23 +717,29 @@ void CMusicBaseView::m_CreateLeftSection(void)
        char buf[MAX_LENGTH];
        static struct SBtnInfo btninfo[TOTAL_GROUP_BTNS];
 
-       btninfo[GRP_SONG].txt = MUSIC_TEXT_SONG;
-       btninfo[GRP_SONG].icon_path = MUSIC_IMAGE_GRPBTN_SONG;
+       btninfo[GROUP_BTN_SONG].txt = MUSIC_TEXT_SONG;
+       btninfo[GROUP_BTN_SONG].icon_path = MUSIC_IMAGE_GRPBTN_SONG;
+       btninfo[GROUP_BTN_SONG].type = BASE_VIEW_GROUP_SONG;
 
-       btninfo[GRP_ALBUM].txt = MUSIC_TEXT_ALBUM;
-       btninfo[GRP_ALBUM].icon_path = MUSIC_IMAGE_GRPBTN_ALBUM;
+       btninfo[GROUP_BTN_ALBUM].txt = MUSIC_TEXT_ALBUM;
+       btninfo[GROUP_BTN_ALBUM].icon_path = MUSIC_IMAGE_GRPBTN_ALBUM;
+       btninfo[GROUP_BTN_ALBUM].type = BASE_VIEW_GROUP_ALBUM;
 
-       btninfo[GRP_ARTIST].txt = MUSIC_TEXT_ARTIST;
-       btninfo[GRP_ARTIST].icon_path = MUSIC_IMAGE_GRPBTN_ARTIST;
+       btninfo[GROUP_BTN_ARTIST].txt = MUSIC_TEXT_ARTIST;
+       btninfo[GROUP_BTN_ARTIST].icon_path = MUSIC_IMAGE_GRPBTN_ARTIST;
+       btninfo[GROUP_BTN_ARTIST].type = BASE_VIEW_GROUP_ARTIST;
 
-       btninfo[GRP_GENRE].txt = MUSIC_TEXT_GENRE;
-       btninfo[GRP_GENRE].icon_path = MUSIC_IMAGE_GRPBTN_GENRE;
+       btninfo[GROUP_BTN_GENRE].txt = MUSIC_TEXT_GENRE;
+       btninfo[GROUP_BTN_GENRE].icon_path = MUSIC_IMAGE_GRPBTN_GENRE;
+       btninfo[GROUP_BTN_GENRE].type = BASE_VIEW_GROUP_GENRE;
 
-       btninfo[GRP_FOLDER].txt = MUSIC_TEXT_FOLDER;
-       btninfo[GRP_FOLDER].icon_path = MUSIC_IMAGE_GRPBTN_FOLDER;
+       btninfo[GROUP_BTN_FOLDER].txt = MUSIC_TEXT_FOLDER;
+       btninfo[GROUP_BTN_FOLDER].icon_path = MUSIC_IMAGE_GRPBTN_FOLDER;
+       btninfo[GROUP_BTN_FOLDER].type = BASE_VIEW_GROUP_FOLDER;
 
-       btninfo[GRP_PLAYLISTS].txt = MUSIC_TEXT_PLAYLIST;
-       btninfo[GRP_PLAYLISTS].icon_path = MUSIC_IMAGE_GRPBTN_PLAYLISTS;
+       btninfo[GROUP_BTN_PLAYLIST].txt = MUSIC_TEXT_PLAYLIST;
+       btninfo[GROUP_BTN_PLAYLIST].icon_path = MUSIC_IMAGE_GRPBTN_PLAYLISTS;
+       btninfo[GROUP_BTN_PLAYLIST].type = BASE_VIEW_GROUP_PLAYLIST;
 
        box = _add_box(m->base);
        if (!box)
@@ -732,7 +756,7 @@ void CMusicBaseView::m_CreateLeftSection(void)
                elm_object_style_set(m->group_btn[i], MUSIC_STYLE_GROUPBTN);
                elm_object_text_set(m->group_btn[i], _(btninfo[i].txt));
 
-               Connect(m->group_btn[i], BASE_VIEW_GROUP_SONG + i, TYPE_KEY_DOWN | TYPE_MOUSE_MOVE | TYPE_CLICKED);
+               Connect(m->group_btn[i], btninfo[i].type, TYPE_KEY_DOWN | TYPE_MOUSE_MOVE | TYPE_CLICKED);
 
                ic = elm_image_add(m->group_btn[i]);
                if (ic) {
@@ -960,9 +984,9 @@ void CMusicBaseView::t_OnShow(void)
        }
 
        if (m->arglist && m->arglist->album_id)
-               m->c_grpbtn = m->group_btn[GRP_ALBUM];
+               m->c_grpbtn = m->group_btn[GROUP_BTN_ALBUM];
        else
-               m->c_grpbtn = m->group_btn[GRP_SONG];
+               m->c_grpbtn = m->group_btn[GROUP_BTN_SONG];
 
        elm_object_signal_emit(m->c_grpbtn,
                MUSIC_SIGNAL_GROUP_SELECTED, MUSIC_BASE_VIEW);
@@ -1156,11 +1180,11 @@ void CMusicBaseView::OnMouseClicked(int id, Evas_Object *obj)
                break;
 
        case BASE_VIEW_SOURCE_BUTTON:
-               m_CreateCtxPopup(TOP_BTN_TYPE_SOURCE);
+               m_CreateCtxPopup(BTN_SOURCE);
                break;
 
        case BASE_VIEW_SORT_BUTTON:
-               m_CreateCtxPopup(TOP_BTN_TYPE_SORT);
+               m_CreateCtxPopup(BTN_SORT);
                break;
 
        case BASE_VIEW_GROUP_SONG:
@@ -1179,15 +1203,15 @@ void CMusicBaseView::OnMouseClicked(int id, Evas_Object *obj)
                        elm_object_signal_emit(m->c_grpbtn,
                                MUSIC_SIGNAL_GROUP_SELECTED, MUSIC_BASE_VIEW);
 
-                       if (obj == m->group_btn[GRP_FOLDER])
+                       if (obj == m->group_btn[GROUP_BTN_FOLDER])
                                elm_object_text_set(m->sortbtn, _(g_sortTextFolder[0]));
-                       else if (obj == m->group_btn[GRP_PLAYLISTS])
+                       else if (obj == m->group_btn[GROUP_BTN_PLAYLIST])
                                elm_object_text_set(m->sortbtn, _(g_sortTextPlaylists[0]));
-                       else if (obj == m->group_btn[GRP_ALBUM])
+                       else if (obj == m->group_btn[GROUP_BTN_ALBUM])
                                elm_object_text_set(m->sortbtn, _(g_sortTextAlbum[0]));
-                       else if (obj == m->group_btn[GRP_ARTIST])
+                       else if (obj == m->group_btn[GROUP_BTN_ARTIST])
                                elm_object_text_set(m->sortbtn, _(g_sortTextArtist[0]));
-                       else if (obj == m->group_btn[GRP_GENRE])
+                       else if (obj == m->group_btn[GROUP_BTN_GENRE])
                                elm_object_text_set(m->sortbtn, _(g_sortTextGenre[0]));
                        else
                                elm_object_text_set(m->sortbtn, _(g_sortText[0]));
index be3c0a6..9aa6545 100644 (file)
 #define GENGRID_ITEM_SIZE_H (359+20)
 
 
+enum EObjectType {
+       CATEGORY_LAYOUT,
+       CATEGORY_LAYOUT_GENGRID,
+       CATEGORY_LAYOUT_GENLIST,
+       CATEGORY_LAYOUT_PLAY_BUTTON,
+       CATEGORY_LAYOUT_NEXT_BUTTON,
+       CATEGORY_LAYOUT_LAST_BUTTON,
+       CATEGORY_LAYOUT_SELECT_ALL_BUTTON,
+       CATEGORY_LAYOUT_DONE_BUTTON,
+       CATEGORY_LAYOUT_CANCEL_BUTTON
+};
+
 enum EAddBtns {
        ABTN_PLAY,
        ABTN_NEXT,
@@ -65,7 +77,7 @@ struct SBtnInfo {
        const char *part;
        const char *style;
        const char *icon;
-       Evas_Smart_Cb cb;
+       EObjectType type;
 };
 
 struct SCategoryLayout {
@@ -151,8 +163,7 @@ void CCategoryLayout::m_OnEntrynameSet(const char *name)
 
        idlist = m_GetSelectedList(m->it_infolist, (int)ID_TYPE_MEDIA);
        str = strdup(name);
-       destroy_entry_popup(t.epopup);
-       t.epopup = NULL;
+       t.epopup->Destroy();
 
        if (!strcmp(str, MUSIC_STR_EMPTY)) {
                _create_message_box(Layout(), MUSIC_TEXT_EMPTY_NAME);
@@ -177,131 +188,6 @@ void CCategoryLayout::m_OnEntrynameSet(const char *name)
 }
 
 
-void CCategoryLayout::sm_CbSelectAllClicked(void *dt, Evas_Object *obj, void *ev)
-{
-       CCategoryLayout *root = (CCategoryLayout *)dt;
-       if (root)
-               root->m_OnSelectAllClicked(obj, ev);
-}
-
-
-void CCategoryLayout::m_OnSelectAllClicked(Evas_Object *obj, void *ev)
-{
-       Eina_List *l = NULL;
-       SCatItemInfo *itinfo = NULL;
-       void *list_obj = NULL;
-       int tc;
-
-       tc = eina_list_count(m->it_infolist);
-
-       if (m->count == tc) {
-               elm_object_text_set(m->select_btn[SBTN_SELECT_ALL],
-                       _(MUSIC_TEXT_SELECT_ALL));
-               m->count = 0;
-               EINA_LIST_FOREACH(m->it_infolist, l, list_obj) {
-                       itinfo = (SCatItemInfo *)list_obj;
-                       itinfo->check_status = false;
-               }
-               elm_genlist_realized_items_update(m->glist);
-
-               return;
-       }
-
-       elm_object_text_set(m->select_btn[SBTN_SELECT_ALL],
-               _(MUSIC_TEXT_DESELECT_ALL));
-       m->count = tc;
-       EINA_LIST_FOREACH(m->it_infolist, l, list_obj) {
-               itinfo = (SCatItemInfo *)list_obj;
-               itinfo->check_status = true;
-       }
-       elm_genlist_realized_items_update(m->glist);
-}
-
-
-void CCategoryLayout::sm_CbDoneBtnClicked(void *dt, Evas_Object *obj, void *ev)
-{
-       CCategoryLayout *root = (CCategoryLayout *)dt;
-       if (root)
-               root->m_OnDoneBtnClicked(obj, ev);
-}
-
-
-void CCategoryLayout::m_OnDoneBtnClicked(Evas_Object *obj, void *ev)
-{
-       if (t.sel_type == SELECT_ADD) {
-               m_AddSelectedSongs();
-               return;
-       }
-       else if (t.sel_type == SELECT_REMOVE) {
-               m_RemoveSelectedSongs();
-               return;
-       }
-
-       if (t.epopup)
-               destroy_entry_popup(t.epopup);
-
-       t.epopup = create_entry_popup(t.base, MUSIC_STR_EMPTY,
-               sm_CbEntrynameSet, this);
-}
-
-
-void CCategoryLayout::sm_CbCancelBtnClicked(void *dt, Evas_Object *obj, void *ev)
-{
-       CCategoryLayout *root = (CCategoryLayout *)dt;
-       if (root)
-               root->m_OnCancelBtnClicked(obj, ev);
-}
-
-       
-void CCategoryLayout::m_OnCancelBtnClicked(Evas_Object *obj, void *ev)
-{
-       t.depth = E_DEPTH_CATEGORY;
-       t_UpdateLayoutWithFocus();
-}
-
-
-void CCategoryLayout::sm_CbPlayBtnClicked(void *dt, Evas_Object *obj, void *ev)
-{
-       CCategoryLayout *root = (CCategoryLayout *)dt;
-       if (root)
-               root->m_OnPlayBtnClicked(obj, ev);
-}
-
-
-void CCategoryLayout::m_OnPlayBtnClicked(Evas_Object *obj, void *ev)
-{
-       m_GotoPlayback(ADD_TYPE_FRESH, NULL);
-}
-
-
-void CCategoryLayout::sm_CbNextBtnClicked(void *dt, Evas_Object *obj, void *ev)
-{
-       CCategoryLayout *root = (CCategoryLayout *)dt;
-       if (root)
-               root->m_OnNextBtnClicked(obj, ev);
-}
-
-
-void CCategoryLayout::m_OnNextBtnClicked(Evas_Object *obj, void *ev)
-{
-       m_GotoPlayback(ADD_TYPE_NEXT, NULL);
-}
-
-
-void CCategoryLayout::sm_CbLastBtnClicked(void *dt, Evas_Object *obj, void *ev)
-{
-       CCategoryLayout *root = (CCategoryLayout *)dt;
-       if (root)
-               root->m_OnLastBtnClicked(obj, ev);
-}
-
-
-void CCategoryLayout::m_OnLastBtnClicked(Evas_Object *obj, void *ev)
-{
-       m_GotoPlayback(ADD_TYPE_END, NULL);
-}
-
-
 char *CCategoryLayout::sm_CbGetSelectlistItemText(void *data, Evas_Object *obj, const char *part)
 {
        SCatItemInfo *itinfo = (SCatItemInfo *)data;
@@ -799,98 +685,6 @@ void CCategoryLayout::m_OnItemSelect(Elm_Object_Item *it, const char *emission,
 }
 
 
-void CCategoryLayout::sm_CbGengridRealized(void *data, Evas_Object *obj, void *event_info)
-{
-       if (!data || !obj || !event_info)
-               return;
-
-       elm_object_item_signal_callback_add((Elm_Object_Item *)event_info,
-               MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
-               sm_CbItemSelect, data);
-}
-
-
-void CCategoryLayout::sm_CbGengridUnrealized(void *data, Evas_Object *obj, void *event_info)
-{
-       if (!data || !obj || !event_info)
-               return;
-
-       elm_object_item_signal_callback_del((Elm_Object_Item *)event_info,
-               MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
-               sm_CbItemSelect);
-}
-
-
-void CCategoryLayout::sm_CbKeyDown(void *dt, Evas *e, Evas_Object *obj, void *ei)
-{
-       CCategoryLayout *root = (CCategoryLayout *)dt;
-
-       if (root)
-               root->m_OnKeyDown(e, obj, (Evas_Event_Key_Down*)ei);
-}
-
-
-void CCategoryLayout::m_OnKeyDown(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
-{
-       Elm_Object_Item *it = NULL;
-       SContentInfo *ctxtinfo = NULL;
-       SCatItemInfo *itinfo = NULL;
-
-       if (!obj)
-               return;
-
-       if (strcmp(ev->keyname, KEY_MENU) || t.depth ==
-               E_DEPTH_SELECT_LIST || t.depth ==
-               E_DEPTH_SHOW_LIST)
-               return;
-
-       it = elm_object_focused_item_get(obj);
-       if (!it) {
-               _ERR(" unable to get focused item ");
-               return;
-       }
-       t.focused_item = it;
-
-       if (t.ctxtinfo) {
-               free(t.ctxtinfo);
-               t.ctxtinfo = NULL;
-       }
-
-       ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
-       if (!ctxtinfo)
-               return;
-
-       itinfo = m_FindItemInfo(m->it_infolist, it);
-       if (!itinfo || itinfo->type == CAT_TYPE_PLAYLIST_NEW) {
-               free(ctxtinfo);
-               return;
-       }
-
-       ctxtinfo->cbdata = this;
-       ctxtinfo->update = sm_CbCtxtUpdate;
-       ctxtinfo->close = sm_CbCtxtClose;
-       if (t.depth == E_DEPTH_SONG) {
-               ctxtinfo->type = CONTEXT_TYPE_SONG;
-               ctxtinfo->context = itinfo->sinfo;
-       }
-       else if (t.depth == E_DEPTH_ALBUM) {
-               ctxtinfo->type = CONTEXT_TYPE_ALBUM;
-               ctxtinfo->context = itinfo->alinfo;
-       }
-       else {
-               ctxtinfo->type = t_ContextType();
-               ctxtinfo->context = itinfo->catinfo;
-       }
-
-       t.ctxtinfo = ctxtinfo;
-
-       SParcel parcel;
-       parcel.ctxtInfo = ctxtinfo;
-       if (!m->vmgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
-               _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
-}
-
-
 int CCategoryLayout::m_ConvertToMin(int milsec)
 {
        int min;
@@ -1143,10 +937,9 @@ Evas_Object *CCategoryLayout::m_AddGrid(void)
        evas_object_size_hint_weight_set(grid,
                EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        elm_gengrid_align_set(grid, 0, 0);
-       evas_object_event_callback_add(grid, EVAS_CALLBACK_MOUSE_MOVE, _gengrid_mouse_moved, this);
-       evas_object_smart_callback_add(grid, MUSIC_SIGNAL_REALIZED,    sm_CbGengridRealized, this);
-       evas_object_smart_callback_add(grid, MUSIC_SIGNAL_UNREALIZED,  sm_CbGengridUnrealized, this);
-       evas_object_event_callback_add(grid, EVAS_CALLBACK_KEY_DOWN,   sm_CbKeyDown, this);
+
+       Connect(grid, CATEGORY_LAYOUT_GENGRID, TYPE_MOUSE_MOVE | TYPE_KEY_DOWN | TYPE_REALIZED | TYPE_UNREALIZED);
+
        elm_gengrid_item_size_set(grid,
                elm_config_scale_get() * GENGRID_ITEM_SIZE_W,
                elm_config_scale_get() * GENGRID_ITEM_SIZE_H);
@@ -1188,19 +981,19 @@ void CCategoryLayout::m_AddButtons(void)
        btninfo[ABTN_PLAY].part = MUSIC_PART_CATEGORY_PLAYBTN;
        btninfo[ABTN_PLAY].style = MUSIC_STYLE_ADD_PLAY_BTN;
        btninfo[ABTN_PLAY].icon = MUSIC_IMAGE_ADD_PLAY;
-       btninfo[ABTN_PLAY].cb = sm_CbPlayBtnClicked;
+       btninfo[ABTN_PLAY].type = CATEGORY_LAYOUT_PLAY_BUTTON;
 
        btninfo[ABTN_NEXT].name = MUSIC_STR_ADDNEXT;
        btninfo[ABTN_NEXT].part = MUSIC_PART_CATEGORY_NEXTBTN;
        btninfo[ABTN_NEXT].style = MUSIC_STYLE_ADD_NEXT_BTN;
        btninfo[ABTN_NEXT].icon = MUSIC_IMAGE_ADD_NEXT;
-       btninfo[ABTN_NEXT].cb = sm_CbNextBtnClicked;
+       btninfo[ABTN_NEXT].type = CATEGORY_LAYOUT_NEXT_BUTTON;
 
        btninfo[ABTN_LAST].name = MUSIC_STR_ADDLAST;
        btninfo[ABTN_LAST].part = MUSIC_PART_CATEGORY_LASTBTN;
        btninfo[ABTN_LAST].style = MUSIC_STYLE_ADD_LAST_BTN;
        btninfo[ABTN_LAST].icon = MUSIC_IMAGE_ADD_LAST;
-       btninfo[ABTN_LAST].cb = sm_CbLastBtnClicked;
+       btninfo[ABTN_LAST].type = CATEGORY_LAYOUT_LAST_BUTTON;
 
        if (t.depth == E_DEPTH_SHOW_LIST) {
                btninfo[ABTN_PLAY].part = MUSIC_PART_ALBUM_PLAYBTN;
@@ -1217,10 +1010,8 @@ void CCategoryLayout::m_AddButtons(void)
                        EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                elm_object_text_set(m->add_btn[i], _(btninfo[i].name));
                elm_object_style_set(m->add_btn[i], btninfo[i].style);
-               evas_object_smart_callback_add(m->add_btn[i],
-                       MUSIC_SIGNAL_CLICKED, btninfo[i].cb, this);
-               evas_object_event_callback_add(m->add_btn[i],
-                       EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, this);
+
+               Connect(m->add_btn[i], btninfo[ABTN_LAST].type, TYPE_CLICKED | TYPE_MOUSE_MOVE);
 
                img = elm_image_add(m->add_btn[i]);
                if (img) {
@@ -1248,17 +1039,17 @@ void CCategoryLayout::m_AddSelectlistButtons(void)
        btninfo[SBTN_SELECT_ALL].name = MUSIC_TEXT_SELECT_ALL;
        btninfo[SBTN_SELECT_ALL].part = MUSIC_PART_LIST_SELECT_ALL;
        btninfo[SBTN_SELECT_ALL].style = MUSIC_STYLE_LIST_BTN;
-       btninfo[SBTN_SELECT_ALL].cb = sm_CbSelectAllClicked;
+       btninfo[SBTN_SELECT_ALL].type = CATEGORY_LAYOUT_SELECT_ALL_BUTTON;
 
        btninfo[SBTN_DONE].name = MUSIC_TEXT_LIST_DONE;
        btninfo[SBTN_DONE].part = MUSIC_PART_LIST_DONE_BTN;
        btninfo[SBTN_DONE].style = MUSIC_STYLE_LIST_BTN;
-       btninfo[SBTN_DONE].cb = sm_CbDoneBtnClicked;
+       btninfo[SBTN_DONE].type = CATEGORY_LAYOUT_DONE_BUTTON;
 
        btninfo[SBTN_CANCEL].name = MUSIC_TEXT_LIST_CANCEL;
        btninfo[SBTN_CANCEL].part = MUSIC_PART_LIST_CANCEL_BTN;
        btninfo[SBTN_CANCEL].style = MUSIC_STYLE_LIST_BTN;
-       btninfo[SBTN_CANCEL].cb = sm_CbCancelBtnClicked;
+       btninfo[SBTN_CANCEL].type = CATEGORY_LAYOUT_CANCEL_BUTTON;
 
        if (t.sel_type == SELECT_CREATE) {
                elm_object_part_text_set(Layout(), MUSIC_PART_LIST_MSG,
@@ -1282,10 +1073,8 @@ void CCategoryLayout::m_AddSelectlistButtons(void)
                        EVAS_HINT_EXPAND);
                elm_object_text_set(btn, _(btninfo[i].name));
                elm_object_style_set(btn, btninfo[i].style);
-               evas_object_smart_callback_add(btn, MUSIC_SIGNAL_CLICKED,
-                       btninfo[i].cb, this);
-               evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE,
-                       _object_mouse_moved, this);
+
+               Connect(btn, btninfo[i].type, TYPE_MOUSE_MOVE | TYPE_CLICKED);
 
                elm_object_part_content_set(Layout(), btninfo[i].part, btn);
                m->select_btn[i] = btn;
@@ -1368,8 +1157,9 @@ void CCategoryLayout::m_CreateSongList(void)
        evas_object_size_hint_weight_set(genlist,
                EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        elm_object_part_content_set(Layout(), MUSIC_PART_SONGLIST, genlist);
-       evas_object_event_callback_add(genlist, EVAS_CALLBACK_MOUSE_MOVE, _genlist_mouse_moved, this);
-       evas_object_event_callback_add(genlist, EVAS_CALLBACK_KEY_DOWN,   sm_CbKeyDown, this);
+
+       Connect(genlist, CATEGORY_LAYOUT_GENLIST, TYPE_MOUSE_MOVE | TYPE_KEY_DOWN);
+
        m->glist = genlist;
 
        list_item = elm_genlist_item_class_new();
@@ -1782,6 +1572,16 @@ bool CCategoryLayout::Create(CLayoutMgr *mgr)
                return false;
        }
 
+       t.epopup = new CEntryPopup;
+       if (!t.epopup) {
+               _ERR(" CEntryPopup creation failed ");
+               CExtBaseLayout::Destroy();
+               evas_object_del(layout);
+               delete m;
+               m = NULL;
+               return false;
+       }
+
        m->win = win;
        t.base = base;
        m->vmgr = vmgr;
@@ -1790,7 +1590,8 @@ bool CCategoryLayout::Create(CLayoutMgr *mgr)
        t.depth = E_DEPTH_CATEGORY;
 
        t_UpdateLayout(false);
-       Connect(Layout());
+
+       Connect(Layout(), CATEGORY_LAYOUT, TYPE_KEY_DOWN);
 
        return true;
 }
@@ -1801,14 +1602,15 @@ void CCategoryLayout::Destroy(void)
        ASSERT(m);
 
        Disconnect(Layout());
-       if (t.epopup)
-               destroy_entry_popup(t.epopup);
+       if (t.epopup->FlagCreate())
+               t.epopup->Destroy();
 
        m_RemoveFocusIdler();
        m_EmptyLayout(false);
        category_info_destroy(t.c_catinfo);
        album_info_destroy(t.c_alinfo);
        song_info_destroy(m->c_sinfo);
+       delete t.epopup;
        CExtBaseLayout::Destroy();
        evas_object_del(Layout());
 
@@ -1836,6 +1638,8 @@ void CCategoryLayout::Update(bool focusFlag)
                if (t.depth != E_DEPTH_CATEGORY)
                        return;
                t_UpdateLayout(true);
+               elm_object_part_content_set(t.base, MUSIC_PART_CONTENT, Layout());
+               evas_object_show(Layout());
                return;
        }
 
@@ -1845,39 +1649,270 @@ void CCategoryLayout::Update(bool focusFlag)
 
 void CCategoryLayout::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
 {
-       int count;
-       Eina_List *alist = NULL;
+       switch (id) {
+       case CATEGORY_LAYOUT:
+               {
+                       int count;
+                       Eina_List *alist = NULL;
+
+                       if (!strcmp(ev->keyname, KEY_BACK)) {
+                               if (t.depth == E_DEPTH_CATEGORY) {
+                                       SParcel parcel;
+                                       parcel.ctxtInfo = NULL;
+                                       parcel.updateType = E_FOCUS_UPDATE;
+                                       parcel.layoutId = NULL;
+                                       parcel.keyEvent = NULL;
+                                       m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
+                                       return;
+                               }
+                               else if (t.depth == E_DEPTH_ALBUM) {
+                                       t.depth = E_DEPTH_CATEGORY;
+                               }
+                               else if (t.depth == E_DEPTH_SELECT_LIST) {
+                                       t.depth = E_DEPTH_CATEGORY;
+                               }
+                               else if (t.depth == E_DEPTH_SHOW_LIST) {
+                                       t.depth = E_DEPTH_CATEGORY;
+                               }
+                               else if (t.depth == E_DEPTH_SONG) {
+                                       count = 0;
+                                       alist = category_info_get_albumlist(t.c_catinfo);
+                                       if (alist)
+                                               count = eina_list_count(alist);
+                                       if (count == 1)
+                                               t.depth = E_DEPTH_CATEGORY;
+                                       else
+                                               t.depth = E_DEPTH_ALBUM;
+                               }
+
+                               t_UpdateLayoutWithFocus();
+                       }
+               }
+               break;
+
+       case CATEGORY_LAYOUT_GENGRID:
+       case CATEGORY_LAYOUT_GENLIST:
+               {
+                       Elm_Object_Item *it = NULL;
+                       SContentInfo *ctxtinfo = NULL;
+                       SCatItemInfo *itinfo = NULL;
+
+                       if (!obj)
+                               return;
+
+                       if (strcmp(ev->keyname, KEY_MENU) || t.depth ==
+                               E_DEPTH_SELECT_LIST || t.depth ==
+                               E_DEPTH_SHOW_LIST)
+                               return;
+
+                       it = elm_object_focused_item_get(obj);
+                       if (!it) {
+                               _ERR(" unable to get focused item ");
+                               return;
+                       }
+                       t.focused_item = it;
+
+                       if (t.ctxtinfo) {
+                               free(t.ctxtinfo);
+                               t.ctxtinfo = NULL;
+                       }
+
+                       ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
+                       if (!ctxtinfo)
+                               return;
+
+                       itinfo = m_FindItemInfo(m->it_infolist, it);
+                       if (!itinfo || itinfo->type == CAT_TYPE_PLAYLIST_NEW) {
+                               free(ctxtinfo);
+                               return;
+                       }
+
+                       ctxtinfo->cbdata = this;
+                       ctxtinfo->update = sm_CbCtxtUpdate;
+                       ctxtinfo->close = sm_CbCtxtClose;
+                       if (t.depth == E_DEPTH_SONG) {
+                               ctxtinfo->type = CONTEXT_TYPE_SONG;
+                               ctxtinfo->context = itinfo->sinfo;
+                       }
+                       else if (t.depth == E_DEPTH_ALBUM) {
+                               ctxtinfo->type = CONTEXT_TYPE_ALBUM;
+                               ctxtinfo->context = itinfo->alinfo;
+                       }
+                       else {
+                               ctxtinfo->type = t_ContextType();
+                               ctxtinfo->context = itinfo->catinfo;
+                       }
+
+                       t.ctxtinfo = ctxtinfo;
 
-       if (!strcmp(ev->keyname, KEY_BACK)) {
-               if (t.depth == E_DEPTH_CATEGORY) {
                        SParcel parcel;
-                       parcel.ctxtInfo = NULL;
-                       parcel.updateType = E_FOCUS_UPDATE;
-                       parcel.layoutId = NULL;
-                       parcel.keyEvent = NULL;
-                       m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
-                       return;
+                       parcel.ctxtInfo = ctxtinfo;
+                       if (!m->vmgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
+                               _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
                }
-               else if (t.depth == E_DEPTH_ALBUM) {
-                       t.depth = E_DEPTH_CATEGORY;
+               break;
+
+       default:
+               break;
+       }
+}
+
+
+void CCategoryLayout::OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+{
+       switch (id) {
+       case CATEGORY_LAYOUT_GENGRID:
+               {
+                       Elm_Object_Item *item;
+
+                       if (!obj)
+                               return;
+
+                       item = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
+                               ev->cur.canvas.y, NULL, NULL);
+                       if (!item)
+                               return;
+
+                       if (!elm_object_item_focus_get(item))
+                               elm_object_item_focus_set(item, EINA_TRUE);
                }
-               else if (t.depth == E_DEPTH_SELECT_LIST) {
-                       t.depth = E_DEPTH_CATEGORY;
+               break;
+
+       case CATEGORY_LAYOUT_GENLIST:
+               {
+                       Elm_Object_Item *item;
+
+                       if (!obj)
+                               return;
+
+                       item = elm_genlist_at_xy_item_get(obj, ev->cur.canvas.x,
+                               ev->cur.canvas.y, NULL);
+
+                       if (!elm_object_item_focus_get(item))
+                               elm_object_item_focus_set(item, EINA_TRUE);
                }
-               else if (t.depth == E_DEPTH_SHOW_LIST) {
-                       t.depth = E_DEPTH_CATEGORY;
+               break;
+
+       case CATEGORY_LAYOUT_PLAY_BUTTON:
+       case CATEGORY_LAYOUT_NEXT_BUTTON:
+       case CATEGORY_LAYOUT_LAST_BUTTON:
+       case CATEGORY_LAYOUT_SELECT_ALL_BUTTON:
+       case CATEGORY_LAYOUT_DONE_BUTTON:
+       case CATEGORY_LAYOUT_CANCEL_BUTTON:
+               if (!elm_object_focus_get(obj))
+                       elm_object_focus_set(obj, EINA_TRUE);
+               break;
+
+       default:
+               break;
+       }
+}
+
+
+void CCategoryLayout::OnMouseClicked(int id, Evas_Object *obj)
+{
+       switch (id) {
+       case CATEGORY_LAYOUT_PLAY_BUTTON:
+               m_GotoPlayback(ADD_TYPE_FRESH, NULL);
+               break;
+
+       case CATEGORY_LAYOUT_NEXT_BUTTON:
+               m_GotoPlayback(ADD_TYPE_NEXT, NULL);
+               break;
+
+       case CATEGORY_LAYOUT_LAST_BUTTON:
+               m_GotoPlayback(ADD_TYPE_END, NULL);
+               break;
+
+       case CATEGORY_LAYOUT_SELECT_ALL_BUTTON:
+               {
+                       Eina_List *l = NULL;
+                       SCatItemInfo *itinfo = NULL;
+                       void *list_obj = NULL;
+                       int tc;
+
+                       tc = eina_list_count(m->it_infolist);
+
+                       if (m->count == tc) {
+                               elm_object_text_set(m->select_btn[SBTN_SELECT_ALL],
+                                       _(MUSIC_TEXT_SELECT_ALL));
+                               m->count = 0;
+                               EINA_LIST_FOREACH(m->it_infolist, l, list_obj) {
+                                       itinfo = (SCatItemInfo *)list_obj;
+                                       itinfo->check_status = false;
+                               }
+                               elm_genlist_realized_items_update(m->glist);
+
+                               return;
+                       }
+
+                       elm_object_text_set(m->select_btn[SBTN_SELECT_ALL],
+                               _(MUSIC_TEXT_DESELECT_ALL));
+                       m->count = tc;
+                       EINA_LIST_FOREACH(m->it_infolist, l, list_obj) {
+                               itinfo = (SCatItemInfo *)list_obj;
+                               itinfo->check_status = true;
+                       }
+                       elm_genlist_realized_items_update(m->glist);
                }
-               else if (t.depth == E_DEPTH_SONG) {
-                       count = 0;
-                       alist = category_info_get_albumlist(t.c_catinfo);
-                       if (alist)
-                               count = eina_list_count(alist);
-                       if (count == 1)
-                               t.depth = E_DEPTH_CATEGORY;
-                       else
-                               t.depth = E_DEPTH_ALBUM;
+               break;
+
+       case CATEGORY_LAYOUT_DONE_BUTTON:
+               {
+                       if (t.sel_type == SELECT_ADD) {
+                               m_AddSelectedSongs();
+                               return;
+                       }
+                       else if (t.sel_type == SELECT_REMOVE) {
+                               m_RemoveSelectedSongs();
+                               return;
+                       }
+
+                       if (t.epopup->FlagCreate())
+                               t.epopup->Destroy();
+
+                       t.epopup->Create(t.base, MUSIC_STR_EMPTY, sm_CbEntrynameSet, this);
                }
+               break;
+
+       case CATEGORY_LAYOUT_CANCEL_BUTTON:
+               {
+                       t.depth = E_DEPTH_CATEGORY;
+                       t_UpdateLayoutWithFocus();
+               }
+               break;
+
+       default:
+               break;
+       }
+}
+
+
+void CCategoryLayout::OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+{
+       switch (id) {
+       case CATEGORY_LAYOUT_GENGRID:
+               elm_object_item_signal_callback_add(item,
+                       MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
+                       sm_CbItemSelect, this);
+               break;
+
+       default:
+               break;
+       }
+}
+
+
+void CCategoryLayout::OnUnrealized(int id, Evas_Object *obj, Elm_Object_Item *item)
+{
+       switch (id) {
+       case CATEGORY_LAYOUT_GENGRID:
+               elm_object_item_signal_callback_del(item,
+                       MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
+                       sm_CbItemSelect);
+               break;
 
-               t_UpdateLayoutWithFocus();
+       default:
+               break;
        }
 }
index a222f58..8d88779 100644 (file)
 #include "define.h"
 #include "common.h"
 #include "common-ui.h"
+#include "dbg.h"
+#include <AppCommon.h>
+#include <InputHandler.h>
 #include "entry-popup.h"
 
 //#define KEY_SELECT "Select"
 #define KEY_POPUP_ENTER "Return"
 
-struct entrypopup_data {
+
+struct SEntryPopup {
        Evas_Object *layout;
        Evas_Object *entry;
-       void (*entryname_cb)(void *, const char *);
+       void(*cbEntryName)(void *, const char *);
        void *data;
        Ecore_Idler *idler;
 };
 
-static void _entry_key_pressed(void *dt, Evas *e, Evas_Object *obj, void *ei)
-{
-       struct entrypopup_data *epd;
-       Evas_Event_Key_Down *ev;
-       const char *str;
-
-       if (!obj || !e || !ei || !dt)
-               return;
-
-       epd = (entrypopup_data *)dt;
-       ev = (Evas_Event_Key_Down *)ei;
 
-       if (!ev->keyname)
-               return;
-
-       if (strcmp(ev->keyname, KEY_BACK) == 0)
-               destroy_entry_popup(epd->layout);
-       // Keyname should be checked!!!
-       else if (strcmp(ev->keyname, KEY_POPUP_ENTER/*KEY_SELECT*/) == 0) {
-               str = elm_entry_entry_get(obj);
-               if (epd->entryname_cb && str)
-                       epd->entryname_cb(epd->data, str);
-       }
-}
-
-static Eina_Bool _focus_idler_cb(void *dt)
+Eina_Bool CEntryPopup::sm_CbFocusIdler(void *dt)
 {
-       struct entrypopup_data *epd;
-
-       if (!dt)
-               return ECORE_CALLBACK_CANCEL;
-
-       epd = (entrypopup_data *)dt;
-       epd->idler = NULL;
-       elm_object_focus_set(epd->entry, EINA_TRUE);
-
+       CEntryPopup *root = (CEntryPopup *)dt;
+       if (root)
+               root->m_OnFocusIdler();
        return ECORE_CALLBACK_CANCEL;
 }
 
-void destroy_entry_popup(Evas_Object *layout)
-{
-       struct entrypopup_data *epd;
-
-       if (!layout)
-               return;
-
-       epd = (entrypopup_data *)evas_object_data_get(layout, MUSIC_ENTRY_POPUP_DATA);
-       if (epd) {
-               if (epd->idler)
-                       ecore_idler_del(epd->idler);
-               free(epd);
-       }
 
-       evas_object_del(layout);
+void CEntryPopup::m_OnFocusIdler(void)
+{
+       m->idler = NULL;
+       elm_object_focus_set(m->entry, EINA_TRUE);
 }
 
-Evas_Object *create_entry_popup(Evas_Object *base, const char *text,
-               void (*entryname_cb)(void *, const char *), void *data)
+
+bool CEntryPopup::Create(Evas_Object *base, const char *text, void(*cbEntryName)(void *, const char *), void *data)
 {
+       ASSERT(!m);
+
        Evas_Object *layout, *entry;
-       struct entrypopup_data *epd;
 
        if (!base)
                return NULL;
 
+       m = new SEntryPopup;
+       if (!m) {
+               return NULL;
+       }
+
        layout = elm_layout_add(base);
-       if (!layout)
+       if (!layout) {
+               delete m;
                return NULL;
+       }
 
        elm_layout_file_set(layout, EDJEFILE, MUSIC_ENTRY_POPUP_LAYOUT);
        evas_object_size_hint_weight_set(layout,
-                       EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(layout,
-                       EVAS_HINT_FILL, EVAS_HINT_FILL);
+               EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_show(layout);
 
        entry = elm_entry_add(layout);
        if (!entry) {
                evas_object_del(layout);
+               delete m;
                return NULL;
        }
 
        elm_object_style_set(entry, MUSIC_STYLE_ENTRY);
        elm_entry_single_line_set(entry, EINA_TRUE);
        elm_entry_input_panel_language_set(entry,
-                       ELM_INPUT_PANEL_LANG_ALPHABET);
+               ELM_INPUT_PANEL_LANG_ALPHABET);
        evas_object_size_hint_weight_set(entry,
-                       EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(entry,
-                       EVAS_HINT_FILL, EVAS_HINT_FILL);
+               EVAS_HINT_FILL, EVAS_HINT_FILL);
 
        if (text)
                elm_entry_entry_set(entry, text);
        elm_entry_cursor_end_set(entry);
        elm_object_part_content_set(layout, MUSIC_PART_ENTRY, entry);
 
-       epd = (entrypopup_data *)calloc(1, sizeof(*epd));
-       if (!epd) {
-               evas_object_del(layout);
-               return NULL;
-       }
+       m->layout = layout;
+       m->entry = entry;
+       m->cbEntryName = cbEntryName;
+       m->data = data;
+       m->idler = ecore_idler_add(sm_CbFocusIdler, this);
+
+       Connect(entry);
+}
 
-       epd->layout = layout;
-       epd->entry = entry;
-       epd->entryname_cb = entryname_cb;
-       epd->data = data;
-       epd->idler = ecore_idler_add(_focus_idler_cb, epd);
 
-       evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN,
-                       _entry_key_pressed, epd);
-       evas_object_data_set(layout, MUSIC_ENTRY_POPUP_DATA, epd);
+void CEntryPopup::Destroy(void)
+{
+       ASSERT(m);
+
+       if (m->idler)
+               ecore_idler_del(m->idler);
+
+       evas_object_del(m->layout);
+       delete m;
+}
+
+
+bool CEntryPopup::FlagCreate(void)
+{
+       return !!m;
+}
 
-       return layout;
+
+void CEntryPopup::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+       const char *str;
+
+       if (!obj || !e)
+               return;
+
+       if (!ev->keyname)
+               return;
+
+       if (strcmp(ev->keyname, KEY_BACK) == 0)
+               Destroy();
+       // Keyname should be checked!!!
+       else if (strcmp(ev->keyname, KEY_POPUP_ENTER/*KEY_SELECT*/) == 0) {
+               str = elm_entry_entry_get(obj);
+               if (m->cbEntryName && str)
+                       m->cbEntryName(m->data, str);
+       }
 }
index fadc726..2f00aab 100644 (file)
 
 
 enum EObjectType {
+       FOLDER_LAYOUT,
+       FOLDER_LAYOUT_GENGRID,
        FOLDER_LAYOUT_PLAY_BUTTON,
        FOLDER_LAYOUT_NEXT_BUTTON,
        FOLDER_LAYOUT_LAST_BUTTON,
-       FOLDER_LAYOUT,
-       FOLDER_LAYOUT_GENGRID,
+};
+
+enum EBtnType {
+       BTN_PLAY,
+       BTN_NEXT,
+       BTN_LAST
 };
 
 struct SFolderItemInfo {
@@ -72,6 +78,7 @@ struct SBtnInfo {
        const char *part;
        const char *style;
        const char *icon;
+       EObjectType type;
 };
 
 struct SFolderLayout {
@@ -659,20 +666,23 @@ void CFolderLayout::m_CreateTopsection(void)
        Evas_Object *img;
        SBtnInfo btninfo[TOTAL_ADD_BTNS];
 
-       btninfo[FOLDER_LAYOUT_PLAY_BUTTON].name = MUSIC_STR_PLAY;
-       btninfo[FOLDER_LAYOUT_PLAY_BUTTON].part = MUSIC_PART_FOLDER_PLAYBTN;
-       btninfo[FOLDER_LAYOUT_PLAY_BUTTON].style = MUSIC_STYLE_ADD_PLAY_BTN;
-       btninfo[FOLDER_LAYOUT_PLAY_BUTTON].icon = MUSIC_IMAGE_ADD_PLAY;
+       btninfo[BTN_PLAY].name = MUSIC_STR_PLAY;
+       btninfo[BTN_PLAY].part = MUSIC_PART_FOLDER_PLAYBTN;
+       btninfo[BTN_PLAY].style = MUSIC_STYLE_ADD_PLAY_BTN;
+       btninfo[BTN_PLAY].icon = MUSIC_IMAGE_ADD_PLAY;
+       btninfo[BTN_PLAY].type = FOLDER_LAYOUT_PLAY_BUTTON;
 
-       btninfo[FOLDER_LAYOUT_NEXT_BUTTON].name = MUSIC_STR_ADDNEXT;
-       btninfo[FOLDER_LAYOUT_NEXT_BUTTON].part = MUSIC_PART_FOLDER_NEXTBTN;
-       btninfo[FOLDER_LAYOUT_NEXT_BUTTON].style = MUSIC_STYLE_ADD_NEXT_BTN;
-       btninfo[FOLDER_LAYOUT_NEXT_BUTTON].icon = MUSIC_IMAGE_ADD_NEXT;
+       btninfo[BTN_NEXT].name = MUSIC_STR_ADDNEXT;
+       btninfo[BTN_NEXT].part = MUSIC_PART_FOLDER_NEXTBTN;
+       btninfo[BTN_NEXT].style = MUSIC_STYLE_ADD_NEXT_BTN;
+       btninfo[BTN_NEXT].icon = MUSIC_IMAGE_ADD_NEXT;
+       btninfo[BTN_NEXT].type = FOLDER_LAYOUT_NEXT_BUTTON;
 
-       btninfo[FOLDER_LAYOUT_LAST_BUTTON].name = MUSIC_STR_ADDLAST;
-       btninfo[FOLDER_LAYOUT_LAST_BUTTON].part = MUSIC_PART_FOLDER_LASTBTN;
-       btninfo[FOLDER_LAYOUT_LAST_BUTTON].style = MUSIC_STYLE_ADD_LAST_BTN;
-       btninfo[FOLDER_LAYOUT_LAST_BUTTON].icon = MUSIC_IMAGE_ADD_LAST;
+       btninfo[BTN_LAST].name = MUSIC_STR_ADDLAST;
+       btninfo[BTN_LAST].part = MUSIC_PART_FOLDER_LASTBTN;
+       btninfo[BTN_LAST].style = MUSIC_STYLE_ADD_LAST_BTN;
+       btninfo[BTN_LAST].icon = MUSIC_IMAGE_ADD_LAST;
+       btninfo[BTN_LAST].type = FOLDER_LAYOUT_LAST_BUTTON;
 
        for (i = 0; i < TOTAL_ADD_BTNS; i++) {
                btn = elm_button_add(Layout());
@@ -684,7 +694,7 @@ void CFolderLayout::m_CreateTopsection(void)
                elm_object_text_set(btn, _(btninfo[i].name));
                elm_object_style_set(btn, btninfo[i].style);
 
-               Connect(btn, i, TYPE_MOUSE_MOVE | TYPE_CLICKED);
+               Connect(btn, btninfo[i].type, TYPE_MOUSE_MOVE | TYPE_CLICKED);
 
                img = elm_image_add(btn);
                if (img) {
index 612fa05..1dbfe4a 100644 (file)
@@ -128,7 +128,6 @@ struct SBtnInfo {
        const char *txt;
        const char *part;
        EEvasObject type;
-       //Evas_Smart_Cb cb;
 };
 
 enum EPressTypes {
@@ -742,8 +741,7 @@ void CPlaybackView::m_CreateErrorPopup(void)
        m->eoErrPopup = popup;
 
        Connect(btn, EO_ERROR_POPUP_BUTTON, TYPE_CLICKED | TYPE_KEY_DOWN);
-       //evas_object_smart_callback_add(btn, MUSIC_SIGNAL_CLICKED,   sm_CbPopupOkBtnClicked, m);
-       //evas_object_event_callback_add(btn, EVAS_CALLBACK_KEY_DOWN, sm_CbPopupOkKeyPressed, m);
+
        elm_object_focus_set(btn, EINA_TRUE);
 
        return;
@@ -769,11 +767,9 @@ void CPlaybackView::m_CreateSettingsPopup(void)
        SBtnInfo btninfo[TOTAL_SETTING_BTNS];
 
        btninfo[BTN_EDIT].txt = MUSIC_TEXT_EDIT_PLAYLIST;
-       //btninfo[BTN_EDIT].cb = sm_CbEditBtnClicked;
        btninfo[BTN_EDIT].type = EO_EDIT_PLAYLIST;
 
        btninfo[BTN_CLEAR].txt = MUSIC_TEXT_CLEAR_PLAYLIST;
-       //btninfo[BTN_CLEAR].cb = sm_CbClearBtnClicked;
        btninfo[BTN_CLEAR].type = EO_CLEAR_PLAYLIST;
 
        eoCtxPopup = elm_ctxpopup_add(m->eoWin);
@@ -804,8 +800,6 @@ void CPlaybackView::m_CreateSettingsPopup(void)
                elm_object_text_set(m->eoBtnSetting[i], _(btninfo[i].txt));
 
                Connect(m->eoBtnSetting[i], btninfo[i].type, TYPE_CLICKED | TYPE_MOUSE_MOVE);
-               //evas_object_smart_callback_add(m->eoBtnSetting[i], MUSIC_SIGNAL_CLICKED, btninfo[i].cb, m);
-               //evas_object_event_callback_add(m->eoBtnSetting[i], EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
 
                evas_object_show(m->eoBtnSetting[i]);
        }
@@ -815,7 +809,6 @@ void CPlaybackView::m_CreateSettingsPopup(void)
 
        scale = elm_config_scale_get();
        Connect(box, EO_BOX, TYPE_KEY_DOWN);
-       //evas_object_event_callback_add(box, EVAS_CALLBACK_KEY_DOWN,     sm_CbPopupKeyPressed, m);
        elm_object_part_content_set(m->eoBase, MUSIC_PART_SETTINGS_POPUP, eoCtxPopup);
 
        /* If list empty disable these options */
@@ -1066,7 +1059,6 @@ void CPlaybackView::m_KeyNextUnpress(void)
                return;
 
        m_HandleOnUnpressed(m->eoBtnControl[BTN_FORWARD]);
-       //sm_CbOnUnpressed(m, m->eoBtnControl[BTN_FORWARD], NULL);
 }
 
 
@@ -1076,7 +1068,6 @@ void CPlaybackView::m_KeyPreviousUnpress(void)
                return;
 
        m_HandleOnUnpressed(m->eoBtnControl[BTN_REWIND]);
-       //sm_CbOnUnpressed(m, m->eoBtnControl[BTN_REWIND], NULL);
 }
 
 
@@ -1095,11 +1086,11 @@ void CPlaybackView::m_HandleKeyPress(char *keyname)
        else if (strcmp(keyname, (char*)KEY_PREVIOUS) == 0)
                m_KeyPreviousPress();
        else if (strcmp(keyname, (char*)KEY_VOLUMEUP) == 0)
-               m->pHandleVolume->Up(); //m_KeyVolumeupPress();
+               m->pHandleVolume->Up();
        else if (strcmp(keyname, (char*)KEY_VOLUMEDOWN) == 0)
-               m->pHandleVolume->Down();// m_KeyVolumedownPress();
+               m->pHandleVolume->Down();
        else if (strcmp(keyname, (char*)KEY_MUTE) == 0)
-               m->pHandleVolume->Mute(); // m_KeyMutePress();
+               m->pHandleVolume->Mute();
 }
 
 
@@ -1127,8 +1118,7 @@ void CPlaybackView::m_AddSlider(void)
        elm_object_part_content_set(m->eoBase, MUSIC_PART_PROGRESSBAR, eoSlider);
 
        Connect(eoSlider, EO_SLIDER, TYPE_CHANGED | TYPE_MOUSE_MOVE);
-       //evas_object_smart_callback_add(eoSlider, MUSIC_SIGNAL_CHANGED,    sm_CbSliderValueChanged, m);
-       //evas_object_event_callback_add(eoSlider, EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
+
        evas_object_show(eoSlider);
        m->eoSlider = eoSlider;
 }
@@ -1168,15 +1158,12 @@ void CPlaybackView::m_AddEditPlaylistButtons(void)
        SBtnInfo btninfo[TOTAL_EDIT_BTNS];
 
        btninfo[BTN_CANCEL].txt = MUSIC_TEXT_CANCEL;
-       //btninfo[BTN_CANCEL].cb = sm_CbCancelBtnClicked;
        btninfo[BTN_CANCEL].type = EO_CANCEL;
 
        btninfo[BTN_DESELECT].txt = MUSIC_TEXT_DESELECT;
-       //btninfo[BTN_DESELECT].cb = sm_CbDeselectBtnClicked;
        btninfo[BTN_DESELECT].type = EO_DESELECT;
 
        btninfo[BTN_DELETE].txt = MUSIC_TEXT_DELETE;
-       //btninfo[BTN_DELETE].cb = sm_CbDeleteBtnClicked;
        btninfo[BTN_DELETE].type = EO_DELETE;
 
        box = _add_box(m->eoBase);
@@ -1199,8 +1186,7 @@ void CPlaybackView::m_AddEditPlaylistButtons(void)
                elm_box_pack_end(box, m->eoBtnEdit[i]);
                elm_object_text_set(m->eoBtnEdit[i], _(btninfo[i].txt));
 
-               //evas_object_smart_callback_add(m->eoBtnEdit[i], MUSIC_SIGNAL_CLICKED, btninfo[i].cb, m);
-               //evas_object_event_callback_add(m->eoBtnEdit[i], EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
+               Connect(m->eoBtnEdit[i], btninfo[i].type, TYPE_CLICKED | TYPE_MOUSE_MOVE);
 
                evas_object_show(m->eoBtnEdit[i]);
        }
@@ -1217,22 +1203,18 @@ void CPlaybackView::m_AddControlButtons(void)
        SBtnInfo btninfo[TOTAL_CONTROL_BTNS];
 
        btninfo[BTN_SETTINGS].txt = MUSIC_STYLE_BTN_SETTINGS;
-       //btninfo[BTN_SETTINGS].cb = sm_CbSettingsBtnClicked;
        btninfo[BTN_SETTINGS].type = EO_BTN_SETTINGS;
 
        btninfo[BTN_SHUFFLE].txt = MUSIC_STYLE_BTN_SHUFFLE;
-       //btninfo[BTN_SHUFFLE].cb = sm_CbShuffleBtnClicked;
        btninfo[BTN_SHUFFLE].type = EO_BTN_SHUFFLE;
 
        btninfo[BTN_REPEAT].txt = MUSIC_STYLE_BTN_REPEAT;
-       //btninfo[BTN_REPEAT].cb = sm_CbRepeatBtnClicked;
        btninfo[BTN_REPEAT].type = EO_BTN_REPEAT;
 
        btninfo[BTN_REWIND].txt = MUSIC_STYLE_BTN_REWIND;
        btninfo[BTN_REWIND].type = EO_BTN_REWIND;
 
        btninfo[BTN_PLAY].txt = MUSIC_STYLE_BTN_PLAY;
-       //btninfo[BTN_PLAY].cb = sm_CbPlayBtnClicked;
        btninfo[BTN_PLAY].type = EO_BTN_PLAY;
 
        btninfo[BTN_FORWARD].txt = MUSIC_STYLE_BTN_FORWARD;
@@ -1260,14 +1242,10 @@ void CPlaybackView::m_AddControlButtons(void)
 
                if (i == BTN_REWIND || i == BTN_FORWARD) {
                        Connect(m->eoBtnControl[i], btninfo[i].type, TYPE_PRESSED | TYPE_UNPRESSED | TYPE_MOUSE_MOVE);
-                       //evas_object_smart_callback_add(m->eoBtnControl[i], MUSIC_SIGNAL_PRESSED, sm_CbOnPressed, m);
-                       //evas_object_smart_callback_add(m->eoBtnControl[i], MUSIC_SIGNAL_UNPRESSED, sm_CbOnUnpressed, m);
                }
                else {
                        Connect(m->eoBtnControl[i], btninfo[i].type, TYPE_CLICKED | TYPE_MOUSE_MOVE);
-                       //evas_object_smart_callback_add(m->eoBtnControl[i], MUSIC_SIGNAL_CLICKED, btninfo[i].cb, m);
                }
-               //evas_object_event_callback_add(m->eoBtnControl[i], EVAS_CALLBACK_MOUSE_MOVE, _object_mouse_moved, m);
                evas_object_show(m->eoBtnControl[i]);
        }
 
@@ -1484,11 +1462,7 @@ void CPlaybackView::m_AddGenlist(void)
        elm_genlist_multi_select_set(genlist, EINA_FALSE);
 
        Connect(genlist, EO_PLAYLIST, TYPE_REALIZED | TYPE_UNREALIZED | TYPE_MOUSE_MOVE | TYPE_KEY_DOWN | TYPE_ACTIVATED);
-       //evas_object_smart_callback_add(genlist, MUSIC_SIGNAL_ACTIVATED,   sm_CbGenlistItemActivated, m);
-       //evas_object_smart_callback_add(genlist, MUSIC_SIGNAL_REALIZED,    sm_CbGenlistRealized, m);
-       //evas_object_smart_callback_add(genlist, MUSIC_SIGNAL_UNREALIZED,  sm_CbGenlistUnrealized, m);
-       //evas_object_event_callback_add(genlist, EVAS_CALLBACK_MOUSE_MOVE, _genlist_mouse_moved, m);
-       //evas_object_event_callback_add(genlist, EVAS_CALLBACK_KEY_DOWN,   sm_CbKeyDown, m);
+
        evas_object_show(genlist);
        m->eoPlaylist = genlist;
 }
@@ -1693,12 +1667,8 @@ bool CPlaybackView::Create(void *data)
        m_UpdatePlaymodeFocusSequence();
 
        Connect(m->eoBase, EO_BASE, TYPE_KEY_DOWN | TYPE_KEY_UP);
-       //evas_object_event_callback_add(eoBase, EVAS_CALLBACK_KEY_DOWN, sm_CbKeyPressed, m);
-       //evas_object_event_callback_add(eoBase, EVAS_CALLBACK_KEY_UP,   sm_CbKeyReleased, m);
 
        m->hMusicController->AddListener(this);
-       //m->cbInfo[E_SONG_COMPLETE] = m->hMusicController->AddCallback(E_SONG_COMPLETE, sm_CbUpdateCurrentSongInfo, m);
-       //m->cbInfo[E_PLAYBACK_ERROR] = m->hMusicController->AddCallback(E_PLAYBACK_ERROR, sm_CbPlaybackError, m);
 
        return true;
 }
@@ -1709,8 +1679,6 @@ void CPlaybackView::Destroy(void)
        ASSERT(m);
 
        m->hMusicController->RemoveListener(this);
-       //m->hMusicController->RemoveCallback(m->cbInfo[E_SONG_COMPLETE]);
-       //m->hMusicController->RemoveCallback(m->cbInfo[E_PLAYBACK_ERROR]);
 
        m_DestroyErrorPopup();
 
index e63c0e5..c282844 100644 (file)
@@ -63,8 +63,7 @@ void CPlaylistLayout::m_OnEntryRename(const char *name)
        id = category_info_get_category_id(t.c_catinfo);
        str = strdup(name);
 
-       destroy_entry_popup(t.epopup);
-       t.epopup = NULL;
+       t.epopup->Destroy();
 
        if (CMusicController::GetInstance()->MediaExistPlaylist(str)) {
                _create_message_box(Layout(), MUSIC_TEXT_INUSE_MSG);
@@ -114,10 +113,10 @@ void CPlaylistLayout::m_PlaylistCtxtAction(EActionType type)
        }
        else if (type == ACTION_TYPE_RENAME) {
                text = category_info_get_name(catinfo);
-               if (t.epopup)
-                       destroy_entry_popup(t.epopup);
+               if (t.epopup->FlagCreate())
+                       t.epopup->Destroy();
 
-               t.epopup = create_entry_popup(t.base, text, sm_CbEntryRename, this);
+               t.epopup->Create(t.base, text, sm_CbEntryRename, this);
 
        }
        else if (type == ACTION_TYPE_ADDSONG) {