zoom actions, still barebones.

I was about to move to efenniht theme, but it will be some work I'd
not be able to finish in time... given that we'll have enjoy, eve,
envision and ephoto using the same things, it is time to consider a
better replicable solution.




SVN revision: 53240
v-1.6.0
Gustavo Sverzut Barbieri 13 years ago
parent 9652a108bf
commit 47da8cd526
  1. 120
      data/themes/default/ephoto.edc
  2. 2
      src/bin/ephoto_main.c
  3. 47
      src/bin/ephoto_thumb_browser.c

@ -1,8 +1,3 @@
fonts
{
font: "Vera.ttf" "default";
}
externals {
external: "elm";
}
@ -726,7 +721,7 @@ collections
group { name: "ephoto/main/layout";
data.item: "initial_size" "480 800";
parts {
part { name: "ephoto.swallow.content";
part { name: "ephoto.swallow.thumb_browser";
type: SWALLOW;
description { state: "default" 0.0;
}
@ -801,11 +796,120 @@ collections
part { name: "ephoto.thumb.swallow";
type: SWALLOW;
description {
state: "default" 0.0;
description { state: "default" 0.0;
rel1 { to: "ephoto.location";
relative: 0.0 1.0;
}
rel2 { to_y: "iconbar.bg";
relative: 1.0 0.0;
}
}
}
part { name: "iconbar.bg";
type: RECT;
description { state: "default" 0.0;
rel1 { relative: 0.0 1.0;
offset: 0 -64;
}
}
}
part { name: "zoom_in_area";
type: RECT;
description { state: "default" 0.0;
color: 0 0 0 0;
rel1.to: "zoom_in";
rel2.to: "zoom_in";
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
visible: 0; /* no events */
}
}
part { name: "zoom_in";
type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
color: 255 0 0 255;
rel1 { to_y: "iconbar.bg";
relative: 0.0 0.0;
}
rel2.relative: 0.2 1.0;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 0 0 0 255;
}
}
programs {
program {
signal: "mouse,clicked,*";
source: "zoom_in_area";
action: SIGNAL_EMIT "zoom_in,clicked" "ephoto";
}
program {
signal: "zoom_in,disable";
source: "ephoto";
action: STATE_SET "disabled" 0.0;
target: "zoom_in";
target: "zoom_in_area";
}
program {
signal: "zoom_in,enable";
source: "ephoto";
action: STATE_SET "default" 0.0;
target: "zoom_in";
target: "zoom_in_area";
}
}
part { name: "zoom_out_area";
type: RECT;
description { state: "default" 0.0;
color: 0 0 0 0;
rel1.to: "zoom_out";
rel2.to: "zoom_out";
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
visible: 0; /* no events */
}
}
part { name: "zoom_out";
type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
color: 0 255 0 255;
rel1 { to_y: "iconbar.bg";
relative: 0.2 0.0;
}
rel2.relative: 0.4 1.0;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 0 0 0 255;
}
}
programs {
program {
signal: "mouse,clicked,*";
source: "zoom_out_area";
action: SIGNAL_EMIT "zoom_out,clicked" "ephoto";
}
program {
signal: "zoom_out,disable";
source: "ephoto";
action: STATE_SET "disabled" 0.0;
target: "zoom_out";
target: "zoom_out_area";
}
program {
signal: "zoom_out,enable";
source: "ephoto";
action: STATE_SET "default" 0.0;
target: "zoom_out";
target: "zoom_out_area";
}
}
}

@ -109,7 +109,7 @@ ephoto_window_add(const char *path)
return NULL;
}
elm_layout_content_set
(ephoto->layout, "ephoto.swallow.content", ephoto->thumb_browser);
(ephoto->layout, "ephoto.swallow.thumb_browser", ephoto->thumb_browser);
ed = elm_layout_edje_get(ephoto->layout);
edje_object_size_min_get(ed, &mw, &mh);

@ -1,7 +1,8 @@
#include "ephoto.h"
#define SLIDER_MAX 512
#define SLIDER_MIN 128
#define ZOOM_MAX 512
#define ZOOM_MIN 128
#define ZOOM_STEP 32
#define PARENT_DIR "Up"
@ -256,6 +257,40 @@ _changed_dir(void *data, Evas_Object *o, const char *emission, const char *sourc
ephoto_thumb_browser_directory_set(tb->layout, p.s);
}
static void
_zoom_set(Ephoto_Thumb_Browser *tb, int zoom)
{
if (zoom > ZOOM_MAX) zoom = ZOOM_MAX;
else if (zoom < ZOOM_MIN) zoom = ZOOM_MIN;
ephoto_thumb_size_set(tb->ephoto, zoom);
elm_gengrid_item_size_set(tb->grid, zoom, zoom);
if (zoom == ZOOM_MIN)
edje_object_signal_emit(tb->edje, "zoom_out,disable", "ephoto");
else
edje_object_signal_emit(tb->edje, "zoom_out,enable", "ephoto");
if (zoom == ZOOM_MAX)
edje_object_signal_emit(tb->edje, "zoom_in,disable", "ephoto");
else
edje_object_signal_emit(tb->edje, "zoom_in,enable", "ephoto");
}
static void
_zoom_in(void *data, Evas_Object *o, const char *emission, const char *source)
{
Ephoto_Thumb_Browser *tb = data;
_zoom_set(tb, tb->ephoto->config->thumb_size + ZOOM_STEP);
}
static void
_zoom_out(void *data, Evas_Object *o, const char *emission, const char *source)
{
Ephoto_Thumb_Browser *tb = data;
_zoom_set(tb, tb->ephoto->config->thumb_size - ZOOM_STEP);
}
static void
_layout_del(void *data, Evas *e, Evas_Object *o, void *event_info)
{
@ -282,6 +317,10 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
evas_object_data_set(layout, "thumb_browser", tb);
edje_object_signal_callback_add
(tb->edje, "location,changed", "ephoto", _changed_dir, tb);
edje_object_signal_callback_add
(tb->edje, "zoom_out,clicked", "ephoto", _zoom_out, tb);
edje_object_signal_callback_add
(tb->edje, "zoom_in,clicked", "ephoto", _zoom_in, tb);
if (!elm_layout_file_set(layout, THEME_FILE, "ephoto/browser/layout"))
{
@ -296,8 +335,6 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
elm_gengrid_align_set(tb->grid, 0.5, 0.5);
elm_gengrid_bounce_set(tb->grid, EINA_FALSE, EINA_TRUE);
elm_gengrid_item_size_set
(tb->grid, tb->ephoto->config->thumb_size, tb->ephoto->config->thumb_size);
evas_object_size_hint_align_set
(tb->grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set
@ -306,6 +343,8 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
evas_object_smart_callback_add
(tb->grid, "selected", _ephoto_thumb_selected, tb);
_zoom_set(tb, tb->ephoto->config->thumb_size);
elm_layout_content_set(tb->layout, "ephoto.thumb.swallow", tb->grid);
return layout;

Loading…
Cancel
Save