forked from enlightenment/efl
add paused state to photocam to allow for instance changes of zoom level when
desired. SVN revision: 43072
This commit is contained in:
parent
f0fbc554e3
commit
015304b20b
|
@ -184,9 +184,9 @@ my_bt_zoom_out(void *data, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
|
||||
static void
|
||||
my_bt_zoom_man(void *data, Evas_Object *obj, void *event_info)
|
||||
my_bt_pause(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
|
||||
elm_photocam_paused_set(data, !elm_photocam_paused_get(data));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -298,8 +298,8 @@ test_photocam(void *data, Evas_Object *obj, void *event_info)
|
|||
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Manual");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_man, ph);
|
||||
elm_button_label_set(bt, "Pause On/Off");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_bt_pause, ph);
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(bt, 0.1, 0.9);
|
||||
elm_table_pack(tb2, bt, 0, 2, 1, 1);
|
||||
|
|
|
@ -946,6 +946,8 @@ extern "C" {
|
|||
EAPI void elm_photocam_region_get(Evas_Object *obj, int *x, int *y, int *w, int *h);
|
||||
EAPI void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h);
|
||||
EAPI void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h);
|
||||
EAPI void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused);
|
||||
EAPI Eina_Bool elm_photocam_paused_get(Evas_Object *obj);
|
||||
/* smart callbacks called:
|
||||
* "clicked" - when image clicked
|
||||
* "press" - when mouse/finger held down initially on image
|
||||
|
@ -969,78 +971,4 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/// FIXME: TODO LIST ///////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//// (bugs - high priority)
|
||||
// * left/right arrow broken with password mode for entry + utf8 chars...
|
||||
// * bubble doesnt handle child size changes right
|
||||
// * table doesnt do homogenous properly
|
||||
//
|
||||
//// (incomplete - medium priority)
|
||||
// * need to add support for disabled in all widgets. Button, toolbar, hoversel, radio, check, toggle, spinner and entry are currently done.
|
||||
// * on the fly theme changes - test (should work)
|
||||
// * hoversel only vertical right now - make horizontal
|
||||
// * when entries are in a scroller and change size, the scroller shows scrollbars. fix. same for selecting. for 1 line entries in a scroller should only have scroll arrow indicators.
|
||||
//
|
||||
//// (more widgets/features - medium priority)
|
||||
// * carousel selector widget
|
||||
// * auto-size label/text that adapts text size to its allocated region
|
||||
// * [ scrollable dropdown combo box ]
|
||||
// * [ toggle with 2x labelled button for 2 states ]
|
||||
// * [ poker spinner with numbers + labels ]
|
||||
// * [ wrapping text button bar ]
|
||||
// * slide-open "panel" that can hold stuff and optionally scroll
|
||||
// * calendar widget (select date)
|
||||
// * range selector (select range of values from X to Y over an interval)
|
||||
// * "dialogbutton" widget (bigger button for bottom of wins)
|
||||
// * dialog window widget
|
||||
// * phone-number widget (hilight country dial prefixes, add flags, photos of contacts that match etc.)
|
||||
// * dialpad widget - need one with a phone dialpad
|
||||
// * file selector widget - needs look and functionality improvement :)
|
||||
// * generic "tacho" widget (set min/max labels - and up to 3 intermediate labels etc.)
|
||||
// * status widget (busy, stalled, running, etc.)
|
||||
// * full window in window widget (so move/resize of window object does as you'd expect a child window to do within the canvas)
|
||||
// * window frame widget for borderless windows that want the app to do its own frame (move, resize as well etc.)
|
||||
//
|
||||
//// (improvements - low priority)
|
||||
// * test for all bubble styles
|
||||
// * test for all frame styles
|
||||
// * test for all genlist item styles
|
||||
// * test for all button styles
|
||||
// * test for all hoversel styles
|
||||
// * test for all inwin styles
|
||||
// * test for all anchorblock styles
|
||||
// * test for all anchorview styles
|
||||
// * test more layout in layout
|
||||
// * test normal evas (and edje) objects used as children in elm widgets
|
||||
// * need a way to attach a "dnd detector" to any object
|
||||
// * need a dnd handler (able to hook to dnd detector)
|
||||
// * need another sample theme
|
||||
// * need a way to set a preferred size of a widget (but not min or max).
|
||||
// * merge with gurana
|
||||
// * use evas's new box instead of a box smart
|
||||
// * use evas's table instead of a table smart
|
||||
// * use stack for win widget
|
||||
// * determine prefix of app dynamically and export calls to get prefix info
|
||||
// * load config from file - currently being done
|
||||
// * load config from x property
|
||||
// * handle finger size property and on-the-fly changes like scaling does
|
||||
// * somehow a pdf(ps) viewer widget that doesnt make it gpl (lgpl)
|
||||
// * emotion widget
|
||||
// * ewebkit widget
|
||||
// * flash (gnash) widget
|
||||
// * menu bar + menu widget
|
||||
// * need url and path entry modes for vkbd
|
||||
// * return list of toplevel window objects
|
||||
// * focus should have an object that is layered above all others (definable layer) that moves + resizes (slides about - animated) from one focused widget to the next for focus. also emit focus/unfocus signals too
|
||||
// * scroller could do with page up/down/left/right buttons and and idea of a page size
|
||||
// * current sizing tree inefficient
|
||||
// * need a way to filter entry data for entry (eg for phone numbers)
|
||||
// * win should emit signals based on vkbd type - if it gets a message and is a vkbd win
|
||||
// * win needs a way of setting aspect too
|
||||
// * use the wrong call on the wrong widget and *BOOM* ... crashland
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#endif
|
||||
|
|
|
@ -122,6 +122,7 @@ struct _Widget_Data
|
|||
Eina_Bool resized : 1;
|
||||
Eina_Bool longpressed : 1;
|
||||
Eina_Bool on_hold : 1;
|
||||
Eina_Bool paused : 1;
|
||||
};
|
||||
|
||||
struct _Pan
|
||||
|
@ -538,24 +539,11 @@ _main_preloaded(void *data, Evas *e, Evas_Object *o, void *event_info)
|
|||
}
|
||||
|
||||
static int
|
||||
_zoom_anim(void *data)
|
||||
zoom_do(Evas_Object *obj, double t)
|
||||
{
|
||||
Evas_Object *obj = data;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
double t;
|
||||
Evas_Coord xx, yy, ow, oh;
|
||||
|
||||
t = ecore_loop_time_get();
|
||||
if (t >= wd->t_end)
|
||||
{
|
||||
t = 1.0;
|
||||
}
|
||||
else if (wd->t_end > wd->t_start)
|
||||
t = (t - wd->t_start) / (wd->t_end - wd->t_start);
|
||||
else
|
||||
t = 1.0;
|
||||
t = 1.0 - t;
|
||||
t = 1.0 - (t * t);
|
||||
wd->size.w = (wd->size.ow * (1.0 - t)) + (wd->size.nw * t);
|
||||
wd->size.h = (wd->size.oh * (1.0 - t)) + (wd->size.nh * t);
|
||||
elm_smart_scroller_child_viewport_size_get(wd->scr, &ow, &oh);
|
||||
|
@ -578,19 +566,44 @@ _zoom_anim(void *data)
|
|||
if (g->dead)
|
||||
{
|
||||
wd->grids = eina_list_remove_list(wd->grids, l);
|
||||
grid_clear(data, g);
|
||||
grid_clear(obj, g);
|
||||
free(g);
|
||||
}
|
||||
}
|
||||
wd->nosmooth--;
|
||||
if (wd->nosmooth == 0) _smooth_update(data);
|
||||
wd->zoom_animator = NULL;
|
||||
evas_object_smart_callback_call(data, "zoom,stop", NULL);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
_zoom_anim(void *data)
|
||||
{
|
||||
Evas_Object *obj = data;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
double t;
|
||||
int go;
|
||||
|
||||
t = ecore_loop_time_get();
|
||||
if (t >= wd->t_end)
|
||||
t = 1.0;
|
||||
else if (wd->t_end > wd->t_start)
|
||||
t = (t - wd->t_start) / (wd->t_end - wd->t_start);
|
||||
else
|
||||
t = 1.0;
|
||||
t = 1.0 - t;
|
||||
t = 1.0 - (t * t);
|
||||
go = zoom_do(obj, t);
|
||||
if (!go)
|
||||
{
|
||||
wd->nosmooth--;
|
||||
if (wd->nosmooth == 0) _smooth_update(data);
|
||||
wd->zoom_animator = NULL;
|
||||
evas_object_smart_callback_call(obj, "zoom,stop", NULL);
|
||||
}
|
||||
return go;
|
||||
}
|
||||
|
||||
static void
|
||||
_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -1210,13 +1223,6 @@ elm_photocam_zoom_set(Evas_Object *obj, double zoom)
|
|||
}
|
||||
}
|
||||
done:
|
||||
if (!wd->zoom_animator)
|
||||
{
|
||||
wd->zoom_animator = ecore_animator_add(_zoom_anim, obj);
|
||||
wd->nosmooth++;
|
||||
if (wd->nosmooth == 1) _smooth_update(obj);
|
||||
started = 1;
|
||||
}
|
||||
wd->t_start = ecore_loop_time_get();
|
||||
wd->t_end = wd->t_start + _elm_config->zoom_friction;
|
||||
if ((wd->size.w > 0) && (wd->size.h > 0))
|
||||
|
@ -1233,18 +1239,38 @@ elm_photocam_zoom_set(Evas_Object *obj, double zoom)
|
|||
if (rh > wd->size.h) wd->size.spos.y = 0.5;
|
||||
if (wd->size.spos.x > 1.0) wd->size.spos.x = 1.0;
|
||||
if (wd->size.spos.y > 1.0) wd->size.spos.y = 1.0;
|
||||
an = wd->zoom_animator;
|
||||
if (!_zoom_anim(obj))
|
||||
if (wd->paused)
|
||||
{
|
||||
ecore_animator_del(an);
|
||||
an = NULL;
|
||||
zoom_do(obj, 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!wd->zoom_animator)
|
||||
{
|
||||
wd->zoom_animator = ecore_animator_add(_zoom_anim, obj);
|
||||
wd->nosmooth++;
|
||||
if (wd->nosmooth == 1) _smooth_update(obj);
|
||||
started = 1;
|
||||
}
|
||||
}
|
||||
an = wd->zoom_animator;
|
||||
if (an)
|
||||
{
|
||||
if (!_zoom_anim(obj))
|
||||
{
|
||||
ecore_animator_del(an);
|
||||
an = NULL;
|
||||
}
|
||||
}
|
||||
if (wd->calc_job) ecore_job_del(wd->calc_job);
|
||||
wd->calc_job = ecore_job_add(_calc_job, wd);
|
||||
if (started)
|
||||
evas_object_smart_callback_call(obj, "zoom,start", NULL);
|
||||
if (!an)
|
||||
evas_object_smart_callback_call(obj, "zoom,stop", NULL);
|
||||
if (!wd->paused)
|
||||
{
|
||||
if (started)
|
||||
evas_object_smart_callback_call(obj, "zoom,start", NULL);
|
||||
if (!an)
|
||||
evas_object_smart_callback_call(obj, "zoom,stop", NULL);
|
||||
}
|
||||
if (zoom_changed)
|
||||
evas_object_smart_callback_call(obj, "zoom,change", NULL);
|
||||
}
|
||||
|
@ -1417,9 +1443,10 @@ elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h)
|
|||
if (wd->zoom_animator)
|
||||
{
|
||||
wd->nosmooth--;
|
||||
if (wd->nosmooth == 0) _smooth_update(obj);
|
||||
ecore_animator_del(wd->zoom_animator);
|
||||
wd->zoom_animator = NULL;
|
||||
zoom_do(obj, 1.0);
|
||||
evas_object_smart_callback_call(obj, "zoom,stop", NULL);
|
||||
}
|
||||
elm_smart_scroller_child_region_show(wd->scr, rx, ry, rw, rh);
|
||||
}
|
||||
|
@ -1458,6 +1485,51 @@ elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h)
|
|||
if (wd->nosmooth == 0) _smooth_update(obj);
|
||||
ecore_animator_del(wd->zoom_animator);
|
||||
wd->zoom_animator = NULL;
|
||||
}
|
||||
zoom_do(obj, 1.0);
|
||||
evas_object_smart_callback_call(obj, "zoom,stop", NULL);
|
||||
}
|
||||
elm_smart_scroller_region_bring_in(wd->scr, rx, ry, rw, rh);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the paused state for photocam
|
||||
*
|
||||
* This sets the paused state to on (1) or off (0) for photocam. The default
|
||||
* is on. This will stop zooming using animation ch change zoom levels and
|
||||
* change instantly. This will stop any existing animations that are running.
|
||||
*
|
||||
* @param obj The photocam object
|
||||
* @param paused The pause state to set
|
||||
*/
|
||||
EAPI void
|
||||
elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->paused == !!paused) return;
|
||||
wd->paused = paused;
|
||||
if (wd->paused)
|
||||
{
|
||||
if (wd->zoom_animator)
|
||||
{
|
||||
ecore_animator_del(wd->zoom_animator);
|
||||
wd->zoom_animator = NULL;
|
||||
zoom_do(obj, 1.0);
|
||||
evas_object_smart_callback_call(obj, "zoom,stop", NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the paused state for photocam
|
||||
*
|
||||
* This gets the current paused state for the photocam object.
|
||||
*
|
||||
* @param obj The photocam object
|
||||
* @return The current paused state
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_photocam_paused_get(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
return wd->paused;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue