'everything'
- fix popup geometry, same for composited and non-composited now - remove experimental preview plugin SVN revision: 48057
This commit is contained in:
parent
425f9616c4
commit
6cf35e63f2
|
@ -32784,6 +32784,7 @@ collections {
|
|||
image: "everything_drop.png" COMP;
|
||||
}
|
||||
data.item: "shaped" "1";
|
||||
data.item: "shadow_offset" "50";
|
||||
parts {
|
||||
part {
|
||||
name: "win";
|
||||
|
@ -32793,11 +32794,6 @@ collections {
|
|||
visible: 0;
|
||||
min: 386 118;
|
||||
}
|
||||
description {
|
||||
state: "composite" 0.0;
|
||||
visible: 0;
|
||||
min: 486 218;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "frame";
|
||||
|
@ -33032,7 +33028,6 @@ collections {
|
|||
signal: "e,state,composited";
|
||||
source: "e";
|
||||
action: STATE_SET "composite" 0.0;
|
||||
target: "win";
|
||||
target: "frame";
|
||||
target: "shadow";
|
||||
target: "bg";
|
||||
|
@ -33285,9 +33280,10 @@ collections {
|
|||
}
|
||||
/* offset to main popup */
|
||||
data.item: "offset_y" "-2";
|
||||
data.item: "offset_x" "16";
|
||||
data.item: "offset_composite_y" "-52";
|
||||
data.item: "offset_composite_x" "16";
|
||||
data.item: "offset_x" "12";
|
||||
/* data.item: "offset_composite_y" "-52";
|
||||
* data.item: "offset_composite_x" "16"; */
|
||||
data.item: "shadow_offset" "50";
|
||||
data.item: "shaped" "1";
|
||||
parts {
|
||||
part {
|
||||
|
@ -33298,11 +33294,6 @@ collections {
|
|||
visible: 0;
|
||||
min: 400 255;
|
||||
}
|
||||
description {
|
||||
state: "composite" 0.0;
|
||||
visible: 0;
|
||||
min: 500 305;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "frame";
|
||||
|
@ -33814,7 +33805,6 @@ collections {
|
|||
signal: "e,state,composited";
|
||||
source: "e";
|
||||
action: STATE_SET "composite" 0.0;
|
||||
target: "win";
|
||||
target: "shadow";
|
||||
target: "frame";
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ module_la_SOURCES = $(EVRYHEADERS) \
|
|||
evry_plug_actions.c \
|
||||
evry_view_plugin_tabs.c \
|
||||
evry_plug_view_thumb.c \
|
||||
evry_plug_preview.c \
|
||||
evry_plug_view_help.c \
|
||||
evry_plug_clipboard.c
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
/* #undef DBG
|
||||
* #define DBG(...) ERR(__VA_ARGS__) */
|
||||
|
||||
#define CONFIG_VERSION 8
|
||||
#define CONFIG_VERSION 9
|
||||
|
||||
/* actual module specifics */
|
||||
static void _e_mod_action_cb(E_Object *obj, const char *params);
|
||||
|
@ -70,7 +70,6 @@ e_modapi_init(E_Module *m)
|
|||
evry_history_init();
|
||||
|
||||
view_thumb_init();
|
||||
view_preview_init();
|
||||
view_help_init();
|
||||
evry_plug_clipboard_init();
|
||||
|
||||
|
@ -137,7 +136,6 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
}
|
||||
|
||||
view_thumb_shutdown();
|
||||
view_preview_shutdown();
|
||||
view_help_shutdown();
|
||||
evry_plug_clipboard_shutdown();
|
||||
|
||||
|
@ -220,6 +218,14 @@ _config_init()
|
|||
if (evry_conf && evry_conf->version == 7)
|
||||
{
|
||||
evry_conf->scroll_speed = 10.0;
|
||||
evry_conf->version = 8;
|
||||
}
|
||||
|
||||
if (evry_conf && evry_conf->version == 8)
|
||||
{
|
||||
evry_conf->width = 460;
|
||||
evry_conf->height = 310;
|
||||
evry_conf->rel_y = 0.25;
|
||||
evry_conf->version = CONFIG_VERSION;
|
||||
}
|
||||
|
||||
|
@ -234,9 +240,9 @@ _config_init()
|
|||
evry_conf = E_NEW(Evry_Config, 1);
|
||||
evry_conf->version = CONFIG_VERSION;
|
||||
evry_conf->rel_x = 0.5;
|
||||
evry_conf->rel_y = 0.33;
|
||||
evry_conf->width = 0;
|
||||
evry_conf->height = 0;
|
||||
evry_conf->rel_y = 0.25;
|
||||
evry_conf->width = 460;
|
||||
evry_conf->height = 310;
|
||||
evry_conf->scroll_animate = 0;
|
||||
evry_conf->scroll_speed = 10.0;
|
||||
evry_conf->hide_input = 0;
|
||||
|
@ -253,15 +259,6 @@ _config_init()
|
|||
evry_conf->cycle_mode = 0;
|
||||
evry_conf->history_sort_mode = 0;
|
||||
}
|
||||
|
||||
/* TODO: remove - fix old configs */
|
||||
if ((evry_conf->rel_x > 1.0) ||
|
||||
(evry_conf->rel_x < 0.0))
|
||||
evry_conf->rel_x = 0.5;
|
||||
|
||||
if ((evry_conf->rel_y > 1.0) ||
|
||||
(evry_conf->rel_y < 0.0))
|
||||
evry_conf->rel_y = 0.3;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -512,8 +512,8 @@ _evry_list_win_new(E_Zone *zone)
|
|||
Evry_List_Window *list_win;
|
||||
E_Popup *popup;
|
||||
Evas_Object *o;
|
||||
const char *offset_y;
|
||||
const char *offset_x;
|
||||
const char *tmp;
|
||||
int offset_x, offset_y, offset_s;
|
||||
|
||||
if (!evry_conf->views) return NULL;
|
||||
|
||||
|
@ -533,18 +533,20 @@ _evry_list_win_new(E_Zone *zone)
|
|||
e_theme_edje_object_set(o, "base/theme/everything",
|
||||
"e/modules/everything/list");
|
||||
|
||||
tmp = edje_object_data_get(o, "offset_x");
|
||||
offset_x = tmp ? atoi(tmp) : 0;
|
||||
tmp = edje_object_data_get(o, "offset_y");
|
||||
offset_y = tmp ? atoi(tmp) : 0;
|
||||
|
||||
if (e_config->use_composite)
|
||||
{
|
||||
edje_object_signal_emit(o, "e,state,composited", "e");
|
||||
edje_object_message_signal_process(o);
|
||||
edje_object_calc_force(o);
|
||||
offset_x = edje_object_data_get(o, "offset_composite_x");
|
||||
offset_y = edje_object_data_get(o, "offset_composite_y");
|
||||
}
|
||||
else
|
||||
{
|
||||
offset_x = edje_object_data_get(o, "offset_x");
|
||||
offset_y = edje_object_data_get(o, "offset_y");
|
||||
|
||||
tmp = edje_object_data_get(o, "shadow_offset");
|
||||
offset_s = tmp ? atoi(tmp) : 0;
|
||||
offset_y -= offset_s;
|
||||
}
|
||||
|
||||
edje_object_size_min_calc(o, &mw, &mh);
|
||||
|
@ -556,10 +558,11 @@ _evry_list_win_new(E_Zone *zone)
|
|||
if (evry_conf->height > mh)
|
||||
mh = evry_conf->height;
|
||||
|
||||
x = win->popup->x + (offset_x ? atoi(offset_x) : 0);
|
||||
y = (win->popup->y + win->popup->h) + (offset_y ? atoi(offset_y) : 0);
|
||||
x = win->popup->x + offset_x;
|
||||
y = (win->popup->y + win->popup->h) + offset_y;
|
||||
|
||||
w = win->popup->w - (offset_x ? atoi(offset_x) : 0)*2;
|
||||
w = win->popup->w - offset_x*2;
|
||||
mh += offset_s;
|
||||
e_popup_move_resize(popup, x, y, w, mh);
|
||||
|
||||
o = list_win->o_main;
|
||||
|
@ -621,7 +624,9 @@ _evry_window_new(E_Zone *zone)
|
|||
Evry_Window *win;
|
||||
E_Popup *popup;
|
||||
Evas_Object *o;
|
||||
|
||||
const char *tmp;
|
||||
int offset_s = 0;
|
||||
|
||||
popup = e_popup_new(zone, 0, 0, 1, 1);
|
||||
if (!popup) return NULL;
|
||||
|
||||
|
@ -644,15 +649,18 @@ _evry_window_new(E_Zone *zone)
|
|||
edje_object_signal_emit(o, "e,state,composited", "e");
|
||||
edje_object_message_signal_process(o);
|
||||
edje_object_calc_force(o);
|
||||
|
||||
tmp = edje_object_data_get(o, "shadow_offset");
|
||||
offset_s = tmp ? atoi(tmp) : 0;
|
||||
}
|
||||
|
||||
edje_object_size_min_calc(o, &mw, &mh);
|
||||
|
||||
evry_conf->min_w = mw;
|
||||
|
||||
if (evry_conf->width > mw)
|
||||
mw = evry_conf->width;
|
||||
|
||||
mw += offset_s*2;
|
||||
mh += offset_s*2;
|
||||
x = (zone->w * evry_conf->rel_x) - (mw / 2);
|
||||
y = (zone->h * evry_conf->rel_y) - (mh / 2);
|
||||
|
||||
|
|
|
@ -1,262 +0,0 @@
|
|||
#include "Evry.h"
|
||||
|
||||
typedef struct _Image_View Image_View;
|
||||
|
||||
|
||||
struct _Image_View
|
||||
{
|
||||
Evry_View view;
|
||||
Evas *evas;
|
||||
|
||||
const Evry_State *state;
|
||||
|
||||
Evas_Object *o_main;
|
||||
|
||||
Eina_List *items;
|
||||
Evas_Object *o_thumb[4];
|
||||
};
|
||||
|
||||
|
||||
static Evry_View *view = NULL;
|
||||
static const char *view_types = NULL;
|
||||
|
||||
static int
|
||||
_check_item(const Evry_Item *it)
|
||||
{
|
||||
if (!it || it->plugin->type_out != view_types) return 0;
|
||||
|
||||
ITEM_FILE(file, it);
|
||||
|
||||
if (!file->path || !file->mime) return 0;
|
||||
|
||||
if (!strncmp(file->mime, "image/", 6))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_preview_thumb_gen(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Coord w, h;
|
||||
Image_View *v = data;
|
||||
|
||||
e_icon_size_get(v->o_thumb[1], &w, &h);
|
||||
edje_extern_object_min_size_set(v->o_thumb[1], w, h);
|
||||
edje_object_part_swallow(v->o_main, "e.swallow.icon2", v->o_thumb[1]);
|
||||
evas_object_show(v->o_thumb[1]);
|
||||
}
|
||||
|
||||
void
|
||||
_show_item(Image_View *v, const Evry_Item_File *file, int dir)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
if (v->o_thumb[1 + dir])
|
||||
{
|
||||
e_thumb_icon_end(v->o_thumb[1+dir]);
|
||||
edje_object_part_unswallow(v->o_main, v->o_thumb[1+dir]);
|
||||
evas_object_hide(v->o_thumb[1+dir]);
|
||||
evas_object_del(v->o_thumb[1+dir]);
|
||||
}
|
||||
|
||||
if (dir && v->o_thumb[1])
|
||||
{
|
||||
edje_object_part_unswallow(v->o_main, v->o_thumb[1]);
|
||||
|
||||
if (dir > 0)
|
||||
{
|
||||
v->o_thumb[2] = v->o_thumb[1];
|
||||
edje_object_part_swallow(v->o_main, "e.swallow.icon1", v->o_thumb[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
v->o_thumb[0] = v->o_thumb[1];
|
||||
edje_object_part_swallow(v->o_main, "e.swallow.icon3", v->o_thumb[0]);
|
||||
}
|
||||
}
|
||||
|
||||
v->o_thumb[1] = e_thumb_icon_add(v->evas);
|
||||
e_thumb_icon_file_set(v->o_thumb[1], file->path, NULL);
|
||||
evas_object_smart_callback_add(v->o_thumb[1], "e_thumb_gen", _cb_preview_thumb_gen, v);
|
||||
edje_object_part_geometry_get(v->o_main, "e.swallow.icon2", NULL, NULL, &w, &h);
|
||||
e_thumb_icon_size_set(v->o_thumb[1], w, h);
|
||||
e_thumb_icon_begin(v->o_thumb[1]);
|
||||
|
||||
if (dir)
|
||||
{
|
||||
if (dir > 0)
|
||||
edje_object_signal_emit(v->o_main, "e,signal,slide_left", "e");
|
||||
else
|
||||
edje_object_signal_emit(v->o_main, "e,signal,slide_right", "e");
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
|
||||
{
|
||||
Image_View *v = (Image_View *) view;
|
||||
|
||||
Eina_List *l;
|
||||
Evry_Item_File *file = NULL;
|
||||
|
||||
ITEM_FILE(cur_item, v->state->cur_item);
|
||||
|
||||
if (!strcmp(ev->key, "Down"))
|
||||
{
|
||||
if (!v->items) return 1;
|
||||
|
||||
l = eina_list_data_find_list(v->items, cur_item);
|
||||
|
||||
if (l && l->next)
|
||||
file = l->next->data;
|
||||
else
|
||||
file = v->items->data;
|
||||
|
||||
if (file && (file != cur_item))
|
||||
{
|
||||
_show_item(v, file, 1);
|
||||
evry_item_select(v->state, EVRY_ITEM(file));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else if (!strcmp(ev->key, "Up"))
|
||||
{
|
||||
if (!v->items) return 1;
|
||||
|
||||
l = eina_list_data_find_list(v->items, cur_item);
|
||||
|
||||
if (l && l->prev)
|
||||
file = l->prev->data;
|
||||
else
|
||||
file = eina_list_last(v->items)->data;
|
||||
|
||||
if (file && (file != cur_item))
|
||||
{
|
||||
_show_item(v, file, -1);
|
||||
evry_item_select(v->state, EVRY_ITEM(file));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_view_clear(Evry_View *view)
|
||||
{
|
||||
Image_View *v = (Image_View *) view;
|
||||
|
||||
if (v->o_thumb[0]) evas_object_del(v->o_thumb[0]);
|
||||
v->o_thumb[0] = NULL;
|
||||
if (v->o_thumb[1]) evas_object_del(v->o_thumb[1]);
|
||||
v->o_thumb[1] = NULL;
|
||||
if (v->o_thumb[2]) evas_object_del(v->o_thumb[2]);
|
||||
v->o_thumb[2] = NULL;
|
||||
if (v->items) eina_list_free(v->items);
|
||||
v->items = NULL;
|
||||
}
|
||||
|
||||
static Eina_List *
|
||||
_get_list(const Evry_State *s)
|
||||
{
|
||||
Eina_List *l, *items = NULL;
|
||||
Evry_Item *it;
|
||||
|
||||
EINA_LIST_FOREACH(s->plugin->items, l, it)
|
||||
if (_check_item(it))
|
||||
items = eina_list_append(items, it);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
static int
|
||||
_view_update(Evry_View *view)
|
||||
{
|
||||
Image_View *v = (Image_View *) view;
|
||||
Evry_Item_File *file;
|
||||
Evry_Item *selected = v->state->cur_item;
|
||||
|
||||
v->items = _get_list(v->state);
|
||||
if (!v->items) return 0;
|
||||
|
||||
file = eina_list_data_find(v->items, selected);
|
||||
if (!file)
|
||||
{
|
||||
file = v->items->data;
|
||||
evry_item_select(v->state, EVRY_ITEM(file));
|
||||
}
|
||||
|
||||
_show_item(v, file, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evry_View *
|
||||
_view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
|
||||
{
|
||||
Image_View *v;
|
||||
int w, h, x, y;
|
||||
|
||||
if (!s->plugin)
|
||||
return NULL;
|
||||
|
||||
if (!_get_list(s))
|
||||
return NULL;
|
||||
|
||||
v = E_NEW(Image_View, 1);
|
||||
v->view = *view;
|
||||
v->state = s;
|
||||
v->evas = evas_object_evas_get(swallow);
|
||||
v->o_main = edje_object_add(v->evas);
|
||||
e_theme_edje_object_set(v->o_main, "base/theme/everything",
|
||||
"e/modules/everything/preview");
|
||||
|
||||
edje_object_part_geometry_get(swallow, "e.swallow.list", &x, &y, &w, &h);
|
||||
edje_extern_object_min_size_set(v->o_main, w * 3, 100);
|
||||
evas_object_resize(v->o_main, w * 3, h);
|
||||
|
||||
EVRY_VIEW(v)->o_list = v->o_main;
|
||||
|
||||
return EVRY_VIEW(v);
|
||||
}
|
||||
|
||||
static void
|
||||
_view_destroy(Evry_View *view)
|
||||
{
|
||||
Image_View *v = (Image_View *) view;
|
||||
|
||||
_view_clear(view);
|
||||
evas_object_del(v->o_main);
|
||||
|
||||
E_FREE(v);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
view_preview_init(void)
|
||||
{
|
||||
if (!evry_api_version_check(EVRY_API_VERSION))
|
||||
return EINA_FALSE;
|
||||
|
||||
view = E_NEW(Evry_View, 1);
|
||||
view->id = view;
|
||||
view->name = "Image Viewer";
|
||||
view->create = &_view_create;
|
||||
view->destroy = &_view_destroy;
|
||||
view->update = &_view_update;
|
||||
view->clear = &_view_clear;
|
||||
view->cb_key_down = &_cb_key_down;
|
||||
evry_view_register(view, 3);
|
||||
|
||||
view_types = eina_stringshare_add("FILE");
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
view_preview_shutdown(void)
|
||||
{
|
||||
eina_stringshare_del(view_types);
|
||||
evry_view_unregister(view);
|
||||
E_FREE(view);
|
||||
}
|
Loading…
Reference in New Issue