forked from enlightenment/enlightenment
* More cleanups. I took out everything related only to icon handling
from the view code, and put it into icons.[ch]. * Added the relative desktop move path from Alan Schmitt. SVN revision: 5616
This commit is contained in:
parent
59b09b8121
commit
a708bdfd42
2
AUTHORS
2
AUTHORS
|
@ -1,3 +1,5 @@
|
|||
The Rasterman <raster@rasterman.com>
|
||||
Christian Kreibich <cK@whoop.org>
|
||||
Burra <burra@colorado.edu>
|
||||
Graham MacDonald <macdonag@lineone.net>
|
||||
Alan Schmitt <alan.schmitt@inria.fr>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -305,6 +305,22 @@ edb_ed $DB add "/actions/"$NUM"/button" int 0
|
|||
edb_ed $DB add "/actions/"$NUM"/key" str "F8"
|
||||
edb_ed $DB add "/actions/"$NUM"/modifiers" int $MOD_ALT
|
||||
NUM=$[ $NUM + 1 ];
|
||||
edb_ed $DB add "/actions/"$NUM"/name" str Key_Binding
|
||||
edb_ed $DB add "/actions/"$NUM"/action" str Desktop_Relative
|
||||
edb_ed $DB add "/actions/"$NUM"/params" str 1
|
||||
edb_ed $DB add "/actions/"$NUM"/event" int 8
|
||||
edb_ed $DB add "/actions/"$NUM"/button" int 0
|
||||
edb_ed $DB add "/actions/"$NUM"/key" str Right
|
||||
edb_ed $DB add "/actions/"$NUM"/modifiers" int 6
|
||||
NUM=$[ $NUM + 1 ];
|
||||
edb_ed $DB add "/actions/"$NUM"/name" str Key_Binding
|
||||
edb_ed $DB add "/actions/"$NUM"/action" str Desktop_Relative
|
||||
edb_ed $DB add "/actions/"$NUM"/params" str -1
|
||||
edb_ed $DB add "/actions/"$NUM"/event" int 8
|
||||
edb_ed $DB add "/actions/"$NUM"/button" int 0
|
||||
edb_ed $DB add "/actions/"$NUM"/key" str Left
|
||||
edb_ed $DB add "/actions/"$NUM"/modifiers" int 6
|
||||
NUM=$[ $NUM + 1 ];
|
||||
edb_ed $DB add "/actions/count" int $NUM
|
||||
|
||||
# basic settings
|
||||
|
|
|
@ -131,6 +131,7 @@
|
|||
!Isrc/fs.h
|
||||
!Isrc/guides.h
|
||||
!Isrc/iconbar.c
|
||||
!Isrc/icons.h
|
||||
!Isrc/menu.h
|
||||
!Isrc/menu.c
|
||||
!Isrc/object.h
|
||||
|
|
|
@ -39,9 +39,10 @@ enlightenment_SOURCES = \
|
|||
fs.h fs.c \
|
||||
$(ferite_c) \
|
||||
guides.h guides.c \
|
||||
globals.h globals.c \
|
||||
icccm.h icccm.c \
|
||||
iconbar.h iconbar.c\
|
||||
icons.c \
|
||||
icons.h icons.c\
|
||||
ipc.h ipc.c \
|
||||
keys.h keys.c \
|
||||
main.c \
|
||||
|
|
|
@ -108,6 +108,10 @@ static void e_act_desk_start (E_Object *object, E_Action *a, void *data,
|
|||
static void e_act_raise_next_start (E_Object *object, E_Action *a, void *data,
|
||||
int x, int y, int rx, int ry);
|
||||
|
||||
static void e_act_desk_rel_start (E_Object *object, E_Action *a, void *data,
|
||||
int x, int y, int rx, int ry);
|
||||
|
||||
|
||||
static void
|
||||
e_action_find(char *action, E_Action_Type act, int button,
|
||||
char *key, Ecore_Event_Key_Modifiers mods, E_Object *object)
|
||||
|
@ -622,6 +626,7 @@ e_action_init(void)
|
|||
e_action_add_impl("Winodw_Snap", e_act_snap_start, NULL, NULL);
|
||||
e_action_add_impl("Window_Zoom", e_act_zoom_start, NULL, NULL);
|
||||
e_action_add_impl("Desktop", e_act_desk_start, NULL, NULL);
|
||||
e_action_add_impl("Desktop_Relative", e_act_desk_rel_start, NULL, NULL);
|
||||
e_action_add_impl("Window_Next", e_act_raise_next_start, NULL, NULL);
|
||||
|
||||
D_RETURN;
|
||||
|
@ -1737,6 +1742,35 @@ e_act_desk_start (E_Object *object, E_Action *a, void *data, int x, int y, int r
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
e_act_desk_rel_start (E_Object *object, E_Action *a, void *data, int x, int y, int rx, int ry)
|
||||
{
|
||||
int desk = 0;
|
||||
int desk_max = e_desktops_get_num () - 1;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (a->params)
|
||||
desk = atoi(a->params) + e_desktops_get_current();
|
||||
|
||||
if (desk < 0)
|
||||
desk = desk_max;
|
||||
else if (desk > desk_max)
|
||||
desk = 0;
|
||||
|
||||
e_desktops_goto_desk(desk);
|
||||
|
||||
D_RETURN;
|
||||
UN(object);
|
||||
UN(a);
|
||||
UN(data);
|
||||
UN(x);
|
||||
UN(y);
|
||||
UN(rx);
|
||||
UN(ry);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
e_act_raise_next_start (E_Object *object, E_Action *a, void *data, int x, int y, int rx, int ry)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef E_ACTIONS_H
|
||||
#define E_ACTIONS_H
|
||||
|
||||
#include "e.h"
|
||||
#include "object.h"
|
||||
|
||||
typedef struct _E_Action E_Action;
|
||||
|
|
21
src/config.c
21
src/config.c
|
@ -5,16 +5,6 @@
|
|||
|
||||
static char cfg_root[] = "";
|
||||
|
||||
#define E_CONF(_key, _var, _args...) \
|
||||
{ \
|
||||
if (!strcmp(type, _key)) \
|
||||
{ \
|
||||
if ((_var)[0]) D_RETURN_(_var); \
|
||||
sprintf((_var), ## _args); \
|
||||
D_RETURN_(_var); \
|
||||
} \
|
||||
}
|
||||
|
||||
static char cfg_grabs_db[PATH_MAX] = "";
|
||||
static char cfg_settings_db[PATH_MAX] = "";
|
||||
static char cfg_actions_db[PATH_MAX] = "";
|
||||
|
@ -51,6 +41,17 @@ e_config_get(char *type)
|
|||
/* "%sbehavior/default/grabs.db", e_config_user_dir()); */
|
||||
/* notice it would use the user config location instead */
|
||||
/* but for now i'm keeping it as is for development "ease" */
|
||||
|
||||
#define E_CONF(_key, _var, _args...) \
|
||||
{ \
|
||||
if (!strcmp(type, _key)) \
|
||||
{ \
|
||||
if ((_var)[0]) D_RETURN_(_var); \
|
||||
sprintf((_var), ## _args); \
|
||||
D_RETURN_(_var); \
|
||||
} \
|
||||
}
|
||||
|
||||
E_CONF("grabs", cfg_grabs_db,
|
||||
"%s/behavior/grabs.db", e_config_user_dir());
|
||||
E_CONF("settings", cfg_settings_db,
|
||||
|
|
11
src/e.h
11
src/e.h
|
@ -97,15 +97,4 @@ printf("%3.3f : %s()\n", __p->total, __p->func); \
|
|||
#define E_PROF_DUMP
|
||||
#endif
|
||||
|
||||
|
||||
/* misc util macros */
|
||||
#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
|
||||
(((x) < ((xx) + (ww))) && \
|
||||
((y) < ((yy) + (hh))) && \
|
||||
(((x) + (w)) > (xx)) && \
|
||||
(((y) + (h)) > (yy)))
|
||||
#define SPANS_COMMON(x1, w1, x2, w2) \
|
||||
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
|
||||
#define UN(_blah) _blah = 0
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "debug.h"
|
||||
#include "embed.h"
|
||||
#include "util.h"
|
||||
|
||||
typedef struct _Embed Embed_Private;
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "e.h"
|
||||
#include "debug.h"
|
||||
#include "file.h"
|
||||
#include "util.h"
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef E_FILE_H
|
||||
#define E_FILE_H
|
||||
|
||||
#include "e.h"
|
||||
|
||||
time_t e_file_mod_time(char *file);
|
||||
int e_file_exists(char *file);
|
||||
int e_file_is_dir(char *file);
|
||||
|
|
1
src/fs.c
1
src/fs.c
|
@ -1,6 +1,7 @@
|
|||
#include "debug.h"
|
||||
#include "fs.h"
|
||||
#include "exec.h"
|
||||
#include "util.h"
|
||||
|
||||
static EfsdConnection *ec = NULL;
|
||||
static Evas_List fs_handlers = NULL;
|
||||
|
|
1
src/fs.h
1
src/fs.h
|
@ -2,7 +2,6 @@
|
|||
#define E_FS_H
|
||||
|
||||
#include <libefsd.h>
|
||||
#include "e.h"
|
||||
|
||||
typedef struct _E_FS_Restarter E_FS_Restarter;
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#include <Evas.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
|
||||
Ecore_Event_Key_Modifiers mulit_select_mod = ECORE_EVENT_KEY_MODIFIER_SHIFT;
|
||||
Ecore_Event_Key_Modifiers range_select_mod = ECORE_EVENT_KEY_MODIFIER_CTRL;
|
||||
Evas_List views = NULL;
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef E_GLOBALS_H
|
||||
#define E_GLOBALS_H
|
||||
|
||||
extern Ecore_Event_Key_Modifiers mulit_select_mod;
|
||||
extern Ecore_Event_Key_Modifiers range_select_mod;
|
||||
extern Evas_List views;
|
||||
|
||||
#endif
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef E_GUIDES_H
|
||||
#define E_GUIDES_H
|
||||
|
||||
#include "e.h"
|
||||
|
||||
typedef enum e_guides_mode
|
||||
{
|
||||
E_GUIDES_OPAQUE, /* configure window border & client */
|
||||
|
|
891
src/icons.c
891
src/icons.c
|
@ -1 +1,890 @@
|
|||
#include "e.h"
|
||||
#include "icons.h"
|
||||
#include "debug.h"
|
||||
#include "globals.h"
|
||||
#include "cursors.h"
|
||||
#include "file.h"
|
||||
#include "util.h"
|
||||
|
||||
static void e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
||||
static void e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
||||
static void e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
||||
static void e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
||||
static void e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
||||
|
||||
|
||||
static void
|
||||
e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
||||
{
|
||||
E_Icon *ic;
|
||||
Ecore_Event *ev;
|
||||
Ecore_Event_Mouse_Down *e;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
ev = e_view_get_current_event();
|
||||
if (!ev) D_RETURN;
|
||||
e = ev->event;
|
||||
ic = _data;
|
||||
ic->view->select.down.x = _x;
|
||||
ic->view->select.down.y = _y;
|
||||
ic->state.clicked = 1;
|
||||
e_icon_update_state(ic);
|
||||
if (_b == 1)
|
||||
{
|
||||
if (e->double_click)
|
||||
{
|
||||
e_icon_exec(ic);
|
||||
ic->state.just_executed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ic->state.selected)
|
||||
{
|
||||
if ((e->mods & mulit_select_mod))
|
||||
{
|
||||
e_icon_select(ic);
|
||||
}
|
||||
else
|
||||
{
|
||||
e_view_deselect_all_except(ic);
|
||||
e_icon_select(ic);
|
||||
}
|
||||
ic->state.just_selected = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_b == 2)
|
||||
{
|
||||
}
|
||||
else if (_b == 3)
|
||||
{
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
UN(_e);
|
||||
UN(_o);
|
||||
}
|
||||
|
||||
static void
|
||||
e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
||||
{
|
||||
E_Icon *ic;
|
||||
Ecore_Event *ev;
|
||||
Ecore_Event_Mouse_Up *e;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
ev = e_view_get_current_event();
|
||||
if (!ev) D_RETURN;
|
||||
e = ev->event;
|
||||
ic = _data;
|
||||
if (ic->view->drag.started)
|
||||
{
|
||||
ic->state.clicked = 0;
|
||||
ic->state.just_selected = 0;
|
||||
e_icon_update_state(ic);
|
||||
ecore_window_destroy(ic->view->drag.win);
|
||||
ic->view->drag.started = 0;
|
||||
D_RETURN;
|
||||
}
|
||||
if (_b == 1)
|
||||
{
|
||||
if (ic->state.just_executed)
|
||||
{
|
||||
ic->state.just_executed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((e->mods & mulit_select_mod))
|
||||
{
|
||||
if ((ic->state.selected) && (!ic->state.just_selected))
|
||||
e_icon_deselect(ic);
|
||||
}
|
||||
else
|
||||
{
|
||||
e_view_deselect_all_except(ic);
|
||||
e_icon_select(ic);
|
||||
}
|
||||
}
|
||||
ic->state.just_selected = 0;
|
||||
}
|
||||
ic->state.clicked = 0;
|
||||
e_icon_update_state(ic);
|
||||
|
||||
D_RETURN;
|
||||
UN(_e);
|
||||
UN(_o);
|
||||
UN(_x);
|
||||
UN(_y);
|
||||
}
|
||||
|
||||
static void
|
||||
e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
||||
{
|
||||
E_Icon *ic;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
ic = _data;
|
||||
e_cursors_display_in_window(ic->view->win.main, "View_Icon");
|
||||
|
||||
D_RETURN;
|
||||
UN(_e);
|
||||
UN(_o);
|
||||
UN(_b);
|
||||
UN(_x);
|
||||
UN(_y);
|
||||
}
|
||||
|
||||
static void
|
||||
e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
||||
{
|
||||
E_Icon *ic;
|
||||
|
||||
ic = _data;
|
||||
e_cursors_display_in_window(ic->view->win.main, "View");
|
||||
|
||||
D_RETURN;
|
||||
UN(_e);
|
||||
UN(_o);
|
||||
UN(_b);
|
||||
UN(_x);
|
||||
UN(_y);
|
||||
}
|
||||
|
||||
static void
|
||||
e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
||||
{
|
||||
E_Icon *ic;
|
||||
Ecore_Event *ev;
|
||||
Ecore_Event_Mouse_Move *e;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
ev = e_view_get_current_event();
|
||||
|
||||
if (!ev)
|
||||
D_RETURN;
|
||||
|
||||
e = ev->event;
|
||||
ic = _data;
|
||||
|
||||
if (!ic->state.clicked)
|
||||
D_RETURN;
|
||||
|
||||
if (!ic->view->drag.started)
|
||||
{
|
||||
int dx, dy;
|
||||
|
||||
dx = ic->view->select.down.x - _x;
|
||||
dy = ic->view->select.down.y - _y;
|
||||
if (dx < 0) dx = -dx;
|
||||
if (dy < 0) dy = -dy;
|
||||
if ((dx > 3) || (dy > 3))
|
||||
{
|
||||
Pixmap pmap, mask;
|
||||
Evas_List l;
|
||||
int x, y, xx, yy, rw, rh, downx, downy, wx, wy, ww, wh;
|
||||
|
||||
/* find extents of icons to be dragged */
|
||||
x = 999999999;
|
||||
y = 999999999;
|
||||
xx = -999999999;
|
||||
yy = -999999999;
|
||||
for (l = views; l; l = l->next)
|
||||
{
|
||||
E_View *v;
|
||||
Evas_List ll;
|
||||
|
||||
v = l->data;
|
||||
D("sel count %i\n", v->sel_count);
|
||||
if (v->sel_count > 0)
|
||||
{
|
||||
for (ll = v->icons; ll; ll = ll->next)
|
||||
{
|
||||
E_Icon *ic;
|
||||
|
||||
ic = ll->data;
|
||||
if (ic->state.selected)
|
||||
{
|
||||
int ix, iy, iw, ih;
|
||||
|
||||
ix = ic->view->scroll.x + ic->geom.x + v->location.x;
|
||||
iy = ic->view->scroll.y + ic->geom.y + v->location.y;
|
||||
iw = ic->geom.w;
|
||||
ih = ic->geom.h;
|
||||
if (ix < x) x = ix;
|
||||
if (iy < y) y = iy;
|
||||
if ((ix + iw) > xx) xx = ix + iw;
|
||||
if ((iy + ih) > yy) yy = iy + ih;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ecore_window_get_geometry(0, NULL, NULL, &rw, &rh);
|
||||
downx = ic->view->select.down.x + ic->view->location.x;
|
||||
downy = ic->view->select.down.y + ic->view->location.y;
|
||||
|
||||
wx = x;
|
||||
ww = xx - x;
|
||||
if (wx < - (rw - downx))
|
||||
{
|
||||
wx = - (rw - downx);
|
||||
ww -= (wx - x);
|
||||
}
|
||||
if ((wx + ww) > (rw + downx))
|
||||
ww = (rw + downx) - wx;
|
||||
wy = y;
|
||||
wh = yy - y;
|
||||
if (wy < - (rh - downy))
|
||||
{
|
||||
wy = - (rh - downy);
|
||||
wh -= (wy - y);
|
||||
}
|
||||
if ((wy + wh) > (rh + downy))
|
||||
wh = (rh + downy) - wy;
|
||||
|
||||
|
||||
ic->view->drag.x = wx + ic->view->location.x;
|
||||
ic->view->drag.y = wy + ic->view->location.y;
|
||||
ic->view->drag.offset.x = downx - ic->view->drag.x;
|
||||
ic->view->drag.offset.y = downy - ic->view->drag.y;
|
||||
|
||||
if ((ww < 1) || (wh < 1)) D_RETURN;
|
||||
ic->view->drag.win = ecore_window_override_new(0, wx, wy, ww, wh);
|
||||
pmap = ecore_pixmap_new(ic->view->drag.win, ww, wh, 0);
|
||||
mask = ecore_pixmap_new(ic->view->drag.win, ww, wh, 1);
|
||||
{
|
||||
Imlib_Image im;
|
||||
|
||||
im = imlib_create_image(ww, wh);
|
||||
imlib_context_set_image(im);
|
||||
imlib_image_set_has_alpha(1);
|
||||
imlib_context_set_blend(1);
|
||||
imlib_image_clear();
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_cliprect(0, 0, 0, 0);
|
||||
imlib_context_set_angle(0);
|
||||
|
||||
for (l = views; l; l = l->next)
|
||||
{
|
||||
E_View *v;
|
||||
Evas_List ll;
|
||||
|
||||
v = l->data;
|
||||
if (v->sel_count > 0)
|
||||
{
|
||||
for (ll = v->icons; ll; ll = ll->next) {
|
||||
E_Icon *ic;
|
||||
|
||||
ic = ll->data;
|
||||
if (ic->state.selected)
|
||||
{
|
||||
double ix, iy;
|
||||
int icx, icy;
|
||||
Imlib_Image im2;
|
||||
char icon[PATH_MAX];
|
||||
|
||||
evas_get_geometry(ic->view->evas,
|
||||
ic->obj.icon,
|
||||
&ix, &iy, NULL, NULL);
|
||||
icx = ix + v->location.x - wx;
|
||||
icy = iy + v->location.y - wy;
|
||||
if (!ic->info.icon)
|
||||
{
|
||||
D("EEEEEEEEEEK %s has no icon\n", ic->file);
|
||||
D_RETURN;
|
||||
}
|
||||
if (ic->state.clicked)
|
||||
{
|
||||
sprintf(icon, "%s:/icon/clicked", ic->info.icon);
|
||||
}
|
||||
else if (ic->state.selected)
|
||||
{
|
||||
sprintf(icon, "%s:/icon/selected", ic->info.icon);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(icon, "%s:/icon/normal", ic->info.icon);
|
||||
}
|
||||
im2 = imlib_load_image(icon);
|
||||
if (im2)
|
||||
{
|
||||
int iw, ih;
|
||||
|
||||
imlib_context_set_image(im2);
|
||||
iw = imlib_image_get_width();
|
||||
ih = imlib_image_get_height();
|
||||
imlib_context_set_image(im);
|
||||
imlib_blend_image_onto_image(im2, 1,
|
||||
0, 0, iw, ih,
|
||||
icx, icy, iw, ih);
|
||||
imlib_context_set_image(im2);
|
||||
imlib_free_image();
|
||||
imlib_context_set_image(im);
|
||||
}
|
||||
else
|
||||
{
|
||||
D("eek cant load\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
imlib_context_set_image(im);
|
||||
if (ww * wh < (200 * 200)) imlib_context_set_dither_mask(1);
|
||||
else imlib_context_set_dither_mask(0);
|
||||
imlib_context_set_dither(1);
|
||||
imlib_context_set_drawable(pmap);
|
||||
imlib_context_set_mask(mask);
|
||||
imlib_context_set_blend(0);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_render_image_on_drawable(0, 0);
|
||||
imlib_free_image();
|
||||
}
|
||||
ecore_window_set_background_pixmap(ic->view->drag.win, pmap);
|
||||
ecore_window_set_shape_mask(ic->view->drag.win, mask);
|
||||
ecore_window_ignore(ic->view->drag.win);
|
||||
ecore_window_raise(ic->view->drag.win);
|
||||
ecore_window_show(ic->view->drag.win);
|
||||
ecore_pixmap_free(pmap);
|
||||
ecore_pixmap_free(mask);
|
||||
ic->view->drag.started = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ic->view->drag.started)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
x = _x - ic->view->drag.offset.x;
|
||||
y = _y - ic->view->drag.offset.y;
|
||||
ic->view->drag.x = x;
|
||||
ic->view->drag.y = y;
|
||||
ic->view->drag.update = 1;
|
||||
ic->view->changed = 1;
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
UN(_e);
|
||||
UN(_o);
|
||||
UN(_b);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
e_icon_cleanup(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
/* FIXME: free stuff here! this leaks ... */
|
||||
|
||||
e_object_cleanup(E_OBJECT(ic));
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
E_Icon *
|
||||
e_icon_new(void)
|
||||
{
|
||||
E_Icon *ic;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
ic = NEW(E_Icon, 1);
|
||||
ZERO(ic, E_Icon, 1);
|
||||
|
||||
e_object_init(E_OBJECT(ic), (E_Cleanup_Func) e_icon_cleanup);
|
||||
|
||||
D_RETURN_(ic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
E_Icon *
|
||||
e_icon_find_by_file(E_View *view, char *file)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
for (l = view->icons; l; l = l->next)
|
||||
{
|
||||
E_Icon *ic;
|
||||
|
||||
ic = l->data;
|
||||
if ((ic) && (ic->file) && (file) && (!strcmp(ic->file, file)))
|
||||
D_RETURN_(ic);
|
||||
}
|
||||
D_RETURN_(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_show(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
|
||||
if (ic->state.visible) D_RETURN;
|
||||
ic->state.visible = 1;
|
||||
if (!ic->obj.event1)
|
||||
{
|
||||
ic->obj.event1 = evas_add_rectangle(ic->view->evas);
|
||||
ic->obj.event2 = evas_add_rectangle(ic->view->evas);
|
||||
evas_set_color(ic->view->evas, ic->obj.event1, 0, 0, 0, 0);
|
||||
evas_set_color(ic->view->evas, ic->obj.event2, 0, 0, 0, 0);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_UP, e_icon_up_cb, ic);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_IN, e_icon_in_cb, ic);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_OUT, e_icon_out_cb, ic);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_UP, e_icon_up_cb, ic);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_IN, e_icon_in_cb, ic);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_OUT, e_icon_out_cb, ic);
|
||||
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic);
|
||||
}
|
||||
evas_set_layer(ic->view->evas, ic->obj.icon, 200);
|
||||
e_text_set_layer(ic->obj.text, 200);
|
||||
evas_set_layer(ic->view->evas, ic->obj.event1, 210);
|
||||
evas_set_layer(ic->view->evas, ic->obj.event2, 210);
|
||||
|
||||
evas_show(ic->view->evas, ic->obj.icon);
|
||||
e_text_show(ic->obj.text);
|
||||
evas_show(ic->view->evas, ic->obj.event1);
|
||||
evas_show(ic->view->evas, ic->obj.event2);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_hide(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if (!ic->state.visible) D_RETURN;
|
||||
ic->state.visible = 0;
|
||||
evas_hide(ic->view->evas, ic->obj.icon);
|
||||
e_text_hide(ic->obj.text);
|
||||
evas_hide(ic->view->evas, ic->obj.event1);
|
||||
evas_hide(ic->view->evas, ic->obj.event2);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_apply_xy(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
/* threse calc icon extents for: */
|
||||
/* [I] */
|
||||
/* Ig */
|
||||
/* [txt] */
|
||||
|
||||
if (ic->geom.text.w > ic->geom.icon.w) ic->geom.w = ic->geom.text.w;
|
||||
else ic->geom.w = ic->geom.icon.w;
|
||||
ic->geom.h = ic->geom.icon.h + ic->geom.text.h + ic->view->spacing.icon.g;
|
||||
|
||||
evas_resize(ic->view->evas, ic->obj.event1,
|
||||
ic->geom.icon.w, ic->geom.icon.h);
|
||||
evas_resize(ic->view->evas, ic->obj.event2,
|
||||
ic->geom.text.w, ic->geom.text.h);
|
||||
evas_move(ic->view->evas, ic->obj.event1,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2),
|
||||
ic->view->scroll.y + ic->geom.y);
|
||||
evas_move(ic->view->evas, ic->obj.event2,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2),
|
||||
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
|
||||
evas_move(ic->view->evas, ic->obj.icon,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2),
|
||||
ic->view->scroll.y + ic->geom.y);
|
||||
e_text_move(ic->obj.text,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2),
|
||||
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
|
||||
if (ic->obj.sel.under.icon)
|
||||
{
|
||||
int pl, pr, pt, pb;
|
||||
|
||||
ebits_get_insets(ic->obj.sel.under.icon, &pl, &pr, &pt, &pb);
|
||||
ebits_move(ic->obj.sel.under.icon,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2) - pl,
|
||||
ic->view->scroll.y + ic->geom.y - pt);
|
||||
ebits_resize(ic->obj.sel.under.icon,
|
||||
ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb);
|
||||
ebits_show(ic->obj.sel.under.icon);
|
||||
}
|
||||
if (ic->obj.sel.under.text)
|
||||
{
|
||||
int pl, pr, pt, pb;
|
||||
|
||||
ebits_get_insets(ic->obj.sel.under.text, &pl, &pr, &pt, &pb);
|
||||
ebits_move(ic->obj.sel.under.text,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2) - pl,
|
||||
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g - pt);
|
||||
ebits_resize(ic->obj.sel.under.text,
|
||||
ic->geom.text.w + pl + pr, ic->geom.text.h + pt + pb);
|
||||
ebits_show(ic->obj.sel.under.text);
|
||||
}
|
||||
if (ic->obj.sel.over.icon)
|
||||
{
|
||||
int pl, pr, pt, pb;
|
||||
|
||||
ebits_get_insets(ic->obj.sel.over.icon, &pl, &pr, &pt, &pb);
|
||||
ebits_move(ic->obj.sel.over.icon,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2) - pl,
|
||||
ic->view->scroll.y + ic->geom.y - pt);
|
||||
ebits_resize(ic->obj.sel.over.icon,
|
||||
ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb);
|
||||
ebits_show(ic->obj.sel.over.icon);
|
||||
}
|
||||
if (ic->obj.sel.over.text)
|
||||
{
|
||||
int pl, pr, pt, pb;
|
||||
|
||||
ebits_get_insets(ic->obj.sel.over.text, &pl, &pr, &pt, &pb);
|
||||
ebits_move(ic->obj.sel.over.text,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2) - pl,
|
||||
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g - pt);
|
||||
ebits_resize(ic->obj.sel.over.text,
|
||||
ic->geom.text.w + pl + pr, ic->geom.text.h + pt + pb);
|
||||
ebits_show(ic->obj.sel.over.text);
|
||||
}
|
||||
if ((ic->geom.x != ic->prev_geom.x) || (ic->geom.y != ic->prev_geom.y))
|
||||
{
|
||||
ic->q.write_xy = 1;
|
||||
e_view_queue_icon_xy_record(ic->view);
|
||||
}
|
||||
if (ic->geom.x != ic->prev_geom.x) ic->view->extents.valid = 0;
|
||||
else if (ic->geom.y != ic->prev_geom.y) ic->view->extents.valid = 0;
|
||||
else if (ic->geom.w != ic->prev_geom.w) ic->view->extents.valid = 0;
|
||||
else if (ic->geom.h != ic->prev_geom.h) ic->view->extents.valid = 0;
|
||||
|
||||
ic->prev_geom = ic->geom;
|
||||
ic->prev_geom.x = ic->geom.x;
|
||||
ic->prev_geom.y = ic->geom.y;
|
||||
ic->prev_geom.w = ic->geom.w;
|
||||
ic->prev_geom.h = ic->geom.h;
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
e_icon_check_permissions(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if (!ic || !ic->info.mime.base || ic->stat.st_ino == 0)
|
||||
D_RETURN;
|
||||
|
||||
if (!strcmp(ic->info.mime.base, "dir"))
|
||||
{
|
||||
if (e_file_can_exec(&ic->stat))
|
||||
evas_set_color(ic->view->evas, ic->obj.icon, 255, 255, 255, 255);
|
||||
else
|
||||
evas_set_color(ic->view->evas, ic->obj.icon, 128, 128, 128, 128);
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
e_icon_initial_show(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
/* check if we have enuf info and we havent been shown yet */
|
||||
if (!ic->info.icon) D_RETURN;
|
||||
if (ic->state.visible) D_RETURN;
|
||||
|
||||
/* first. lets figure out the size of the icon */
|
||||
evas_get_image_size(ic->view->evas, ic->obj.icon,
|
||||
&(ic->geom.icon.w), &(ic->geom.icon.h));
|
||||
{
|
||||
double tw, th;
|
||||
|
||||
e_text_get_geometry(ic->obj.text, NULL, NULL, &tw, &th);
|
||||
ic->geom.text.w = (int)tw;
|
||||
ic->geom.text.h = (int)th;
|
||||
}
|
||||
|
||||
/* now lets allocate space for it if we need to */
|
||||
ic->geom.x = 999999;
|
||||
ic->geom.y = 999999;
|
||||
|
||||
/* if needed queue a tiemout for a resort */
|
||||
e_view_queue_resort(ic->view);
|
||||
|
||||
/* actually show the icon */
|
||||
e_icon_apply_xy(ic);
|
||||
e_icon_show(ic);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_set_mime(E_Icon *ic, char *base, char *mime)
|
||||
{
|
||||
int diff = 0;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (!ic->info.mime.base) diff = 1;
|
||||
if (!ic->info.mime.type) diff = 1;
|
||||
if ((ic->info.mime.base) && (strcmp(ic->info.mime.base, base))) diff = 1;
|
||||
if ((ic->info.mime.type) && (strcmp(ic->info.mime.base, mime))) diff = 1;
|
||||
if (!diff) D_RETURN;
|
||||
if (ic->info.mime.base) free(ic->info.mime.base);
|
||||
if (ic->info.mime.type) free(ic->info.mime.type);
|
||||
ic->info.mime.base = NULL;
|
||||
ic->info.mime.type = NULL;
|
||||
ic->info.mime.base = strdup(base);
|
||||
ic->info.mime.type = strdup(mime);
|
||||
|
||||
D("%40s: %s/%s\n", ic->file, base, mime);
|
||||
|
||||
/* effect changes here */
|
||||
if (ic->info.custom_icon)
|
||||
{
|
||||
if (ic->info.icon) free(ic->info.icon);
|
||||
ic->info.icon = NULL;
|
||||
ic->info.icon = strdup(ic->info.custom_icon);
|
||||
evas_set_image_file(ic->view->evas, ic->obj.icon, ic->info.custom_icon);
|
||||
e_view_queue_resort(ic->view);
|
||||
D_RETURN;
|
||||
}
|
||||
/* find an icon */
|
||||
{
|
||||
char icon[PATH_MAX];
|
||||
char type[PATH_MAX];
|
||||
char *p;
|
||||
int done = 0;
|
||||
|
||||
strcpy(type, ic->info.mime.type);
|
||||
for (p = type; *p; p++)
|
||||
{
|
||||
if (*p == '/') *p = '-';
|
||||
}
|
||||
do
|
||||
{
|
||||
sprintf(icon, "%s/data/icons/%s/%s.db", PACKAGE_DATA_DIR,
|
||||
ic->info.mime.base, type);
|
||||
if (e_file_exists(icon))
|
||||
{
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
p = strrchr(type, '-');
|
||||
if (p) *p = 0;
|
||||
}
|
||||
while (p);
|
||||
if (!done)
|
||||
{
|
||||
if (!e_file_exists(icon))
|
||||
{
|
||||
sprintf(icon, "%s/data/icons/%s/default.db", PACKAGE_DATA_DIR,
|
||||
ic->info.mime.base);
|
||||
if (!e_file_exists(icon))
|
||||
sprintf(icon, "%s/data/icons/unknown/default.db", PACKAGE_DATA_DIR);
|
||||
}
|
||||
}
|
||||
ic->info.icon = strdup(icon);
|
||||
}
|
||||
|
||||
e_icon_update_state(ic);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_set_link(E_Icon *ic, char *link)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if ((!link) && (ic->info.link))
|
||||
{
|
||||
free(ic->info.link);
|
||||
ic->info.link = NULL;
|
||||
/* effect changes here */
|
||||
}
|
||||
else if (link)
|
||||
{
|
||||
if ((ic->info.link) && (!strcmp(ic->info.link, link)))
|
||||
{
|
||||
free(ic->info.link);
|
||||
ic->info.link = strdup(link);
|
||||
/* effect changes here */
|
||||
}
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
e_icon_update_state(E_Icon *ic)
|
||||
{
|
||||
char icon[PATH_MAX];
|
||||
int iw, ih;
|
||||
int gw, gh;
|
||||
|
||||
D_ENTER;
|
||||
|
||||
if (!ic->info.icon)
|
||||
{
|
||||
D("EEEEEEEEEEK %s has no icon\n", ic->file);
|
||||
D_RETURN;
|
||||
}
|
||||
if (ic->state.clicked)
|
||||
{
|
||||
sprintf(icon, "%s:/icon/clicked", ic->info.icon);
|
||||
}
|
||||
else if (ic->state.selected)
|
||||
{
|
||||
sprintf(icon, "%s:/icon/selected", ic->info.icon);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(icon, "%s:/icon/normal", ic->info.icon);
|
||||
}
|
||||
if ((ic->state.selected) &&
|
||||
(!ic->obj.sel.under.icon) &&
|
||||
(!ic->obj.sel.over.icon))
|
||||
{
|
||||
char file[PATH_MAX];
|
||||
|
||||
/*
|
||||
sprintf(file, "%s/file.bits.db", e_config_get("selections"));
|
||||
ic->obj.sel.over.icon = ebits_load(file);
|
||||
sprintf(file, "%s/text.bits.db", e_config_get("selections"));
|
||||
ic->obj.sel.over.text = ebits_load(file);
|
||||
*/
|
||||
sprintf(file, "%s/file.bits.db", e_config_get("selections"));
|
||||
ic->obj.sel.under.icon = ebits_load(file);
|
||||
sprintf(file, "%s/text.bits.db", e_config_get("selections"));
|
||||
ic->obj.sel.under.text = ebits_load(file);
|
||||
if (ic->obj.sel.under.icon)
|
||||
{
|
||||
ebits_add_to_evas(ic->obj.sel.under.icon, ic->view->evas);
|
||||
ebits_set_layer(ic->obj.sel.under.icon, 195);
|
||||
}
|
||||
if (ic->obj.sel.under.text)
|
||||
{
|
||||
ebits_add_to_evas(ic->obj.sel.under.text, ic->view->evas);
|
||||
ebits_set_layer(ic->obj.sel.under.text, 195);
|
||||
}
|
||||
if (ic->obj.sel.over.icon)
|
||||
{
|
||||
ebits_add_to_evas(ic->obj.sel.over.icon, ic->view->evas);
|
||||
ebits_set_layer(ic->obj.sel.over.icon, 205);
|
||||
}
|
||||
if (ic->obj.sel.over.text)
|
||||
{
|
||||
ebits_add_to_evas(ic->obj.sel.over.text, ic->view->evas);
|
||||
ebits_set_layer(ic->obj.sel.over.text, 205);
|
||||
}
|
||||
}
|
||||
else if ((!ic->state.selected) &&
|
||||
((ic->obj.sel.under.icon) ||
|
||||
(ic->obj.sel.over.icon)))
|
||||
{
|
||||
if (ic->obj.sel.under.icon) ebits_free(ic->obj.sel.under.icon);
|
||||
if (ic->obj.sel.under.text) ebits_free(ic->obj.sel.under.text);
|
||||
if (ic->obj.sel.over.icon) ebits_free(ic->obj.sel.over.icon);
|
||||
if (ic->obj.sel.over.text) ebits_free(ic->obj.sel.over.text);
|
||||
ic->obj.sel.under.icon = NULL;
|
||||
ic->obj.sel.under.text = NULL;
|
||||
ic->obj.sel.over.icon = NULL;
|
||||
ic->obj.sel.over.text = NULL;
|
||||
}
|
||||
evas_set_image_file(ic->view->evas, ic->obj.icon, icon);
|
||||
evas_get_image_size(ic->view->evas, ic->obj.icon, &iw, &ih);
|
||||
gw = ic->geom.icon.w;
|
||||
gh = ic->geom.icon.h;
|
||||
e_icon_apply_xy(ic);
|
||||
if ((iw == gw) && (ih == gh)) D_RETURN;
|
||||
e_view_queue_resort(ic->view);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
e_icon_invert_selection(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if (ic->state.selected) e_icon_deselect(ic);
|
||||
else e_icon_select(ic);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_select(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if (!ic->state.selected)
|
||||
{
|
||||
ic->state.selected = 1;
|
||||
ic->view->sel_count++;
|
||||
e_icon_update_state(ic);
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_deselect(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if (ic->state.selected)
|
||||
{
|
||||
ic->state.selected = 0;
|
||||
ic->view->sel_count--;
|
||||
e_icon_update_state(ic);
|
||||
}
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
||||
void
|
||||
e_icon_exec(E_Icon *ic)
|
||||
{
|
||||
D_ENTER;
|
||||
|
||||
if (!strcmp(ic->info.mime.base, "dir") &&
|
||||
e_file_can_exec(&ic->stat))
|
||||
{
|
||||
E_View *v;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
v = e_view_new();
|
||||
v->size.w = 400;
|
||||
v->size.h = 300;
|
||||
v->options.back_pixmap = 0;
|
||||
/* Load default bg then handle bg in metadata */
|
||||
sprintf(buf, "%s/%s/.e_background.bg.db", ic->view->dir, ic->file);
|
||||
v->bg = e_background_load(buf);
|
||||
if (!v->bg)
|
||||
{
|
||||
sprintf(buf, "%s/view.bg.db", e_config_get("backgrounds"));
|
||||
v->bg = e_background_load(buf);
|
||||
}
|
||||
sprintf(buf, "%s/%s", ic->view->dir, ic->file);
|
||||
D("new dir >%s<\n", buf);
|
||||
v->dir = strdup(buf);
|
||||
e_view_realize(v);
|
||||
ecore_window_set_title(v->win.base, ic->file);
|
||||
ecore_window_set_name_class(v->win.base, "FileView", "E");
|
||||
ecore_window_set_min_size(v->win.base, 8, 8);
|
||||
}
|
||||
|
||||
e_icon_deselect(ic);
|
||||
|
||||
D_RETURN;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
#ifndef E_ICONS_H
|
||||
#define E_ICONS_H
|
||||
|
||||
#include "view.h"
|
||||
#include "text.h"
|
||||
|
||||
#ifndef E_ICON_TYPEDEF
|
||||
#define E_ICON_TYPEDEF
|
||||
typedef struct _E_Icon E_Icon;
|
||||
#endif
|
||||
|
||||
#ifndef E_VIEW_TYPEDEF
|
||||
#define E_VIEW_TYPEDEF
|
||||
typedef struct _E_View E_View;
|
||||
#endif
|
||||
|
||||
struct _E_Icon
|
||||
{
|
||||
E_Object o;
|
||||
|
||||
char *file;
|
||||
struct stat stat;
|
||||
|
||||
E_View *view;
|
||||
|
||||
struct {
|
||||
char *icon;
|
||||
char *custom_icon;
|
||||
char *link;
|
||||
struct {
|
||||
char *base;
|
||||
char *type;
|
||||
} mime;
|
||||
} info;
|
||||
|
||||
struct {
|
||||
Evas_Object icon;
|
||||
Evas_Object event1;
|
||||
Evas_Object event2;
|
||||
E_Text *text;
|
||||
struct {
|
||||
struct {
|
||||
Ebits_Object icon;
|
||||
Ebits_Object text;
|
||||
} over, under;
|
||||
} sel;
|
||||
} obj;
|
||||
|
||||
struct {
|
||||
int hilited;
|
||||
int clicked;
|
||||
int selected;
|
||||
int running;
|
||||
int disabled;
|
||||
int visible;
|
||||
int just_selected;
|
||||
int just_executed;
|
||||
} state;
|
||||
|
||||
struct {
|
||||
int x, y, w, h;
|
||||
struct {
|
||||
int w, h;
|
||||
} icon;
|
||||
struct {
|
||||
int w, h;
|
||||
} text;
|
||||
} geom, prev_geom;
|
||||
|
||||
struct {
|
||||
int write_xy;
|
||||
} q;
|
||||
|
||||
int changed;
|
||||
};
|
||||
|
||||
|
||||
E_Icon *e_icon_new(void);
|
||||
void e_icon_update_state(E_Icon *ic);
|
||||
void e_icon_invert_selection(E_Icon *ic);
|
||||
void e_icon_select(E_Icon *ic);
|
||||
void e_icon_deselect(E_Icon *ic);
|
||||
|
||||
/**
|
||||
* e_icon_exec - handles execution paths when user activates an icon
|
||||
* @ic: The activated icon
|
||||
*
|
||||
* This function takes care of opening views when the user activates a
|
||||
* directory, launching commands when an executable is activated etc.
|
||||
*/
|
||||
void e_icon_exec(E_Icon *ic);
|
||||
|
||||
void e_icon_initial_show(E_Icon *ic);
|
||||
void e_icon_set_mime(E_Icon *ic, char *base, char *mime);
|
||||
void e_icon_set_link(E_Icon *ic, char *link);
|
||||
E_Icon *e_icon_find_by_file(E_View *view, char *file);
|
||||
void e_icon_show(E_Icon *ic);
|
||||
void e_icon_hide(E_Icon *ic);
|
||||
void e_icon_apply_xy(E_Icon *ic);
|
||||
void e_icon_check_permissions(E_Icon *ic);
|
||||
|
||||
#endif
|
|
@ -14,6 +14,7 @@
|
|||
#include "view.h"
|
||||
#include "place.h"
|
||||
#include "iconbar.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef USE_FERITE
|
||||
# include "e_ferite.h"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "debug.h"
|
||||
#include "menu.h"
|
||||
#include "config.h"
|
||||
#include "util.h"
|
||||
|
||||
static Evas_List open_menus = NULL; /* List of all open menus */
|
||||
static Evas_List menus = NULL;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "place.h"
|
||||
#include "actions.h"
|
||||
#include "guides.h"
|
||||
#include "util.h"
|
||||
|
||||
static void e_mouse_down(Ecore_Event * ev);
|
||||
static void e_mouse_up(Ecore_Event * ev);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "resist.h"
|
||||
#include "config.h"
|
||||
#include "desktops.h"
|
||||
#include "util.h"
|
||||
|
||||
void
|
||||
e_resist_border(E_Border *b)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "debug.h"
|
||||
#include "scrollbar.h"
|
||||
#include "config.h"
|
||||
#include "util.h"
|
||||
|
||||
static void e_scrollbar_recalc(E_Scrollbar *sb);
|
||||
static void e_scrollbar_setup_bits(E_Scrollbar *sb);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "debug.h"
|
||||
#include "text.h"
|
||||
#include "util.h"
|
||||
|
||||
E_Text *
|
||||
e_text_new(Evas evas, char *text, char *class)
|
||||
|
|
10
src/util.h
10
src/util.h
|
@ -16,4 +16,14 @@ __dest = malloc(strlen(__var) + 1); \
|
|||
if (__dest) strcpy(__dest, __var); \
|
||||
} }
|
||||
|
||||
/* misc util macros */
|
||||
#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
|
||||
(((x) < ((xx) + (ww))) && \
|
||||
((y) < ((yy) + (hh))) && \
|
||||
(((x) + (w)) > (xx)) && \
|
||||
(((y) + (h)) > (yy)))
|
||||
#define SPANS_COMMON(x1, w1, x2, w2) \
|
||||
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
|
||||
#define UN(_blah) _blah = 0
|
||||
|
||||
#endif
|
||||
|
|
910
src/view.c
910
src/view.c
File diff suppressed because it is too large
Load Diff
95
src/view.h
95
src/view.h
|
@ -5,16 +5,19 @@
|
|||
#include "background.h"
|
||||
#include "scrollbar.h"
|
||||
#include "fs.h"
|
||||
#include "text.h"
|
||||
#include "iconbar.h"
|
||||
#include "object.h"
|
||||
#include "icons.h"
|
||||
|
||||
#ifndef E_VIEW_TYPEDEF
|
||||
#define E_VIEW_TYPEDEF
|
||||
typedef struct _E_View E_View;
|
||||
typedef struct _E_View E_View;
|
||||
#endif
|
||||
|
||||
typedef struct _E_Icon E_Icon;
|
||||
#ifndef E_ICON_TYPEDEF
|
||||
#define E_ICON_TYPEDEF
|
||||
typedef struct _E_Icon E_Icon;
|
||||
#endif
|
||||
|
||||
#ifndef E_ICONBAR_TYPEDEF
|
||||
#define E_ICONBAR_TYPEDEF
|
||||
|
@ -22,7 +25,6 @@ typedef struct _E_Iconbar E_Iconbar;
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
struct _E_View
|
||||
{
|
||||
E_Object o;
|
||||
|
@ -145,66 +147,6 @@ struct _E_View
|
|||
};
|
||||
|
||||
|
||||
struct _E_Icon
|
||||
{
|
||||
E_Object o;
|
||||
|
||||
char *file;
|
||||
struct stat stat;
|
||||
|
||||
E_View *view;
|
||||
|
||||
struct {
|
||||
char *icon;
|
||||
char *custom_icon;
|
||||
char *link;
|
||||
struct {
|
||||
char *base;
|
||||
char *type;
|
||||
} mime;
|
||||
} info;
|
||||
|
||||
struct {
|
||||
Evas_Object icon;
|
||||
Evas_Object event1;
|
||||
Evas_Object event2;
|
||||
E_Text *text;
|
||||
struct {
|
||||
struct {
|
||||
Ebits_Object icon;
|
||||
Ebits_Object text;
|
||||
} over, under;
|
||||
} sel;
|
||||
} obj;
|
||||
|
||||
struct {
|
||||
int hilited;
|
||||
int clicked;
|
||||
int selected;
|
||||
int running;
|
||||
int disabled;
|
||||
int visible;
|
||||
int just_selected;
|
||||
int just_executed;
|
||||
} state;
|
||||
|
||||
struct {
|
||||
int x, y, w, h;
|
||||
struct {
|
||||
int w, h;
|
||||
} icon;
|
||||
struct {
|
||||
int w, h;
|
||||
} text;
|
||||
} geom, prev_geom;
|
||||
|
||||
struct {
|
||||
int write_xy;
|
||||
} q;
|
||||
|
||||
int changed;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* e_view_init - View event handlers initialization.
|
||||
|
@ -227,34 +169,13 @@ void e_view_scroll_by(E_View *v, int sx, int sy);
|
|||
void e_view_scroll_to_percent(E_View *v, double psx, double psy);
|
||||
void e_view_get_viewable_percentage(E_View *v, double *vw, double *vh);
|
||||
void e_view_get_position_percentage(E_View *v, double *vx, double *vy);
|
||||
void e_view_icon_update_state(E_Icon *ic);
|
||||
void e_view_icon_invert_selection(E_Icon *ic);
|
||||
void e_view_icon_select(E_Icon *ic);
|
||||
void e_view_icon_deselect(E_Icon *ic);
|
||||
|
||||
/**
|
||||
* e_view_icon_exec - handles execution paths when user activates an icon
|
||||
* @ic: The activated icon
|
||||
*
|
||||
* This function takes care of opening views when the user activates a
|
||||
* directory, launching commands when an executable is activated etc.
|
||||
*/
|
||||
void e_view_icon_exec(E_Icon *ic);
|
||||
|
||||
void e_view_icon_initial_show(E_Icon *ic);
|
||||
void e_view_icon_set_mime(E_Icon *ic, char *base, char *mime);
|
||||
void e_view_icon_set_link(E_Icon *ic, char *link);
|
||||
E_Icon *e_view_icon_new(void);
|
||||
E_Icon *e_view_find_icon_by_file(E_View *view, char *file);
|
||||
void e_view_icon_show(E_Icon *ic);
|
||||
void e_view_icon_hide(E_Icon *ic);
|
||||
void e_view_icon_apply_xy(E_Icon *ic);
|
||||
void e_view_icon_check_permissions(E_Icon *ic);
|
||||
void e_view_resort_alphabetical(E_View *v);
|
||||
void e_view_arrange(E_View *v);
|
||||
void e_view_resort(E_View *v);
|
||||
void e_view_queue_geometry_record(E_View *v);
|
||||
void e_view_geometry_record(E_View *v);
|
||||
void e_view_queue_geometry_record(E_View *v);
|
||||
void e_view_queue_icon_xy_record(E_View *v);
|
||||
void e_view_queue_resort(E_View *v);
|
||||
void e_view_file_added(int id, char *file);
|
||||
void e_view_file_deleted(int id, char *file);
|
||||
|
|
Loading…
Reference in New Issue