1 #ifndef EFL_UI_IMAGE_ZOOMABLE_PRIVATE_H 2 #define EFL_UI_IMAGE_ZOOMABLE_PRIVATE_H 3 4 #include "Elementary.h" 5 6 /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR 7 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT 8 * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK 9 * IT AT RUNTIME. 10 */ 11 12 /** 13 * @addtogroup Widget 14 * @{ 15 * 16 * @section elm-photocam-class The Elementary Photocam Class 17 * 18 * Elementary, besides having the @ref Photocam widget, exposes its 19 * foundation -- the Elementary Photocam Class -- in order to create 20 * other widgets which are a photocam with some more logic on top. 21 */ 22 23 /** 24 * Base widget smart data extended with photocam instance data. 25 */ 26 typedef struct _Efl_Ui_Image_Zoomable_Data Efl_Ui_Image_Zoomable_Data; 27 typedef struct _Efl_Ui_Image_Zoomable_Pan_Data Efl_Ui_Image_Zoomable_Pan_Data; 28 typedef struct _Efl_Ui_Image_Zoomable_Grid Efl_Ui_Image_Zoomable_Grid; 29 typedef struct _Efl_Ui_Image_Zoomable_Grid_Item Efl_Ui_Image_Zoomable_Grid_Item; 30 31 struct _Efl_Ui_Image_Zoomable_Grid_Item 32 { 33 Evas_Object *obj; 34 Efl_Ui_Image_Zoomable_Data *sd; 35 Evas_Object *img; 36 37 struct 38 { 39 int x, y, w, h; 40 } src, out; 41 42 Eina_Bool want : 1; 43 Eina_Bool have : 1; 44 }; 45 46 struct _Efl_Ui_Image_Zoomable_Grid 47 { 48 int tsize; /* size of tile (tsize x tsize pixels) */ 49 int zoom; /* zoom level tiles want for optimal 50 * display (1, 2, 4, 8) */ 51 int iw, ih; /* size of image in pixels */ 52 int w, h; /* size of grid image in pixels 53 * (represented by grid) */ 54 int gw, gh; /* size of grid in tiles */ 55 Efl_Ui_Image_Zoomable_Grid_Item *grid; /* the grid (gw * gh items) */ 56 Eina_Bool dead : 1; /* old grid. will die as soon as anim is 57 * over */ 58 }; 59 60 struct _Efl_Ui_Image_Zoomable_Data 61 { 62 Eo *smanager; 63 Eo *pan_obj; 64 Evas_Object *g_layer; 65 66 67 Evas_Coord pan_x, pan_y, minw, minh; 68 69 double g_layer_start; 70 double zoom; 71 Elm_Photocam_Zoom_Mode mode; 72 Evas_Coord pvx, pvy, px, py, zoom_point_x, 73 zoom_point_y; 74 75 struct 76 { 77 int imx, imy; 78 struct 79 { 80 int x_start, y_start; 81 int x_end, y_end; 82 double t_start; 83 double t_end; 84 } bounce; 85 } g_layer_zoom; 86 87 const char *file; 88 Eina_File *f; 89 90 struct 91 { 92 Eo *copier; 93 Eina_Binbuf *binbuf; 94 } remote; 95 96 Ecore_Job *calc_job; 97 Ecore_Timer *scr_timer; 98 Ecore_Timer *long_timer; 99 double t_start, t_end; 100 101 struct 102 { 103 int imw, imh; 104 int w, h; 105 int ow, oh, nw, nh; 106 struct 107 { 108 double x, y; 109 } spos; 110 } size; 111 112 Eina_Rect show; 113 114 int tsize; 115 Evas_Object *img; /* low res version of image (scale down == 8) */ 116 int no_smooth; 117 int preload_num; 118 119 struct { 120 int requested_size; 121 Eina_Bool use : 1; 122 } freedesktop; 123 Evas_Object *edje; 124 const char *stdicon; 125 126 Ecore_Timer *anim_timer; 127 double frame_duration; 128 double playback_speed; 129 int cur_frame; 130 int frame_count; 131 132 Eina_List *grids; 133 Efl_Gfx_Image_Orientation orient; 134 135 Eina_Bool main_load_pending : 1; 136 Eina_Bool longpressed : 1; 137 Eina_Bool do_gesture : 1; 138 Eina_Bool do_region : 1; 139 Eina_Bool zoom_g_layer : 1; 140 Eina_Bool resized : 1; 141 Eina_Bool on_hold : 1; 142 Eina_Bool paused : 1; 143 Eina_Bool orientation_changed : 1; 144 Eina_Bool anim : 1; 145 Eina_Bool autoplay : 1; 146 Eina_Bool playback_loop : 1; 147 Eina_Bool freeze_want : 1; 148 Eina_Bool show_item: 1; 149 }; 150 151 struct _Efl_Ui_Image_Zoomable_Pan_Data 152 { 153 Eo *wobj; 154 Efl_Ui_Image_Zoomable_Data *wsd; 155 }; 156 157 /** 158 * @} 159 */ 160 161 #define EFL_UI_IMAGE_ZOOMABLE_DATA_GET(o, sd) \ 162 Efl_Ui_Image_Zoomable_Data * sd = efl_data_scope_get(o, EFL_UI_IMAGE_ZOOMABLE_CLASS) 163 164 #define EFL_UI_IMAGE_ZOOMABLE_PAN_DATA_GET(o, sd) \ 165 Efl_Ui_Image_Zoomable_Pan_Data * sd = efl_data_scope_get(o, EFL_UI_IMAGE_ZOOMABLE_PAN_CLASS) 166 167 #define EFL_UI_IMAGE_ZOOMABLE_DATA_GET_OR_RETURN(o, ptr) \ 168 EFL_UI_IMAGE_ZOOMABLE_DATA_GET(o, ptr); \ 169 if (EINA_UNLIKELY(!ptr)) \ 170 { \ 171 ERR("No widget data for object %p (%s)", \ 172 o, evas_object_type_get(o)); \ 173 return; \ 174 } 175 176 #define EFL_UI_IMAGE_ZOOMABLE_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ 177 EFL_UI_IMAGE_ZOOMABLE_DATA_GET(o, ptr); \ 178 if (EINA_UNLIKELY(!ptr)) \ 179 { \ 180 ERR("No widget data for object %p (%s)", \ 181 o, evas_object_type_get(o)); \ 182 return val; \ 183 } 184 185 #define ELM_PHOTOCAM_CHECK(obj) \ 186 if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_IMAGE_ZOOMABLE_CLASS))) \ 187 return 188 189 #endif 190