2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
14 #include "CicoHSMenuTile.h"
15 #include "CicoHSMenuTouch.h"
22 /*============================================================================*/
24 /*============================================================================*/
25 /*--------------------------------------------------------------------------*/
27 * @brief CicoHSMenuTile::CicoHSMenuTile
31 * @param[in] icon_image_path
38 /*--------------------------------------------------------------------------*/
39 CicoHSMenuTile::CicoHSMenuTile(const char *appid,
40 const char *icon_image_path,
41 int page, int subpage,
42 int position, int width, int height)
44 ICO_TRA("CicoHSMenuTile::CicoHSMenuTile Enter");
47 strncpy(this->appid, appid, ICO_HS_MAX_PROCESS_NAME);
49 if ((icon_image_path != NULL) && (strlen(icon_image_path) != 0)) {
50 strncpy(this->icon_image_path,icon_image_path,ICO_HS_MAX_PATH_BUFF_LEN);
53 strncpy(this->icon_image_path,ICO_HS_MENUTILE_DEFAULT_ICON_PATH,
54 ICO_HS_MAX_PATH_BUFF_LEN);
56 ICO_DBG("CicoHSMenuTile::CicoHSMenuTile:image_path %s:%s",
57 appid, this->icon_image_path);
60 thumb.pixel_data = NULL;
62 this->subpage = subpage;
63 this->position = position;
65 this->height = height;
66 pos_x = GetPositionX();
67 pos_y = GetPositionY();
69 (void) mkdir(ICO_HS_THUMB_ICODIR, 0755);
70 (void) mkdir(ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR, 0755);
72 ICO_TRA("CicoHSMenuTile::CicoHSMenuTile Leave");
75 /*--------------------------------------------------------------------------*/
77 * @brief CicoHSMenuTile::CicoHSMenuTile
83 /*--------------------------------------------------------------------------*/
84 CicoHSMenuTile::~CicoHSMenuTile(void)
88 /*--------------------------------------------------------------------------*/
90 * @brief CicoHSMenuTile::CreateObject
96 /*--------------------------------------------------------------------------*/
98 CicoHSMenuTile::CreateObject(Evas *evas)
100 ICO_DBG("CicoHSMenuTile::CreateObject Enter(appid=<%s> x/y=%d/%d)",
101 appid, pos_x, pos_y);
109 thumb_reduce_x = ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX;
110 thumb_reduce_y = ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX;
113 tile = evas_object_image_filled_add(evas);
114 evas_object_image_file_set(tile, icon_image_path, NULL);
115 evas_object_move(tile, pos_x, pos_y);
116 evas_object_resize(tile, width, height);
117 evas_object_event_callback_add(tile, EVAS_CALLBACK_MOUSE_DOWN,
118 CicoHSMenuTouch::TouchDownMenu, appid);
119 evas_object_event_callback_add(tile, EVAS_CALLBACK_MOUSE_UP,
120 CicoHSMenuTouch::TouchUpMenu, appid);
122 evas_object_show(icon);
125 term_icon = evas_object_image_filled_add(evas);
126 evas_object_image_file_set(term_icon, ICO_HS_MENUTILE_TERM_ICON_PATH, NULL);
127 evas_object_move(term_icon, pos_x + width - ICO_HS_MENUTILE_TERM_ICON_WIDTH, pos_y);
128 evas_object_resize(term_icon, ICO_HS_MENUTILE_TERM_ICON_WIDTH,
129 ICO_HS_MENUTILE_TERM_ICON_HEIGHT);
130 evas_object_event_callback_add(term_icon, EVAS_CALLBACK_MOUSE_DOWN,
131 CicoHSMenuTouch::TouchDownTerm, appid);
132 evas_object_event_callback_add(term_icon, EVAS_CALLBACK_MOUSE_UP,
133 CicoHSMenuTouch::TouchUpTerm, appid);
134 ICO_DBG("CicoHSMenuTile::CreateObject Leave(%s Tile=(%d,%d) w/h=%d/%d",
135 appid, pos_x, pos_y, width, height);
138 /*--------------------------------------------------------------------------*/
140 * @brief CicoHSMenuTile::ShowTermIcon
146 /*--------------------------------------------------------------------------*/
148 CicoHSMenuTile::ShowTermIcon()
150 evas_object_raise(term_icon);
151 evas_object_show(term_icon);
154 /*--------------------------------------------------------------------------*/
156 * @brief CicoHSMenuTile::HideTermIcon
162 /*--------------------------------------------------------------------------*/
164 CicoHSMenuTile::HideTermIcon(void)
166 evas_object_hide(term_icon);
169 /*--------------------------------------------------------------------------*/
171 * @brief CicoHSMenuTile::FreeObject
177 /*--------------------------------------------------------------------------*/
179 CicoHSMenuTile::FreeObject(void)
181 char sWork[PATH_MAX];
183 ICO_DBG("CicoHSMenuTile::FreeObject(appid=%08x<%s>)", (int)this->appid, appid);
186 sprintf(sWork, "%s/%08x.bpm", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
188 (void) unlink(sWork);
189 ico_syc_unmap_thumb(thumb.surface);
193 evas_object_del(tile);
196 if (small_icon != NULL){
197 evas_object_del(small_icon);
200 if (thumb_tile != NULL) {
201 evas_object_del(thumb_tile);
204 if (term_icon != NULL) {
205 evas_object_del(term_icon);
210 /*--------------------------------------------------------------------------*/
212 * @brief CicoHSMenuTile::Resize
213 * resize tile(currently unused)
215 * @param[in] width width
216 * @param[in] height height
219 /*--------------------------------------------------------------------------*/
221 CicoHSMenuTile::Resize(int width, int height)
223 ICO_DBG("CicoHSMenuTile::Resize (%d,%d)-(%d,%d) Unused",
224 this->width, this->height, width, height);
227 /*--------------------------------------------------------------------------*/
229 * @brief CicoHSMenuTile::MovePosition
230 * move tile base position
232 * @param[in] page page
233 * @param[in] position position of tile
236 /*--------------------------------------------------------------------------*/
238 CicoHSMenuTile::MovePosition(int page, int position)
241 this->position= position;
242 pos_x = GetPositionX();
243 pos_y = GetPositionY();
245 ICO_DBG("CicoHSMenuTile::MovePosition(appid=%08x<%s> tile=(%d,%d))",
246 (int)this->appid, appid, pos_x, pos_y);
248 evas_object_move(tile, pos_x, pos_y);
250 evas_object_move(thumb_tile, pos_x + thumb_reduce_x, pos_y + thumb_reduce_y);
253 evas_object_move(small_icon,
254 pos_x + thumb_reduce_x - ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2,
255 pos_y + height - thumb_reduce_y - height
256 / ICO_HS_MENUTILE_THUMBNAIL_REDUCTION
257 + ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2);
259 evas_object_move(term_icon, pos_x + width - ICO_HS_MENUTILE_TERM_ICON_WIDTH, pos_y);
262 /*--------------------------------------------------------------------------*/
264 * @brief CicoHSMenuTile::OffsetMove
265 * move from base position
267 * @param[in] offset_x offset_x from base position
268 * @param[in] offset_y offset_y from base position
271 /*--------------------------------------------------------------------------*/
273 CicoHSMenuTile::OffsetMove(int offset_x, int offset_y)
275 pos_x = GetPositionX() + offset_x;
276 pos_y = GetPositionY() + offset_y;
278 ICO_DBG("CicoHSMenuTile::OffsetMove(appid=%08x<%s> offset=%d,%d tile=(%d,%d) obj=%08x %08x %08x)",
279 (int)this->appid, appid, offset_x, offset_y, pos_x, pos_y,
280 (int)this->icon, (int)this->tile, (int)this->thumb_tile);
282 evas_object_move(tile, pos_x, pos_y);
284 evas_object_move(thumb_tile, pos_x + thumb_reduce_x, pos_y + thumb_reduce_y);
287 evas_object_move(small_icon,
288 pos_x + thumb_reduce_x - ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2,
289 pos_y + height - thumb_reduce_y - height
290 / ICO_HS_MENUTILE_THUMBNAIL_REDUCTION
291 + ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2);
293 evas_object_move(term_icon, pos_x + width - ICO_HS_MENUTILE_TERM_ICON_WIDTH, pos_y);
296 /*--------------------------------------------------------------------------*/
298 * @brief CicoHSMenuTile::GetImagePath
299 * get icon image path
302 * @return icon image path
304 /*--------------------------------------------------------------------------*/
306 CicoHSMenuTile::GetImagePath(void)
308 return icon_image_path;
311 /*--------------------------------------------------------------------------*/
313 * @brief CicoHSMenuTile::GetAppId
317 * @return application id
319 /*--------------------------------------------------------------------------*/
321 CicoHSMenuTile::GetAppId(void)
326 /*--------------------------------------------------------------------------*/
328 * @brief CicoHSMenuTile::GetWidth
334 /*--------------------------------------------------------------------------*/
336 CicoHSMenuTile::GetWidth(void)
341 /*--------------------------------------------------------------------------*/
343 * @brief CicoHSMenuTile::GetHeight
349 /*--------------------------------------------------------------------------*/
351 CicoHSMenuTile::GetHeight(void)
356 /*--------------------------------------------------------------------------*/
358 * @brief CicoHSMenuTile::GetPosition
364 /*--------------------------------------------------------------------------*/
366 CicoHSMenuTile::GetPosition(void)
371 /*--------------------------------------------------------------------------*/
373 * @brief CicoHSMenuTile::GetPage
379 /*--------------------------------------------------------------------------*/
381 CicoHSMenuTile::GetPage(void)
386 /*--------------------------------------------------------------------------*/
388 * @brief CicoHSMenuTile::GetSubPage
394 /*--------------------------------------------------------------------------*/
396 CicoHSMenuTile::GetSubPage(void)
401 /*--------------------------------------------------------------------------*/
403 * @brief CicoHSMenuTile::GetPositionX
409 /*--------------------------------------------------------------------------*/
411 CicoHSMenuTile::GetPositionX(void)
415 if ((position == ICO_HS_MENUTILE_POSITION_0) ||
416 (position == ICO_HS_MENUTILE_POSITION_3) ||
417 (position == ICO_HS_MENUTILE_POSITION_6) ||
418 (position == ICO_HS_MENUTILE_POSITION_9)) {
419 ret = ICO_HS_MENUTILE_START_POS_X;
421 else if ((position == ICO_HS_MENUTILE_POSITION_1) ||
422 (position == ICO_HS_MENUTILE_POSITION_4) ||
423 (position == ICO_HS_MENUTILE_POSITION_7) ||
424 (position == ICO_HS_MENUTILE_POSITION_10)) {
425 ret = ICO_HS_MENUTILE_START_POS_X +
426 (CicoHSMenuWindow::Tile_Width() + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE);
428 else if ((position == ICO_HS_MENUTILE_POSITION_2) ||
429 (position == ICO_HS_MENUTILE_POSITION_5) ||
430 (position == ICO_HS_MENUTILE_POSITION_8) ||
431 (position == ICO_HS_MENUTILE_POSITION_11)) {
432 ret = ICO_HS_MENUTILE_START_POS_X +
433 ((CicoHSMenuWindow::Tile_Width() + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE) * 2);
438 /*--------------------------------------------------------------------------*/
440 * @brief CicoHSMenuTile::GetPositionY
446 /*--------------------------------------------------------------------------*/
448 CicoHSMenuTile::GetPositionY(void)
452 if ((position == ICO_HS_MENUTILE_POSITION_0) ||
453 (position == ICO_HS_MENUTILE_POSITION_1) ||
454 (position == ICO_HS_MENUTILE_POSITION_2)) {
455 ret = ICO_HS_MENUTILE_START_POS_Y;
457 else if ((position == ICO_HS_MENUTILE_POSITION_3) ||
458 (position == ICO_HS_MENUTILE_POSITION_4) ||
459 (position == ICO_HS_MENUTILE_POSITION_5)) {
460 ret = ICO_HS_MENUTILE_START_POS_Y +
461 (CicoHSMenuWindow::Tile_Height() + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE);
463 else if ((position == ICO_HS_MENUTILE_POSITION_6) ||
464 (position == ICO_HS_MENUTILE_POSITION_7) ||
465 (position == ICO_HS_MENUTILE_POSITION_8)) {
466 ret = ICO_HS_MENUTILE_START_POS_Y +
467 ((CicoHSMenuWindow::Tile_Height() + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE) * 2);
469 else if ((position == ICO_HS_MENUTILE_POSITION_9) ||
470 (position == ICO_HS_MENUTILE_POSITION_10) ||
471 (position == ICO_HS_MENUTILE_POSITION_11)) {
472 ret = ICO_HS_MENUTILE_START_POS_Y +
473 ((CicoHSMenuWindow::Tile_Height() + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE) * 3);
478 /*--------------------------------------------------------------------------*/
480 * @brief CicoHSMenuTile::ValidMenuIcon
481 * tile is icon(app terminated)
486 /*--------------------------------------------------------------------------*/
488 CicoHSMenuTile::ValidMenuIcon(void)
491 ICO_DBG("CicoHSMenuTile::ValidMenuIcon: %s show icon", appid);
493 free(thumb.pixel_data);
494 thumb.pixel_data = NULL;
495 if (icon == thumb_tile) {
498 evas_object_hide(thumb_tile);
501 evas_object_show(tile);
505 evas_object_hide(small_icon);
510 /*--------------------------------------------------------------------------*/
512 * @brief CicoHSMenuTile::ValidThumbnail
513 * tile is thumbnail(app started)
515 * @param[in] surface surface
518 /*--------------------------------------------------------------------------*/
520 CicoHSMenuTile::ValidThumbnail(int surface)
522 char sWork[PATH_MAX];
524 ICO_DBG("CicoHSMenuTile::ValidThumbnail(appid=%08x<%s>) run=%d surf=%08x",
525 (int)this->appid, appid, app_running, surface);
527 if ((! app_running) || (surface == 0)) {
528 if (thumb.surface != 0) {
529 sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
530 ICO_HS_THUMB_FILEEXT, thumb.surface);
531 (void) unlink(sWork);
532 ico_syc_unmap_thumb(thumb.surface);
534 free(thumb.pixel_data);
535 thumb.pixel_data = NULL;
538 thumb.surface = surface;
541 sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
542 ICO_HS_THUMB_FILEEXT, thumb.surface);
543 (void) unlink(sWork);
544 ico_syc_map_thumb(thumb.surface,
545 menu_show ? ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW :
546 ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE, sWork);
548 small_icon = evas_object_image_filled_add(menu_evas);
549 evas_object_image_file_set(small_icon, icon_image_path, NULL);
550 evas_object_move(small_icon,
551 pos_x + thumb_reduce_x
552 - ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2,
553 pos_y + height - thumb_reduce_y - height
554 / ICO_HS_MENUTILE_THUMBNAIL_REDUCTION
555 + ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2);
556 evas_object_resize(small_icon, width / ICO_HS_MENUTILE_THUMBNAIL_REDUCTION,
557 height / ICO_HS_MENUTILE_THUMBNAIL_REDUCTION);
558 evas_object_event_callback_add(small_icon, EVAS_CALLBACK_MOUSE_DOWN,
559 CicoHSMenuTouch::TouchDownMenu, appid);
560 evas_object_event_callback_add(small_icon, EVAS_CALLBACK_MOUSE_UP,
561 CicoHSMenuTouch::TouchUpMenu, appid);
562 evas_object_raise(small_icon);
563 evas_object_raise(term_icon);
565 evas_object_show(small_icon);
566 ICO_DBG("CicoHSMenuTile::ValidThumbnail: %s(%08x) show small icon",
571 if (icon == thumb_tile) {
572 ICO_DBG("CicoHSMenuTile::ValidThumbnail: %s change thumb->icon", appid);
575 evas_object_hide(thumb_tile);
577 evas_object_show(tile);
580 evas_object_hide(small_icon);
582 ICO_DBG("CicoHSMenuTile::ValidThumbnail: %s(%08x) hide small icon",
588 /*--------------------------------------------------------------------------*/
590 * @brief CicoHSMenuTile::SetThumbnail
593 * @param[in] info thumbnail information, if NULL reset thumbnail
596 /*--------------------------------------------------------------------------*/
598 CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info)
600 Evas_Object *old_icon = icon;
604 char sWork[PATH_MAX];
605 #if 0 /* for BMP format */
606 #pragma pack(push, 1)
628 ICO_DBG("CicoHSMenuTile::SetThumbnail(appid=%08x<%s>) info=%08x surf=%08x",
629 (int)this->appid, appid, (int)info, info ? info->surface : 0);
631 if ((info == NULL) || (info->surface == 0)) {
636 if (thumb.surface != info->surface) {
637 if (thumb.surface != 0) {
638 ICO_DBG("CicoHSMenuTile::SetThumbnail: surface change(%08x->%08x)",
639 thumb.surface, info->surface);
640 ico_syc_unmap_thumb(thumb.surface);
641 sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
642 ICO_HS_THUMB_FILEEXT, thumb.surface);
643 (void) unlink(sWork);
645 thumb.surface = info->surface;
646 sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
647 ICO_HS_THUMB_FILEEXT, thumb.surface);
648 ico_syc_map_thumb(thumb.surface,
649 menu_show ? ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW :
650 ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE, sWork);
653 sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
654 ICO_HS_THUMB_FILEEXT, thumb.surface);
656 thumb.type = info->type;
657 thumb.width = info->width;
658 thumb.height = info->height;
659 thumb.stride = info->stride;
660 thumb.format = info->format;
661 #if 0 /* too many log */
662 ICO_DBG("CicoHSMenuTile::SetThumbnail: make thumbnail %s(%08x) "
663 "type=%d w/h/s=%d/%d/%d tile w/h=%d/%d",
664 appid, thumb.surface, thumb.type,
665 thumb.width, thumb.height, thumb.stride, width, height);
667 if ((info->width <= 1) || (info->height <= 1)) {
668 ICO_DBG("CicoHSMenuTile::SetThumbnail: small surface(%d,%d) skip",
669 info->width, info->height);
672 // create thumbnail image
673 svx = thumb_reduce_x;
674 svy = thumb_reduce_y;
675 if (thumb.width > (thumb.height + 64)) {
676 thumb_reduce_x = ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX;
677 thumb_reduce_y = height / ICO_HS_MENUTILE_THUMBNAIL_REDUCE_RATE;
679 else if (thumb.width < (thumb.height - 64)) {
680 thumb_reduce_y = ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX;
681 thumb_reduce_x = width / ICO_HS_MENUTILE_THUMBNAIL_REDUCE_RATE;
684 thumb_reduce_x = ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX;
685 thumb_reduce_y = ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX;
688 thumb_tile = evas_object_image_filled_add(menu_evas);
689 evas_object_resize(thumb_tile, width - thumb_reduce_x * 2,
690 height - thumb_reduce_y * 2);
691 evas_object_move(thumb_tile, pos_x + thumb_reduce_x,
692 pos_y + thumb_reduce_y);
693 evas_object_event_callback_add(thumb_tile, EVAS_CALLBACK_MOUSE_DOWN,
694 CicoHSMenuTouch::TouchDownMenu, appid);
695 evas_object_event_callback_add(thumb_tile, EVAS_CALLBACK_MOUSE_UP,
696 CicoHSMenuTouch::TouchUpMenu, appid);
697 ICO_DBG("CicoHSMenuTile::SetThumbnail: create thumb_tile %s "
698 "tile=(%d+%d,%d+%d)", appid,
699 pos_x, thumb_reduce_x, pos_y, thumb_reduce_y);
701 evas_object_move(small_icon,
702 pos_x + thumb_reduce_x
703 - ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2,
704 pos_y + height - thumb_reduce_y - height
705 / ICO_HS_MENUTILE_THUMBNAIL_REDUCTION
706 + ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2);
707 evas_object_raise(small_icon);
709 evas_object_raise(term_icon);
711 else if ((svx != thumb_reduce_x) || (svy != thumb_reduce_y)) {
712 evas_object_resize(thumb_tile, width - thumb_reduce_x * 2,
713 height - thumb_reduce_y * 2);
714 evas_object_move(thumb_tile, pos_x + thumb_reduce_x,
715 pos_y + thumb_reduce_y);
717 evas_object_move(small_icon,
718 pos_x + thumb_reduce_x
719 - ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2,
720 pos_y + height - thumb_reduce_y - height
721 / ICO_HS_MENUTILE_THUMBNAIL_REDUCTION
722 + ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2);
725 /* read surface image pixel */
726 int bufsize = ((thumb.width * thumb.height * 4 + 4095) / 4096) * 4096;
727 if ((! thumb.pixel_data) || (bufsize > thumb.pixel_bufsize)) {
728 free(thumb.pixel_data);
729 thumb.pixel_data = (char *)malloc(bufsize);
730 thumb.pixel_bufsize = bufsize;
731 if (thumb.pixel_data) {
732 memset(thumb.pixel_data, 0, bufsize);
735 if (thumb.pixel_data) {
736 fd = open(sWork, O_RDONLY, 0644);
738 #if 0 /* for BMP format */
739 if (read(fd, &bmphead, sizeof(bmphead)) != sizeof(bmphead)) {
740 ICO_ERR("CicoHSMenuTile::SetThumbnail: can not read pixel file(%s)",
745 if (read(fd, thumb.pixel_data, bufsize) <= 0) {
746 ICO_ERR("CicoHSMenuTile::SetThumbnail: can not read pixel file(%s)",
751 ICO_ERR("CicoHSMenuTile::SetThumbnail: can not open pixel file(%s)",
756 (void) unlink(sWork);
758 evas_object_image_data_update_add(
759 thumb_tile, 0, 0, thumb.width, thumb.height);
761 evas_object_image_size_set(thumb_tile, thumb.width, thumb.height);
762 evas_object_image_data_set(thumb_tile, thumb.pixel_data);
763 evas_object_image_filled_set(thumb_tile, EINA_TRUE);
764 evas_object_resize(thumb_tile, width - thumb_reduce_x * 2,
765 height - thumb_reduce_y * 2);
766 evas_object_move(thumb_tile,
767 pos_x + thumb_reduce_x, pos_y + thumb_reduce_y);
770 ICO_ERR("CicoHSMenuTile::SetThumbnail: can not malloc pixel buffer");
777 ICO_DBG("CicoHSMenuTile::SetThumbnail: unmap thumbnail %08x", thumb.surface);
779 sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
780 ICO_HS_THUMB_FILEEXT, thumb.surface);
781 (void) unlink(sWork);
782 ico_syc_unmap_thumb(thumb.surface);
785 free(thumb.pixel_data);
786 thumb.pixel_data = NULL;
790 if (icon != old_icon) {
792 evas_object_hide(old_icon);
794 evas_object_show(icon);
796 if (icon == thumb_tile) {
797 evas_object_show(small_icon);
798 // remake thumbnail for first build image
799 CicoHSMenuTile::SetThumbnail(info);
802 evas_object_hide(small_icon);
808 /*--------------------------------------------------------------------------*/
810 * @brief CicoHSMenuTile::ShowMenu
811 * change menu show/hide for live thumbnail update cycle
813 * @param[in] show surface
814 * @return nonmenu show(true)/fide(false)
816 /*--------------------------------------------------------------------------*/
818 CicoHSMenuTile::ShowMenu(bool show)
820 char sWork[PATH_MAX];
822 if ((thumb_tile) && (thumb.surface != 0)) {
823 sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
824 ICO_HS_THUMB_FILEEXT, thumb.surface);
825 (void) unlink(sWork);
826 ico_syc_map_thumb(thumb.surface,
827 menu_show ? ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW :
828 ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE, sWork);
832 /*--------------------------------------------------------------------------*/
834 * @brief CicoHSMenuTile::SetOrgThumbnail
835 * set thumbnail form org tile
837 * @param[in] info org tile
840 /*--------------------------------------------------------------------------*/
842 CicoHSMenuTile::SetOrgThumbnail(CicoHSMenuTile *orgTile)
845 ICO_DBG("CicoHSMenuTile::SetOrgThumbnail Enter(appid=%08x<%s>) run=%d surf=%08x",
846 (int)this->appid, this->appid, app_running, orgTile->thumb.surface );
848 /* check surface of orgTile */
849 if ( orgTile == NULL || orgTile->thumb.surface == 0 ) {
854 this->ValidThumbnail( orgTile->thumb.surface );
856 /* set new thumbnail */
857 ico_syc_thumb_info_t info;
859 info.surface = orgTile->thumb.surface;
860 info.type = orgTile->thumb.type;
861 info.width = orgTile->thumb.width;
862 info.height = orgTile->thumb.height;
863 info.stride = orgTile->thumb.stride;
864 info.format = orgTile->thumb.format;
866 SetThumbnail( &info );
868 ICO_DBG("CicoHSMenuTile::SetOrgThumbnail Leave(appid=%08x<%s>) run=%d surf=%08x",
869 (int)this->appid, this->appid, app_running, orgTile->thumb.surface );
872 // vim: set expandtab ts=4 sw=4: