summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcpk <cpk>2001-11-03 14:55:21 +0000
committercpk <cpk@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2001-11-03 14:55:21 +0000
commita708bdfd42c9db3965a2d0c36ca3902ba540baa2 (patch)
treefb173777ecf16e0eaee14bc8a7a0a398a6ac46b9
parent59b09b81219aa85feb4e49fdc1944b792a0d777c (diff)
* 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
-rw-r--r--AUTHORS2
-rw-r--r--data/config/behavior/default/actions.dbbin86016 -> 114688 bytes
-rw-r--r--data/config/behavior/default/grabs.dbbin12288 -> 12288 bytes
-rw-r--r--data/config/behavior/default/settings.dbbin12288 -> 12288 bytes
-rwxr-xr-xdata/scripts/build_db.sh16
-rw-r--r--doc/manual.raw1
-rw-r--r--src/Makefile.am3
-rw-r--r--src/actions.c34
-rw-r--r--src/actions.h1
-rw-r--r--src/config.c21
-rw-r--r--src/e.h11
-rw-r--r--src/embed.c1
-rw-r--r--src/file.c1
-rw-r--r--src/file.h2
-rw-r--r--src/fs.c1
-rw-r--r--src/fs.h1
-rw-r--r--src/globals.c7
-rw-r--r--src/globals.h8
-rw-r--r--src/guides.h2
-rw-r--r--src/icons.c891
-rw-r--r--src/icons.h102
-rw-r--r--src/main.c1
-rw-r--r--src/menu.c1
-rw-r--r--src/place.c1
-rw-r--r--src/resist.c1
-rw-r--r--src/scrollbar.c1
-rw-r--r--src/text.c1
-rw-r--r--src/util.h10
-rw-r--r--src/view.c910
-rw-r--r--src/view.h95
30 files changed, 1121 insertions, 1005 deletions
diff --git a/AUTHORS b/AUTHORS
index 2b3a239aa..b54297b7c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,5 @@
1The Rasterman <raster@rasterman.com> 1The Rasterman <raster@rasterman.com>
2Christian Kreibich <cK@whoop.org> 2Christian Kreibich <cK@whoop.org>
3Burra <burra@colorado.edu> 3Burra <burra@colorado.edu>
4Graham MacDonald <macdonag@lineone.net>
5Alan Schmitt <alan.schmitt@inria.fr>
diff --git a/data/config/behavior/default/actions.db b/data/config/behavior/default/actions.db
index 6ae38d604..851edc4cc 100644
--- a/data/config/behavior/default/actions.db
+++ b/data/config/behavior/default/actions.db
Binary files differ
diff --git a/data/config/behavior/default/grabs.db b/data/config/behavior/default/grabs.db
index dbae82edb..c2f40453c 100644
--- a/data/config/behavior/default/grabs.db
+++ b/data/config/behavior/default/grabs.db
Binary files differ
diff --git a/data/config/behavior/default/settings.db b/data/config/behavior/default/settings.db
index 1e9051d6f..efbfb7aaf 100644
--- a/data/config/behavior/default/settings.db
+++ b/data/config/behavior/default/settings.db
Binary files differ
diff --git a/data/scripts/build_db.sh b/data/scripts/build_db.sh
index 79648b6fc..54106fb07 100755
--- a/data/scripts/build_db.sh
+++ b/data/scripts/build_db.sh
@@ -305,6 +305,22 @@ edb_ed $DB add "/actions/"$NUM"/button" int 0
305edb_ed $DB add "/actions/"$NUM"/key" str "F8" 305edb_ed $DB add "/actions/"$NUM"/key" str "F8"
306edb_ed $DB add "/actions/"$NUM"/modifiers" int $MOD_ALT 306edb_ed $DB add "/actions/"$NUM"/modifiers" int $MOD_ALT
307NUM=$[ $NUM + 1 ]; 307NUM=$[ $NUM + 1 ];
308edb_ed $DB add "/actions/"$NUM"/name" str Key_Binding
309edb_ed $DB add "/actions/"$NUM"/action" str Desktop_Relative
310edb_ed $DB add "/actions/"$NUM"/params" str 1
311edb_ed $DB add "/actions/"$NUM"/event" int 8
312edb_ed $DB add "/actions/"$NUM"/button" int 0
313edb_ed $DB add "/actions/"$NUM"/key" str Right
314edb_ed $DB add "/actions/"$NUM"/modifiers" int 6
315NUM=$[ $NUM + 1 ];
316edb_ed $DB add "/actions/"$NUM"/name" str Key_Binding
317edb_ed $DB add "/actions/"$NUM"/action" str Desktop_Relative
318edb_ed $DB add "/actions/"$NUM"/params" str -1
319edb_ed $DB add "/actions/"$NUM"/event" int 8
320edb_ed $DB add "/actions/"$NUM"/button" int 0
321edb_ed $DB add "/actions/"$NUM"/key" str Left
322edb_ed $DB add "/actions/"$NUM"/modifiers" int 6
323NUM=$[ $NUM + 1 ];
308edb_ed $DB add "/actions/count" int $NUM 324edb_ed $DB add "/actions/count" int $NUM
309 325
310# basic settings 326# basic settings
diff --git a/doc/manual.raw b/doc/manual.raw
index c6dd0fff8..5d3724b6f 100644
--- a/doc/manual.raw
+++ b/doc/manual.raw
@@ -131,6 +131,7 @@
131!Isrc/fs.h 131!Isrc/fs.h
132!Isrc/guides.h 132!Isrc/guides.h
133!Isrc/iconbar.c 133!Isrc/iconbar.c
134!Isrc/icons.h
134!Isrc/menu.h 135!Isrc/menu.h
135!Isrc/menu.c 136!Isrc/menu.c
136!Isrc/object.h 137!Isrc/object.h
diff --git a/src/Makefile.am b/src/Makefile.am
index d6c2d96aa..089b8db8d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,9 +39,10 @@ enlightenment_SOURCES = \
39 fs.h fs.c \ 39 fs.h fs.c \
40 $(ferite_c) \ 40 $(ferite_c) \
41 guides.h guides.c \ 41 guides.h guides.c \
42 globals.h globals.c \
42 icccm.h icccm.c \ 43 icccm.h icccm.c \
43 iconbar.h iconbar.c\ 44 iconbar.h iconbar.c\
44 icons.c \ 45 icons.h icons.c\
45 ipc.h ipc.c \ 46 ipc.h ipc.c \
46 keys.h keys.c \ 47 keys.h keys.c \
47 main.c \ 48 main.c \
diff --git a/src/actions.c b/src/actions.c
index 0af1d64f7..1eb72d8dc 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -108,6 +108,10 @@ static void e_act_desk_start (E_Object *object, E_Action *a, void *data,
108static void e_act_raise_next_start (E_Object *object, E_Action *a, void *data, 108static void e_act_raise_next_start (E_Object *object, E_Action *a, void *data,
109 int x, int y, int rx, int ry); 109 int x, int y, int rx, int ry);
110 110
111static void e_act_desk_rel_start (E_Object *object, E_Action *a, void *data,
112 int x, int y, int rx, int ry);
113
114
111static void 115static void
112e_action_find(char *action, E_Action_Type act, int button, 116e_action_find(char *action, E_Action_Type act, int button,
113 char *key, Ecore_Event_Key_Modifiers mods, E_Object *object) 117 char *key, Ecore_Event_Key_Modifiers mods, E_Object *object)
@@ -622,6 +626,7 @@ e_action_init(void)
622 e_action_add_impl("Winodw_Snap", e_act_snap_start, NULL, NULL); 626 e_action_add_impl("Winodw_Snap", e_act_snap_start, NULL, NULL);
623 e_action_add_impl("Window_Zoom", e_act_zoom_start, NULL, NULL); 627 e_action_add_impl("Window_Zoom", e_act_zoom_start, NULL, NULL);
624 e_action_add_impl("Desktop", e_act_desk_start, NULL, NULL); 628 e_action_add_impl("Desktop", e_act_desk_start, NULL, NULL);
629 e_action_add_impl("Desktop_Relative", e_act_desk_rel_start, NULL, NULL);
625 e_action_add_impl("Window_Next", e_act_raise_next_start, NULL, NULL); 630 e_action_add_impl("Window_Next", e_act_raise_next_start, NULL, NULL);
626 631
627 D_RETURN; 632 D_RETURN;
@@ -1737,6 +1742,35 @@ e_act_desk_start (E_Object *object, E_Action *a, void *data, int x, int y, int r
1737} 1742}
1738 1743
1739 1744
1745static void
1746e_act_desk_rel_start (E_Object *object, E_Action *a, void *data, int x, int y, int rx, int ry)
1747{
1748 int desk = 0;
1749 int desk_max = e_desktops_get_num () - 1;
1750
1751 D_ENTER;
1752
1753 if (a->params)
1754 desk = atoi(a->params) + e_desktops_get_current();
1755
1756 if (desk < 0)
1757 desk = desk_max;
1758 else if (desk > desk_max)
1759 desk = 0;
1760
1761 e_desktops_goto_desk(desk);
1762
1763 D_RETURN;
1764 UN(object);
1765 UN(a);
1766 UN(data);
1767 UN(x);
1768 UN(y);
1769 UN(rx);
1770 UN(ry);
1771}
1772
1773
1740static void 1774static void
1741e_act_raise_next_start (E_Object *object, E_Action *a, void *data, int x, int y, int rx, int ry) 1775e_act_raise_next_start (E_Object *object, E_Action *a, void *data, int x, int y, int rx, int ry)
1742{ 1776{
diff --git a/src/actions.h b/src/actions.h
index f8ee9671c..29a25db97 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -1,7 +1,6 @@
1#ifndef E_ACTIONS_H 1#ifndef E_ACTIONS_H
2#define E_ACTIONS_H 2#define E_ACTIONS_H
3 3
4#include "e.h"
5#include "object.h" 4#include "object.h"
6 5
7typedef struct _E_Action E_Action; 6typedef struct _E_Action E_Action;
diff --git a/src/config.c b/src/config.c
index 7aaf5e211..c6bc8aeab 100644
--- a/src/config.c
+++ b/src/config.c
@@ -5,16 +5,6 @@
5 5
6static char cfg_root[] = ""; 6static char cfg_root[] = "";
7 7
8#define E_CONF(_key, _var, _args...) \
9{ \
10 if (!strcmp(type, _key)) \
11 { \
12 if ((_var)[0]) D_RETURN_(_var); \
13 sprintf((_var), ## _args); \
14 D_RETURN_(_var); \
15 } \
16}
17
18static char cfg_grabs_db[PATH_MAX] = ""; 8static char cfg_grabs_db[PATH_MAX] = "";
19static char cfg_settings_db[PATH_MAX] = ""; 9static char cfg_settings_db[PATH_MAX] = "";
20static char cfg_actions_db[PATH_MAX] = ""; 10static char cfg_actions_db[PATH_MAX] = "";
@@ -51,6 +41,17 @@ e_config_get(char *type)
51 /* "%sbehavior/default/grabs.db", e_config_user_dir()); */ 41 /* "%sbehavior/default/grabs.db", e_config_user_dir()); */
52 /* notice it would use the user config location instead */ 42 /* notice it would use the user config location instead */
53 /* but for now i'm keeping it as is for development "ease" */ 43 /* but for now i'm keeping it as is for development "ease" */
44
45#define E_CONF(_key, _var, _args...) \
46{ \
47 if (!strcmp(type, _key)) \
48 { \
49 if ((_var)[0]) D_RETURN_(_var); \
50 sprintf((_var), ## _args); \
51 D_RETURN_(_var); \
52 } \
53}
54
54 E_CONF("grabs", cfg_grabs_db, 55 E_CONF("grabs", cfg_grabs_db,
55 "%s/behavior/grabs.db", e_config_user_dir()); 56 "%s/behavior/grabs.db", e_config_user_dir());
56 E_CONF("settings", cfg_settings_db, 57 E_CONF("settings", cfg_settings_db,
diff --git a/src/e.h b/src/e.h
index 8630a9274..dfd816d5f 100644
--- a/src/e.h
+++ b/src/e.h
@@ -97,15 +97,4 @@ printf("%3.3f : %s()\n", __p->total, __p->func); \
97#define E_PROF_DUMP 97#define E_PROF_DUMP
98#endif 98#endif
99 99
100
101/* misc util macros */
102#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
103(((x) < ((xx) + (ww))) && \
104((y) < ((yy) + (hh))) && \
105(((x) + (w)) > (xx)) && \
106(((y) + (h)) > (yy)))
107#define SPANS_COMMON(x1, w1, x2, w2) \
108(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
109#define UN(_blah) _blah = 0
110
111#endif 100#endif
diff --git a/src/embed.c b/src/embed.c
index 7ae6dfd64..9dc97a971 100644
--- a/src/embed.c
+++ b/src/embed.c
@@ -1,5 +1,6 @@
1#include "debug.h" 1#include "debug.h"
2#include "embed.h" 2#include "embed.h"
3#include "util.h"
3 4
4typedef struct _Embed Embed_Private; 5typedef struct _Embed Embed_Private;
5 6
diff --git a/src/file.c b/src/file.c
index 1ce3e8063..7d1bb3651 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1,3 +1,4 @@
1#include "e.h"
1#include "debug.h" 2#include "debug.h"
2#include "file.h" 3#include "file.h"
3#include "util.h" 4#include "util.h"
diff --git a/src/file.h b/src/file.h
index 0fb3f4886..4bb4c141a 100644
--- a/src/file.h
+++ b/src/file.h
@@ -1,8 +1,6 @@
1#ifndef E_FILE_H 1#ifndef E_FILE_H
2#define E_FILE_H 2#define E_FILE_H
3 3
4#include "e.h"
5
6time_t e_file_mod_time(char *file); 4time_t e_file_mod_time(char *file);
7int e_file_exists(char *file); 5int e_file_exists(char *file);
8int e_file_is_dir(char *file); 6int e_file_is_dir(char *file);
diff --git a/src/fs.c b/src/fs.c
index d31e06903..c5c8ac168 100644
--- a/src/fs.c
+++ b/src/fs.c
@@ -1,6 +1,7 @@
1#include "debug.h" 1#include "debug.h"
2#include "fs.h" 2#include "fs.h"
3#include "exec.h" 3#include "exec.h"
4#include "util.h"
4 5
5static EfsdConnection *ec = NULL; 6static EfsdConnection *ec = NULL;
6static Evas_List fs_handlers = NULL; 7static Evas_List fs_handlers = NULL;
diff --git a/src/fs.h b/src/fs.h
index 31f248b34..d56f94a8e 100644
--- a/src/fs.h
+++ b/src/fs.h
@@ -2,7 +2,6 @@
2#define E_FS_H 2#define E_FS_H
3 3
4#include <libefsd.h> 4#include <libefsd.h>
5#include "e.h"
6 5
7typedef struct _E_FS_Restarter E_FS_Restarter; 6typedef struct _E_FS_Restarter E_FS_Restarter;
8 7
diff --git a/src/globals.c b/src/globals.c
new file mode 100644
index 000000000..3061d0b19
--- /dev/null
+++ b/src/globals.c
@@ -0,0 +1,7 @@
1#include <Evas.h>
2#include <Ecore.h>
3
4
5Ecore_Event_Key_Modifiers mulit_select_mod = ECORE_EVENT_KEY_MODIFIER_SHIFT;
6Ecore_Event_Key_Modifiers range_select_mod = ECORE_EVENT_KEY_MODIFIER_CTRL;
7Evas_List views = NULL;
diff --git a/src/globals.h b/src/globals.h
new file mode 100644
index 000000000..53aaad953
--- /dev/null
+++ b/src/globals.h
@@ -0,0 +1,8 @@
1#ifndef E_GLOBALS_H
2#define E_GLOBALS_H
3
4extern Ecore_Event_Key_Modifiers mulit_select_mod;
5extern Ecore_Event_Key_Modifiers range_select_mod;
6extern Evas_List views;
7
8#endif
diff --git a/src/guides.h b/src/guides.h
index 25176dcc2..15c4c143b 100644
--- a/src/guides.h
+++ b/src/guides.h
@@ -1,8 +1,6 @@
1#ifndef E_GUIDES_H 1#ifndef E_GUIDES_H
2#define E_GUIDES_H 2#define E_GUIDES_H
3 3
4#include "e.h"
5
6typedef enum e_guides_mode 4typedef enum e_guides_mode
7 { 5 {
8 E_GUIDES_OPAQUE, /* configure window border & client */ 6 E_GUIDES_OPAQUE, /* configure window border & client */
diff --git a/src/icons.c b/src/icons.c
index 1c816a6a0..c0109a065 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -1 +1,890 @@
1#include "e.h" 1#include "icons.h"
2#include "debug.h"
3#include "globals.h"
4#include "cursors.h"
5#include "file.h"
6#include "util.h"
7
8static void e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
9static void e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
10static void e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
11static void e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
12static void e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
13
14
15static void
16e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
17{
18 E_Icon *ic;
19 Ecore_Event *ev;
20 Ecore_Event_Mouse_Down *e;
21
22 D_ENTER;
23
24 ev = e_view_get_current_event();
25 if (!ev) D_RETURN;
26 e = ev->event;
27 ic = _data;
28 ic->view->select.down.x = _x;
29 ic->view->select.down.y = _y;
30 ic->state.clicked = 1;
31 e_icon_update_state(ic);
32 if (_b == 1)
33 {
34 if (e->double_click)
35 {
36 e_icon_exec(ic);
37 ic->state.just_executed = 1;
38 }
39 else
40 {
41 if (!ic->state.selected)
42 {
43 if ((e->mods & mulit_select_mod))
44 {
45 e_icon_select(ic);
46 }
47 else
48 {
49 e_view_deselect_all_except(ic);
50 e_icon_select(ic);
51 }
52 ic->state.just_selected = 1;
53 }
54 }
55 }
56 else if (_b == 2)
57 {
58 }
59 else if (_b == 3)
60 {
61 }
62
63 D_RETURN;
64 UN(_e);
65 UN(_o);
66}
67
68static void
69e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
70{
71 E_Icon *ic;
72 Ecore_Event *ev;
73 Ecore_Event_Mouse_Up *e;
74
75 D_ENTER;
76
77 ev = e_view_get_current_event();
78 if (!ev) D_RETURN;
79 e = ev->event;
80 ic = _data;
81 if (ic->view->drag.started)
82 {
83 ic->state.clicked = 0;
84 ic->state.just_selected = 0;
85 e_icon_update_state(ic);
86 ecore_window_destroy(ic->view->drag.win);
87 ic->view->drag.started = 0;
88 D_RETURN;
89 }
90 if (_b == 1)
91 {
92 if (ic->state.just_executed)
93 {
94 ic->state.just_executed = 0;
95 }
96 else
97 {
98 if ((e->mods & mulit_select_mod))
99 {
100 if ((ic->state.selected) && (!ic->state.just_selected))
101 e_icon_deselect(ic);
102 }
103 else
104 {
105 e_view_deselect_all_except(ic);
106 e_icon_select(ic);
107 }
108 }
109 ic->state.just_selected = 0;
110 }
111 ic->state.clicked = 0;
112 e_icon_update_state(ic);
113
114 D_RETURN;
115 UN(_e);
116 UN(_o);
117 UN(_x);
118 UN(_y);
119}
120
121static void
122e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
123{
124 E_Icon *ic;
125
126 D_ENTER;
127
128 ic = _data;
129 e_cursors_display_in_window(ic->view->win.main, "View_Icon");
130
131 D_RETURN;
132 UN(_e);
133 UN(_o);
134 UN(_b);
135 UN(_x);
136 UN(_y);
137}
138
139static void
140e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
141{
142 E_Icon *ic;
143
144 ic = _data;
145 e_cursors_display_in_window(ic->view->win.main, "View");
146
147 D_RETURN;
148 UN(_e);
149 UN(_o);
150 UN(_b);
151 UN(_x);
152 UN(_y);
153}
154
155static void
156e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
157{
158 E_Icon *ic;
159 Ecore_Event *ev;
160 Ecore_Event_Mouse_Move *e;
161
162 D_ENTER;
163
164 ev = e_view_get_current_event();
165
166 if (!ev)
167 D_RETURN;
168
169 e = ev->event;
170 ic = _data;
171
172 if (!ic->state.clicked)
173 D_RETURN;
174
175 if (!ic->view->drag.started)
176 {
177 int dx, dy;
178
179 dx = ic->view->select.down.x - _x;
180 dy = ic->view->select.down.y - _y;
181 if (dx < 0) dx = -dx;
182 if (dy < 0) dy = -dy;
183 if ((dx > 3) || (dy > 3))
184 {
185 Pixmap pmap, mask;
186 Evas_List l;
187 int x, y, xx, yy, rw, rh, downx, downy, wx, wy, ww, wh;
188
189 /* find extents of icons to be dragged */
190 x = 999999999;
191 y = 999999999;
192 xx = -999999999;
193 yy = -999999999;
194 for (l = views; l; l = l->next)
195 {
196 E_View *v;
197 Evas_List ll;
198
199 v = l->data;
200 D("sel count %i\n", v->sel_count);
201 if (v->sel_count > 0)
202 {
203 for (ll = v->icons; ll; ll = ll->next)
204 {
205 E_Icon *ic;
206
207 ic = ll->data;
208 if (ic->state.selected)
209 {
210 int ix, iy, iw, ih;
211
212 ix = ic->view->scroll.x + ic->geom.x + v->location.x;
213 iy = ic->view->scroll.y + ic->geom.y + v->location.y;
214 iw = ic->geom.w;
215 ih = ic->geom.h;
216 if (ix < x) x = ix;
217 if (iy < y) y = iy;
218 if ((ix + iw) > xx) xx = ix + iw;
219 if ((iy + ih) > yy) yy = iy + ih;
220 }
221 }
222 }
223 }
224 ecore_window_get_geometry(0, NULL, NULL, &rw, &rh);
225 downx = ic->view->select.down.x + ic->view->location.x;
226 downy = ic->view->select.down.y + ic->view->location.y;
227
228 wx = x;
229 ww = xx - x;
230 if (wx < - (rw - downx))
231 {
232 wx = - (rw - downx);
233 ww -= (wx - x);
234 }
235 if ((wx + ww) > (rw + downx))
236 ww = (rw + downx) - wx;
237 wy = y;
238 wh = yy - y;
239 if (wy < - (rh - downy))
240 {
241 wy = - (rh - downy);
242 wh -= (wy - y);
243 }
244 if ((wy + wh) > (rh + downy))
245 wh = (rh + downy) - wy;
246
247
248 ic->view->drag.x = wx + ic->view->location.x;
249 ic->view->drag.y = wy + ic->view->location.y;
250 ic->view->drag.offset.x = downx - ic->view->drag.x;
251 ic->view->drag.offset.y = downy - ic->view->drag.y;
252
253 if ((ww < 1) || (wh < 1)) D_RETURN;
254 ic->view->drag.win = ecore_window_override_new(0, wx, wy, ww, wh);
255 pmap = ecore_pixmap_new(ic->view->drag.win, ww, wh, 0);
256 mask = ecore_pixmap_new(ic->view->drag.win, ww, wh, 1);
257 {
258 Imlib_Image im;
259
260 im = imlib_create_image(ww, wh);
261 imlib_context_set_image(im);
262 imlib_image_set_has_alpha(1);
263 imlib_context_set_blend(1);
264 imlib_image_clear();
265 imlib_context_set_color_modifier(NULL);
266 imlib_context_set_cliprect(0, 0, 0, 0);
267 imlib_context_set_angle(0);
268
269 for (l = views; l; l = l->next)
270 {
271 E_View *v;
272 Evas_List ll;
273
274 v = l->data;
275 if (v->sel_count > 0)
276 {
277 for (ll = v->icons; ll; ll = ll->next) {
278 E_Icon *ic;
279
280 ic = ll->data;
281 if (ic->state.selected)
282 {
283 double ix, iy;
284 int icx, icy;
285 Imlib_Image im2;
286 char icon[PATH_MAX];
287
288 evas_get_geometry(ic->view->evas,
289 ic->obj.icon,
290 &ix, &iy, NULL, NULL);
291 icx = ix + v->location.x - wx;
292 icy = iy + v->location.y - wy;
293 if (!ic->info.icon)
294 {
295 D("EEEEEEEEEEK %s has no icon\n", ic->file);
296 D_RETURN;
297 }
298 if (ic->state.clicked)
299 {
300 sprintf(icon, "%s:/icon/clicked", ic->info.icon);
301 }
302 else if (ic->state.selected)
303 {
304 sprintf(icon, "%s:/icon/selected", ic->info.icon);
305 }
306 else
307 {
308 sprintf(icon, "%s:/icon/normal", ic->info.icon);
309 }
310 im2 = imlib_load_image(icon);
311 if (im2)
312 {
313 int iw, ih;
314
315 imlib_context_set_image(im2);
316 iw = imlib_image_get_width();
317 ih = imlib_image_get_height();
318 imlib_context_set_image(im);
319 imlib_blend_image_onto_image(im2, 1,
320 0, 0, iw, ih,
321 icx, icy, iw, ih);
322 imlib_context_set_image(im2);
323 imlib_free_image();
324 imlib_context_set_image(im);
325 }
326 else
327 {
328 D("eek cant load\n");
329 }
330 }
331 }
332 }
333 }
334 imlib_context_set_image(im);
335 if (ww * wh < (200 * 200)) imlib_context_set_dither_mask(1);
336 else imlib_context_set_dither_mask(0);
337 imlib_context_set_dither(1);
338 imlib_context_set_drawable(pmap);
339 imlib_context_set_mask(mask);
340 imlib_context_set_blend(0);
341 imlib_context_set_color_modifier(NULL);
342 imlib_render_image_on_drawable(0, 0);
343 imlib_free_image();
344 }
345 ecore_window_set_background_pixmap(ic->view->drag.win, pmap);
346 ecore_window_set_shape_mask(ic->view->drag.win, mask);
347 ecore_window_ignore(ic->view->drag.win);
348 ecore_window_raise(ic->view->drag.win);
349 ecore_window_show(ic->view->drag.win);
350 ecore_pixmap_free(pmap);
351 ecore_pixmap_free(mask);
352 ic->view->drag.started = 1;
353 }
354 }
355
356 if (ic->view->drag.started)
357 {
358 int x, y;
359
360 x = _x - ic->view->drag.offset.x;
361 y = _y - ic->view->drag.offset.y;
362 ic->view->drag.x = x;
363 ic->view->drag.y = y;
364 ic->view->drag.update = 1;
365 ic->view->changed = 1;
366 }
367
368 D_RETURN;
369 UN(_e);
370 UN(_o);
371 UN(_b);
372}
373
374
375static void
376e_icon_cleanup(E_Icon *ic)
377{
378 D_ENTER;
379
380 /* FIXME: free stuff here! this leaks ... */
381
382 e_object_cleanup(E_OBJECT(ic));
383
384 D_RETURN;
385}
386
387E_Icon *
388e_icon_new(void)
389{
390 E_Icon *ic;
391
392 D_ENTER;
393
394 ic = NEW(E_Icon, 1);
395 ZERO(ic, E_Icon, 1);
396
397 e_object_init(E_OBJECT(ic), (E_Cleanup_Func) e_icon_cleanup);
398
399 D_RETURN_(ic);
400}
401
402
403
404E_Icon *
405e_icon_find_by_file(E_View *view, char *file)
406{
407 Evas_List l;
408
409 D_ENTER;
410
411 for (l = view->icons; l; l = l->next)
412 {
413 E_Icon *ic;
414
415 ic = l->data;
416 if ((ic) && (ic->file) && (file) && (!strcmp(ic->file, file)))
417 D_RETURN_(ic);
418 }
419 D_RETURN_(NULL);
420}
421
422void
423e_icon_show(E_Icon *ic)
424{
425 D_ENTER;
426
427
428 if (ic->state.visible) D_RETURN;
429 ic->state.visible = 1;
430 if (!ic->obj.event1)
431 {
432 ic->obj.event1 = evas_add_rectangle(ic->view->evas);
433 ic->obj.event2 = evas_add_rectangle(ic->view->evas);
434 evas_set_color(ic->view->evas, ic->obj.event1, 0, 0, 0, 0);
435 evas_set_color(ic->view->evas, ic->obj.event2, 0, 0, 0, 0);
436 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic);
437 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_UP, e_icon_up_cb, ic);
438 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_IN, e_icon_in_cb, ic);
439 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_OUT, e_icon_out_cb, ic);
440 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic);
441 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic);
442 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_UP, e_icon_up_cb, ic);
443 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_IN, e_icon_in_cb, ic);
444 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_OUT, e_icon_out_cb, ic);
445 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic);
446 }
447 evas_set_layer(ic->view->evas, ic->obj.icon, 200);
448 e_text_set_layer(ic->obj.text, 200);
449 evas_set_layer(ic->view->evas, ic->obj.event1, 210);
450 evas_set_layer(ic->view->evas, ic->obj.event2, 210);
451
452 evas_show(ic->view->evas, ic->obj.icon);
453 e_text_show(ic->obj.text);
454 evas_show(ic->view->evas, ic->obj.event1);
455 evas_show(ic->view->evas, ic->obj.event2);
456
457 D_RETURN;
458}
459
460void
461e_icon_hide(E_Icon *ic)
462{
463 D_ENTER;
464
465 if (!ic->state.visible) D_RETURN;
466 ic->state.visible = 0;
467 evas_hide(ic->view->evas, ic->obj.icon);
468 e_text_hide(ic->obj.text);
469 evas_hide(ic->view->evas, ic->obj.event1);
470 evas_hide(ic->view->evas, ic->obj.event2);
471
472 D_RETURN;
473}
474
475void
476e_icon_apply_xy(E_Icon *ic)
477{
478 D_ENTER;
479
480 /* threse calc icon extents for: */
481 /* [I] */
482 /* Ig */
483 /* [txt] */
484
485 if (ic->geom.text.w > ic->geom.icon.w) ic->geom.w = ic->geom.text.w;
486 else ic->geom.w = ic->geom.icon.w;
487 ic->geom.h = ic->geom.icon.h + ic->geom.text.h + ic->view->spacing.icon.g;
488
489 evas_resize(ic->view->evas, ic->obj.event1,
490 ic->geom.icon.w, ic->geom.icon.h);
491 evas_resize(ic->view->evas, ic->obj.event2,
492 ic->geom.text.w, ic->geom.text.h);
493 evas_move(ic->view->evas, ic->obj.event1,
494 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2),
495 ic->view->scroll.y + ic->geom.y);
496 evas_move(ic->view->evas, ic->obj.event2,
497 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2),
498 ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
499 evas_move(ic->view->evas, ic->obj.icon,
500 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2),
501 ic->view->scroll.y + ic->geom.y);
502 e_text_move(ic->obj.text,
503 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2),
504 ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
505 if (ic->obj.sel.under.icon)
506 {
507 int pl, pr, pt, pb;
508
509 ebits_get_insets(ic->obj.sel.under.icon, &pl, &pr, &pt, &pb);
510 ebits_move(ic->obj.sel.under.icon,
511 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2) - pl,
512 ic->view->scroll.y + ic->geom.y - pt);
513 ebits_resize(ic->obj.sel.under.icon,
514 ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb);
515 ebits_show(ic->obj.sel.under.icon);
516 }
517 if (ic->obj.sel.under.text)
518 {
519 int pl, pr, pt, pb;
520
521 ebits_get_insets(ic->obj.sel.under.text, &pl, &pr, &pt, &pb);
522 ebits_move(ic->obj.sel.under.text,
523 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2) - pl,
524 ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g - pt);
525 ebits_resize(ic->obj.sel.under.text,
526 ic->geom.text.w + pl + pr, ic->geom.text.h + pt + pb);
527 ebits_show(ic->obj.sel.under.text);
528 }
529 if (ic->obj.sel.over.icon)
530 {
531 int pl, pr, pt, pb;
532
533 ebits_get_insets(ic->obj.sel.over.icon, &pl, &pr, &pt, &pb);
534 ebits_move(ic->obj.sel.over.icon,
535 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2) - pl,
536 ic->view->scroll.y + ic->geom.y - pt);
537 ebits_resize(ic->obj.sel.over.icon,
538 ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb);
539 ebits_show(ic->obj.sel.over.icon);
540 }
541 if (ic->obj.sel.over.text)
542 {
543 int pl, pr, pt, pb;
544
545 ebits_get_insets(ic->obj.sel.over.text, &pl, &pr, &pt, &pb);
546 ebits_move(ic->obj.sel.over.text,
547 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2) - pl,
548 ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g - pt);
549 ebits_resize(ic->obj.sel.over.text,
550 ic->geom.text.w + pl + pr, ic->geom.text.h + pt + pb);
551 ebits_show(ic->obj.sel.over.text);
552 }
553 if ((ic->geom.x != ic->prev_geom.x) || (ic->geom.y != ic->prev_geom.y))
554 {
555 ic->q.write_xy = 1;
556 e_view_queue_icon_xy_record(ic->view);
557 }
558 if (ic->geom.x != ic->prev_geom.x) ic->view->extents.valid = 0;
559 else if (ic->geom.y != ic->prev_geom.y) ic->view->extents.valid = 0;
560 else if (ic->geom.w != ic->prev_geom.w) ic->view->extents.valid = 0;
561 else if (ic->geom.h != ic->prev_geom.h) ic->view->extents.valid = 0;
562
563 ic->prev_geom = ic->geom;
564 ic->prev_geom.x = ic->geom.x;
565 ic->prev_geom.y = ic->geom.y;
566 ic->prev_geom.w = ic->geom.w;
567 ic->prev_geom.h = ic->geom.h;
568
569 D_RETURN;
570}
571
572
573void
574e_icon_check_permissions(E_Icon *ic)
575{
576 D_ENTER;
577
578 if (!ic || !ic->info.mime.base || ic->stat.st_ino == 0)
579 D_RETURN;
580
581 if (!strcmp(ic->info.mime.base, "dir"))
582 {
583 if (e_file_can_exec(&ic->stat))
584 evas_set_color(ic->view->evas, ic->obj.icon, 255, 255, 255, 255);
585 else
586 evas_set_color(ic->view->evas, ic->obj.icon, 128, 128, 128, 128);
587 }
588
589 D_RETURN;
590}
591
592
593void
594e_icon_initial_show(E_Icon *ic)
595{
596 D_ENTER;
597
598 /* check if we have enuf info and we havent been shown yet */
599 if (!ic->info.icon) D_RETURN;
600 if (ic->state.visible) D_RETURN;
601
602 /* first. lets figure out the size of the icon */
603 evas_get_image_size(ic->view->evas, ic->obj.icon,
604 &(ic->geom.icon.w), &(ic->geom.icon.h));
605 {
606 double tw, th;
607
608 e_text_get_geometry(ic->obj.text, NULL, NULL, &tw, &th);
609 ic->geom.text.w = (int)tw;
610 ic->geom.text.h = (int)th;
611 }
612
613 /* now lets allocate space for it if we need to */
614 ic->geom.x = 999999;
615 ic->geom.y = 999999;
616
617 /* if needed queue a tiemout for a resort */
618 e_view_queue_resort(ic->view);
619
620 /* actually show the icon */
621 e_icon_apply_xy(ic);
622 e_icon_show(ic);
623
624 D_RETURN;
625}
626
627void
628e_icon_set_mime(E_Icon *ic, char *base, char *mime)
629{
630 int diff = 0;
631
632 D_ENTER;
633
634 if (!ic->info.mime.base) diff = 1;
635 if (!ic->info.mime.type) diff = 1;
636 if ((ic->info.mime.base) && (strcmp(ic->info.mime.base, base))) diff = 1;
637 if ((ic->info.mime.type) && (strcmp(ic->info.mime.base, mime))) diff = 1;
638 if (!diff) D_RETURN;
639 if (ic->info.mime.base) free(ic->info.mime.base);
640 if (ic->info.mime.type) free(ic->info.mime.type);
641 ic->info.mime.base = NULL;
642 ic->info.mime.type = NULL;
643 ic->info.mime.base = strdup(base);
644 ic->info.mime.type = strdup(mime);
645
646 D("%40s: %s/%s\n", ic->file, base, mime);
647
648 /* effect changes here */
649 if (ic->info.custom_icon)
650 {
651 if (ic->info.icon) free(ic->info.icon);
652 ic->info.icon = NULL;
653 ic->info.icon = strdup(ic->info.custom_icon);
654 evas_set_image_file(ic->view->evas, ic->obj.icon, ic->info.custom_icon);
655 e_view_queue_resort(ic->view);
656 D_RETURN;
657 }
658 /* find an icon */
659 {
660 char icon[PATH_MAX];
661 char type[PATH_MAX];
662 char *p;
663 int done = 0;
664
665 strcpy(type, ic->info.mime.type);
666 for (p = type; *p; p++)
667 {
668 if (*p == '/') *p = '-';
669 }
670 do
671 {
672 sprintf(icon, "%s/data/icons/%s/%s.db", PACKAGE_DATA_DIR,
673 ic->info.mime.base, type);
674 if (e_file_exists(icon))
675 {
676 done = 1;
677 break;
678 }
679 p = strrchr(type, '-');
680 if (p) *p = 0;
681 }
682 while (p);
683 if (!done)
684 {
685 if (!e_file_exists(icon))
686 {
687 sprintf(icon, "%s/data/icons/%s/default.db", PACKAGE_DATA_DIR,
688 ic->info.mime.base);
689 if (!e_file_exists(icon))
690 sprintf(icon, "%s/data/icons/unknown/default.db", PACKAGE_DATA_DIR);
691 }
692 }
693 ic->info.icon = strdup(icon);
694 }
695
696 e_icon_update_state(ic);
697
698 D_RETURN;
699}
700
701void
702e_icon_set_link(E_Icon *ic, char *link)
703{
704 D_ENTER;
705
706 if ((!link) && (ic->info.link))
707 {
708 free(ic->info.link);
709 ic->info.link = NULL;
710 /* effect changes here */
711 }
712 else if (link)
713 {
714 if ((ic->info.link) && (!strcmp(ic->info.link, link)))
715 {
716 free(ic->info.link);
717 ic->info.link = strdup(link);
718 /* effect changes here */
719 }
720 }
721
722 D_RETURN;
723}
724
725
726void
727e_icon_update_state(E_Icon *ic)
728{
729 char icon[PATH_MAX];
730 int iw, ih;
731 int gw, gh;
732
733 D_ENTER;
734
735 if (!ic->info.icon)
736 {
737 D("EEEEEEEEEEK %s has no icon\n", ic->file);
738 D_RETURN;
739 }
740 if (ic->state.clicked)
741 {
742 sprintf(icon, "%s:/icon/clicked", ic->info.icon);
743 }
744 else if (ic->state.selected)
745 {
746 sprintf(icon, "%s:/icon/selected", ic->info.icon);
747 }
748 else
749 {
750 sprintf(icon, "%s:/icon/normal", ic->info.icon);
751 }
752 if ((ic->state.selected) &&
753 (!ic->obj.sel.under.icon) &&
754 (!ic->obj.sel.over.icon))
755 {
756 char file[PATH_MAX];
757
758/*
759 sprintf(file, "%s/file.bits.db", e_config_get("selections"));
760 ic->obj.sel.over.icon = ebits_load(file);
761 sprintf(file, "%s/text.bits.db", e_config_get("selections"));
762 ic->obj.sel.over.text = ebits_load(file);
763 */
764 sprintf(file, "%s/file.bits.db", e_config_get("selections"));
765 ic->obj.sel.under.icon = ebits_load(file);
766 sprintf(file, "%s/text.bits.db", e_config_get("selections"));
767 ic->obj.sel.under.text = ebits_load(file);
768 if (ic->obj.sel.under.icon)
769 {
770 ebits_add_to_evas(ic->obj.sel.under.icon, ic->view->evas);
771 ebits_set_layer(ic->obj.sel.under.icon, 195);
772 }
773 if (ic->obj.sel.under.text)
774 {
775 ebits_add_to_evas(ic->obj.sel.under.text, ic->view->evas);
776 ebits_set_layer(ic->obj.sel.under.text, 195);
777 }
778 if (ic->obj.sel.over.icon)
779 {
780 ebits_add_to_evas(ic->obj.sel.over.icon, ic->view->evas);
781 ebits_set_layer(ic->obj.sel.over.icon, 205);
782 }
783 if (ic->obj.sel.over.text)
784 {
785 ebits_add_to_evas(ic->obj.sel.over.text, ic->view->evas);
786 ebits_set_layer(ic->obj.sel.over.text, 205);
787 }
788 }
789 else if ((!ic->state.selected) &&
790 ((ic->obj.sel.under.icon) ||
791 (ic->obj.sel.over.icon)))
792 {
793 if (ic->obj.sel.under.icon) ebits_free(ic->obj.sel.under.icon);
794 if (ic->obj.sel.under.text) ebits_free(ic->obj.sel.under.text);
795 if (ic->obj.sel.over.icon) ebits_free(ic->obj.sel.over.icon);
796 if (ic->obj.sel.over.text) ebits_free(ic->obj.sel.over.text);
797 ic->obj.sel.under.icon = NULL;
798 ic->obj.sel.under.text = NULL;
799 ic->obj.sel.over.icon = NULL;
800 ic->obj.sel.over.text = NULL;
801 }
802 evas_set_image_file(ic->view->evas, ic->obj.icon, icon);
803 evas_get_image_size(ic->view->evas, ic->obj.icon, &iw, &ih);
804 gw = ic->geom.icon.w;
805 gh = ic->geom.icon.h;
806 e_icon_apply_xy(ic);
807 if ((iw == gw) && (ih == gh)) D_RETURN;
808 e_view_queue_resort(ic->view);
809
810 D_RETURN;
811}
812
813
814void
815e_icon_invert_selection(E_Icon *ic)
816{
817 D_ENTER;
818
819 if (ic->state.selected) e_icon_deselect(ic);
820 else e_icon_select(ic);
821
822 D_RETURN;
823}
824
825void
826e_icon_select(E_Icon *ic)
827{
828 D_ENTER;
829
830 if (!ic->state.selected)
831 {
832 ic->state.selected = 1;
833 ic->view->sel_count++;
834 e_icon_update_state(ic);
835 }
836
837 D_RETURN;
838}
839
840void
841e_icon_deselect(E_Icon *ic)
842{
843 D_ENTER;
844
845 if (ic->state.selected)
846 {
847 ic->state.selected = 0;
848 ic->view->sel_count--;
849 e_icon_update_state(ic);
850 }
851
852 D_RETURN;
853}
854
855void
856e_icon_exec(E_Icon *ic)
857{
858 D_ENTER;
859
860 if (!strcmp(ic->info.mime.base, "dir") &&
861 e_file_can_exec(&ic->stat))
862 {
863 E_View *v;
864 char buf[PATH_MAX];
865
866 v = e_view_new();
867 v->size.w = 400;
868 v->size.h = 300;
869 v->options.back_pixmap = 0;
870 /* Load default bg then handle bg in metadata */
871 sprintf(buf, "%s/%s/.e_background.bg.db", ic->view->dir, ic->file);
872 v->bg = e_background_load(buf);
873 if (!v->bg)
874 {
875 sprintf(buf, "%s/view.bg.db", e_config_get("backgrounds"));
876 v->bg = e_background_load(buf);
877 }
878 sprintf(buf, "%s/%s", ic->view->dir, ic->file);
879 D("new dir >%s<\n", buf);
880 v->dir = strdup(buf);
881 e_view_realize(v);
882 ecore_window_set_title(v->win.base, ic->file);
883 ecore_window_set_name_class(v->win.base, "FileView", "E");
884 ecore_window_set_min_size(v->win.base, 8, 8);
885 }
886
887 e_icon_deselect(ic);
888
889 D_RETURN;
890}
diff --git a/src/icons.h b/src/icons.h
new file mode 100644
index 000000000..b8879360f
--- /dev/null
+++ b/src/icons.h
@@ -0,0 +1,102 @@
1#ifndef E_ICONS_H
2#define E_ICONS_H
3
4#include "view.h"
5#include "text.h"
6
7#ifndef E_ICON_TYPEDEF
8#define E_ICON_TYPEDEF
9typedef struct _E_Icon E_Icon;
10#endif
11
12#ifndef E_VIEW_TYPEDEF
13#define E_VIEW_TYPEDEF
14typedef struct _E_View E_View;
15#endif
16
17struct _E_Icon
18{
19 E_Object o;
20
21 char *file;
22 struct stat stat;
23
24 E_View *view;
25
26 struct {
27 char *icon;
28 char *custom_icon;
29 char *link;
30 struct {
31 char *base;
32 char *type;
33 } mime;
34 } info;
35
36 struct {
37 Evas_Object icon;
38 Evas_Object event1;
39 Evas_Object event2;
40 E_Text *text;
41 struct {
42 struct {
43 Ebits_Object icon;
44 Ebits_Object text;
45 } over, under;
46 } sel;
47 } obj;
48
49 struct {
50 int hilited;
51 int clicked;
52 int selected;
53 int running;
54 int disabled;
55 int visible;
56 int just_selected;
57 int just_executed;
58 } state;
59
60 struct {
61 int x, y, w, h;
62 struct {
63 int w, h;
64 } icon;
65 struct {
66 int w, h;
67 } text;
68 } geom, prev_geom;
69
70 struct {
71 int write_xy;
72 } q;
73
74 int changed;
75};
76
77
78E_Icon *e_icon_new(void);
79void e_icon_update_state(E_Icon *ic);
80void e_icon_invert_selection(E_Icon *ic);
81void e_icon_select(E_Icon *ic);
82void e_icon_deselect(E_Icon *ic);
83
84/**
85 * e_icon_exec - handles execution paths when user activates an icon
86 * @ic: The activated icon
87 *
88 * This function takes care of opening views when the user activates a
89 * directory, launching commands when an executable is activated etc.
90 */
91void e_icon_exec(E_Icon *ic);
92
93void e_icon_initial_show(E_Icon *ic);
94void e_icon_set_mime(E_Icon *ic, char *base, char *mime);
95void e_icon_set_link(E_Icon *ic, char *link);
96E_Icon *e_icon_find_by_file(E_View *view, char *file);
97void e_icon_show(E_Icon *ic);
98void e_icon_hide(E_Icon *ic);
99void e_icon_apply_xy(E_Icon *ic);
100void e_icon_check_permissions(E_Icon *ic);
101
102#endif
diff --git a/src/main.c b/src/main.c
index 6cbbb8509..700a32f19 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,6 +14,7 @@
14#include "view.h" 14#include "view.h"
15#include "place.h" 15#include "place.h"
16#include "iconbar.h" 16#include "iconbar.h"
17#include "util.h"
17 18
18#ifdef USE_FERITE 19#ifdef USE_FERITE
19# include "e_ferite.h" 20# include "e_ferite.h"
diff --git a/src/menu.c b/src/menu.c
index 43e238c78..ab92e343b 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1,6 +1,7 @@
1#include "debug.h" 1#include "debug.h"
2#include "menu.h" 2#include "menu.h"
3#include "config.h" 3#include "config.h"
4#include "util.h"
4 5
5static Evas_List open_menus = NULL; /* List of all open menus */ 6static Evas_List open_menus = NULL; /* List of all open menus */
6static Evas_List menus = NULL; 7static Evas_List menus = NULL;
diff --git a/src/place.c b/src/place.c
index 8fe44c1c9..8426f3746 100644
--- a/src/place.c
+++ b/src/place.c
@@ -3,6 +3,7 @@
3#include "place.h" 3#include "place.h"
4#include "actions.h" 4#include "actions.h"
5#include "guides.h" 5#include "guides.h"
6#include "util.h"
6 7
7static void e_mouse_down(Ecore_Event * ev); 8static void e_mouse_down(Ecore_Event * ev);
8static void e_mouse_up(Ecore_Event * ev); 9static void e_mouse_up(Ecore_Event * ev);
diff --git a/src/resist.c b/src/resist.c
index 9fe28678e..37f7acf0a 100644
--- a/src/resist.c
+++ b/src/resist.c
@@ -2,6 +2,7 @@
2#include "resist.h" 2#include "resist.h"
3#include "config.h" 3#include "config.h"
4#include "desktops.h" 4#include "desktops.h"
5#include "util.h"
5 6
6void 7void
7e_resist_border(E_Border *b) 8e_resist_border(E_Border *b)
diff --git a/src/scrollbar.c b/src/scrollbar.c
index 73eb89949..131925cfc 100644
--- a/src/scrollbar.c
+++ b/src/scrollbar.c
@@ -1,6 +1,7 @@
1#include "debug.h" 1#include "debug.h"
2#include "scrollbar.h" 2#include "scrollbar.h"
3#include "config.h" 3#include "config.h"
4#include "util.h"
4 5
5static void e_scrollbar_recalc(E_Scrollbar *sb); 6static void e_scrollbar_recalc(E_Scrollbar *sb);
6static void e_scrollbar_setup_bits(E_Scrollbar *sb); 7static void e_scrollbar_setup_bits(E_Scrollbar *sb);
diff --git a/src/text.c b/src/text.c
index 6a25e90af..83543af68 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1,5 +1,6 @@
1#include "debug.h" 1#include "debug.h"
2#include "text.h" 2#include "text.h"
3#include "util.h"
3 4
4E_Text * 5E_Text *
5e_text_new(Evas evas, char *text, char *class) 6e_text_new(Evas evas, char *text, char *class)
diff --git a/src/util.h b/src/util.h
index e00b3dad6..0d9ee5b6b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -16,4 +16,14 @@ __dest = malloc(strlen(__var) + 1); \
16if (__dest) strcpy(__dest, __var); \ 16if (__dest) strcpy(__dest, __var); \
17} } 17} }
18 18
19/* misc util macros */
20#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
21(((x) < ((xx) + (ww))) && \
22((y) < ((yy) + (hh))) && \
23(((x) + (w)) > (xx)) && \
24(((y) + (h)) > (yy)))
25#define SPANS_COMMON(x1, w1, x2, w2) \
26(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
27#define UN(_blah) _blah = 0
28
19#endif 29#endif
diff --git a/src/view.c b/src/view.c
index efdc53b97..8153b036e 100644
--- a/src/view.c
+++ b/src/view.c
@@ -3,8 +3,6 @@
3#include "debug.h" 3#include "debug.h"
4#include "view.h" 4#include "view.h"
5#include "cursors.h" 5#include "cursors.h"
6#include "background.h"
7#include "desktops.h"
8#include "config.h" 6#include "config.h"
9#include "border.h" 7#include "border.h"
10#include "menu.h" 8#include "menu.h"
@@ -12,21 +10,13 @@
12#include "fs.h" 10#include "fs.h"
13#include "file.h" 11#include "file.h"
14#include "util.h" 12#include "util.h"
13#include "globals.h"
15 14
16static Evas_List views = NULL;
17static Ecore_Event *current_ev = NULL; 15static Ecore_Event *current_ev = NULL;
18 16
19static Ecore_Event_Key_Modifiers mulit_select_mod = ECORE_EVENT_KEY_MODIFIER_SHIFT;
20static Ecore_Event_Key_Modifiers range_select_mod = ECORE_EVENT_KEY_MODIFIER_CTRL;
21
22static void e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); 17static void e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
23static void e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); 18static void e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
24static void e_bg_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); 19static void e_bg_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
25static void e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
26static void e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
27static void e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
28static void e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
29static void e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
30static void e_idle(void *data); 20static void e_idle(void *data);
31static void e_wheel(Ecore_Event * ev); 21static void e_wheel(Ecore_Event * ev);
32static void e_key_down(Ecore_Event * ev); 22static void e_key_down(Ecore_Event * ev);
@@ -375,7 +365,7 @@ e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
375 { 365 {
376 if (ic->state.visible) 366 if (ic->state.visible)
377 { 367 {
378 e_view_icon_invert_selection(ic); 368 e_icon_invert_selection(ic);
379 } 369 }
380 } 370 }
381 } 371 }
@@ -481,92 +471,6 @@ e_bg_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
481 UN(_b); 471 UN(_b);
482} 472}
483 473
484void
485e_view_icon_update_state(E_Icon *ic)
486{
487 char icon[PATH_MAX];
488 int iw, ih;
489 int gw, gh;
490
491 D_ENTER;
492
493 if (!ic->info.icon)
494 {
495 D("EEEEEEEEEEK %s has no icon\n", ic->file);
496 D_RETURN;
497 }
498 if (ic->state.clicked)
499 {
500 sprintf(icon, "%s:/icon/clicked", ic->info.icon);
501 }
502 else if (ic->state.selected)
503 {
504 sprintf(icon, "%s:/icon/selected", ic->info.icon);
505 }
506 else
507 {
508 sprintf(icon, "%s:/icon/normal", ic->info.icon);
509 }
510 if ((ic->state.selected) &&
511 (!ic->obj.sel.under.icon) &&
512 (!ic->obj.sel.over.icon))
513 {
514 char file[PATH_MAX];
515
516/*
517 sprintf(file, "%s/file.bits.db", e_config_get("selections"));
518 ic->obj.sel.over.icon = ebits_load(file);
519 sprintf(file, "%s/text.bits.db", e_config_get("selections"));
520 ic->obj.sel.over.text = ebits_load(file);
521 */
522 sprintf(file, "%s/file.bits.db", e_config_get("selections"));
523 ic->obj.sel.under.icon = ebits_load(file);
524 sprintf(file, "%s/text.bits.db", e_config_get("selections"));
525 ic->obj.sel.under.text = ebits_load(file);
526 if (ic->obj.sel.under.icon)
527 {
528 ebits_add_to_evas(ic->obj.sel.under.icon, ic->view->evas);
529 ebits_set_layer(ic->obj.sel.under.icon, 195);
530 }
531 if (ic->obj.sel.under.text)
532 {
533 ebits_add_to_evas(ic->obj.sel.under.text, ic->view->evas);
534 ebits_set_layer(ic->obj.sel.under.text, 195);
535 }
536 if (ic->obj.sel.over.icon)
537 {
538 ebits_add_to_evas(ic->obj.sel.over.icon, ic->view->evas);
539 ebits_set_layer(ic->obj.sel.over.icon, 205);
540 }
541 if (ic->obj.sel.over.text)
542 {
543 ebits_add_to_evas(ic->obj.sel.over.text, ic->view->evas);
544 ebits_set_layer(ic->obj.sel.over.text, 205);
545 }
546 }
547 else if ((!ic->state.selected) &&
548 ((ic->obj.sel.under.icon) ||
549 (ic->obj.sel.over.icon)))
550 {
551 if (ic->obj.sel.under.icon) ebits_free(ic->obj.sel.under.icon);
552 if (ic->obj.sel.under.text) ebits_free(ic->obj.sel.under.text);
553 if (ic->obj.sel.over.icon) ebits_free(ic->obj.sel.over.icon);
554 if (ic->obj.sel.over.text) ebits_free(ic->obj.sel.over.text);
555 ic->obj.sel.under.icon = NULL;
556 ic->obj.sel.under.text = NULL;
557 ic->obj.sel.over.icon = NULL;
558 ic->obj.sel.over.text = NULL;
559 }
560 evas_set_image_file(ic->view->evas, ic->obj.icon, icon);
561 evas_get_image_size(ic->view->evas, ic->obj.icon, &iw, &ih);
562 gw = ic->geom.icon.w;
563 gh = ic->geom.icon.h;
564 e_view_icon_apply_xy(ic);
565 if ((iw == gw) && (ih == gh)) D_RETURN;
566 e_view_queue_resort(ic->view);
567
568 D_RETURN;
569}
570 474
571void 475void
572e_view_deselect_all(void) 476e_view_deselect_all(void)
@@ -586,7 +490,7 @@ e_view_deselect_all(void)
586 E_Icon *ic; 490 E_Icon *ic;
587 491
588 ic = l->data; 492 ic = l->data;
589 e_view_icon_deselect(ic); 493 e_icon_deselect(ic);
590 } 494 }
591 } 495 }
592 496
@@ -612,89 +516,13 @@ e_view_deselect_all_except(E_Icon *not_ic)
612 516
613 ic = l->data; 517 ic = l->data;
614 if (ic != not_ic) 518 if (ic != not_ic)
615 e_view_icon_deselect(ic); 519 e_icon_deselect(ic);
616 } 520 }
617 } 521 }
618 522
619 D_RETURN; 523 D_RETURN;
620} 524}
621 525
622void
623e_view_icon_invert_selection(E_Icon *ic)
624{
625 D_ENTER;
626
627 if (ic->state.selected) e_view_icon_deselect(ic);
628 else e_view_icon_select(ic);
629
630 D_RETURN;
631}
632
633void
634e_view_icon_select(E_Icon *ic)
635{
636 D_ENTER;
637
638 if (!ic->state.selected)
639 {
640 ic->state.selected = 1;
641 ic->view->sel_count++;
642 e_view_icon_update_state(ic);
643 }
644
645 D_RETURN;
646}
647
648void
649e_view_icon_deselect(E_Icon *ic)
650{
651 D_ENTER;
652
653 if (ic->state.selected)
654 {
655 ic->state.selected = 0;
656 ic->view->sel_count--;
657 e_view_icon_update_state(ic);
658 }
659
660 D_RETURN;
661}
662
663void
664e_view_icon_exec(E_Icon *ic)
665{
666 D_ENTER;
667
668 if (!strcmp(ic->info.mime.base, "dir") &&
669 e_file_can_exec(&ic->stat))
670 {
671 E_View *v;
672 char buf[PATH_MAX];
673
674 v = e_view_new();
675 v->size.w = 400;
676 v->size.h = 300;
677 v->options.back_pixmap = 0;
678 /* Load default bg then handle bg in metadata */
679 sprintf(buf, "%s/%s/.e_background.bg.db", ic->view->dir, ic->file);
680 v->bg = e_background_load(buf);
681 if (!v->bg)
682 {
683 sprintf(buf, "%s/view.bg.db", e_config_get("backgrounds"));
684 v->bg = e_background_load(buf);
685 }
686 sprintf(buf, "%s/%s", ic->view->dir, ic->file);
687 D("new dir >%s<\n", buf);
688 v->dir = strdup(buf);
689 e_view_realize(v);
690 ecore_window_set_title(v->win.base, ic->file);
691 ecore_window_set_name_class(v->win.base, "FileView", "E");
692 ecore_window_set_min_size(v->win.base, 8, 8);
693 }
694 e_view_icon_deselect(ic);
695
696 D_RETURN;
697}
698 526
699void 527void
700e_view_icons_get_extents(E_View *v, int *min_x, int *min_y, int *max_x, int *max_y) 528e_view_icons_get_extents(E_View *v, int *min_x, int *min_y, int *max_x, int *max_y)
@@ -760,7 +588,7 @@ e_view_icons_apply_xy(E_View *v)
760 E_Icon *ic; 588 E_Icon *ic;
761 589
762 ic = l->data; 590 ic = l->data;
763 e_view_icon_apply_xy(ic); 591 e_icon_apply_xy(ic);
764 } 592 }
765 593
766 D_RETURN; 594 D_RETURN;
@@ -893,357 +721,6 @@ e_view_get_position_percentage(E_View *v, double *vx, double *vy)
893 D_RETURN; 721 D_RETURN;
894} 722}
895 723
896static void
897e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
898{
899 E_Icon *ic;
900 Ecore_Event *ev;
901 Ecore_Event_Mouse_Down *e;
902
903 D_ENTER;
904
905 ev = e_view_get_current_event();
906 if (!ev) D_RETURN;
907 e = ev->event;
908 ic = _data;
909 ic->view->select.down.x = _x;
910 ic->view->select.down.y = _y;
911 ic->state.clicked = 1;
912 e_view_icon_update_state(ic);
913 if (_b == 1)
914 {
915 if (e->double_click)
916 {
917 e_view_icon_exec(ic);
918 ic->state.just_executed = 1;
919 }
920 else
921 {
922 if (!ic->state.selected)
923 {
924 if ((e->mods & mulit_select_mod))
925 {
926 e_view_icon_select(ic);
927 }
928 else
929 {
930 e_view_deselect_all_except(ic);
931 e_view_icon_select(ic);
932 }
933 ic->state.just_selected = 1;
934 }
935 }
936 }
937 else if (_b == 2)
938 {
939 }
940 else if (_b == 3)
941 {
942 }
943
944 D_RETURN;
945 UN(_e);
946 UN(_o);
947}
948
949static void
950e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
951{
952 E_Icon *ic;
953 Ecore_Event *ev;
954 Ecore_Event_Mouse_Up *e;
955
956 D_ENTER;
957
958 ev = e_view_get_current_event();
959 if (!ev) D_RETURN;
960 e = ev->event;
961 ic = _data;
962 if (ic->view->drag.started)
963 {
964 ic->state.clicked = 0;
965 ic->state.just_selected = 0;
966 e_view_icon_update_state(ic);
967 ecore_window_destroy(ic->view->drag.win);
968 ic->view->drag.started = 0;
969 D_RETURN;
970 }
971 if (_b == 1)
972 {
973 if (ic->state.just_executed)
974 {
975 ic->state.just_executed = 0;
976 }
977 else
978 {
979 if ((e->mods & mulit_select_mod))
980 {
981 if ((ic->state.selected) && (!ic->state.just_selected))
982 e_view_icon_deselect(ic);
983 }
984 else
985 {
986 e_view_deselect_all_except(ic);
987 e_view_icon_select(ic);
988 }
989 }
990 ic->state.just_selected = 0;
991 }
992 ic->state.clicked = 0;
993 e_view_icon_update_state(ic);
994
995 D_RETURN;
996 UN(_e);
997 UN(_o);
998 UN(_x);
999 UN(_y);
1000}
1001
1002static void
1003e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
1004{
1005 E_Icon *ic;
1006
1007 D_ENTER;
1008
1009 ic = _data;
1010 e_cursors_display_in_window(ic->view->win.main, "View_Icon");
1011
1012 D_RETURN;
1013 UN(_e);
1014 UN(_o);
1015 UN(_b);
1016 UN(_x);
1017 UN(_y);
1018}
1019
1020static void
1021e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
1022{
1023 E_Icon *ic;
1024
1025 ic = _data;
1026 e_cursors_display_in_window(ic->view->win.main, "View");
1027
1028 D_RETURN;
1029 UN(_e);
1030 UN(_o);
1031 UN(_b);
1032 UN(_x);
1033 UN(_y);
1034}
1035
1036static void
1037e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
1038{
1039 E_Icon *ic;
1040 Ecore_Event *ev;
1041 Ecore_Event_Mouse_Move *e;
1042
1043 D_ENTER;
1044
1045 ev = e_view_get_current_event();
1046 if (!ev) D_RETURN;
1047 e = ev->event;
1048 ic = _data;
1049 if (!ic->state.clicked) D_RETURN;
1050 if (!ic->view->drag.started)
1051 {
1052 int dx, dy;
1053
1054 dx = ic->view->select.down.x - _x;
1055 dy = ic->view->select.down.y - _y;
1056 if (dx < 0) dx = -dx;
1057 if (dy < 0) dy = -dy;
1058 if ((dx > 3) || (dy > 3))
1059 {
1060 Pixmap pmap, mask;
1061 Evas_List l;
1062 int x, y, xx, yy, rw, rh, downx, downy, wx, wy, ww, wh;
1063
1064 /* find extents of icons to be dragged */
1065 x = 999999999;
1066 y = 999999999;
1067 xx = -999999999;
1068 yy = -999999999;
1069 for (l = views; l; l = l->next)
1070 {
1071 E_View *v;
1072 Evas_List ll;
1073
1074 v = l->data;
1075 D("sel count %i\n", v->sel_count);
1076 if (v->sel_count > 0)
1077 {
1078 for (ll = v->icons; ll; ll = ll->next)
1079 {
1080 E_Icon *ic;
1081
1082 ic = ll->data;
1083 if (ic->state.selected)
1084 {
1085 int ix, iy, iw, ih;
1086
1087 ix = ic->view->scroll.x + ic->geom.x + v->location.x;
1088 iy = ic->view->scroll.y + ic->geom.y + v->location.y;
1089 iw = ic->geom.w;
1090 ih = ic->geom.h;
1091 if (ix < x) x = ix;
1092 if (iy < y) y = iy;
1093 if ((ix + iw) > xx) xx = ix + iw;
1094 if ((iy + ih) > yy) yy = iy + ih;
1095 }
1096 }
1097 }
1098 }
1099 ecore_window_get_geometry(0, NULL, NULL, &rw, &rh);
1100 downx = ic->view->select.down.x + ic->view->location.x;
1101 downy = ic->view->select.down.y + ic->view->location.y;
1102
1103 wx = x;
1104 ww = xx - x;
1105 if (wx < - (rw - downx))
1106 {
1107 wx = - (rw - downx);
1108 ww -= (wx - x);
1109 }
1110 if ((wx + ww) > (rw + downx))
1111 ww = (rw + downx) - wx;
1112 wy = y;
1113 wh = yy - y;
1114 if (wy < - (rh - downy))
1115 {
1116 wy = - (rh - downy);
1117 wh -= (wy - y);
1118 }
1119 if ((wy + wh) > (rh + downy))
1120 wh = (rh + downy) - wy;
1121
1122
1123 ic->view->drag.x = wx + ic->view->location.x;
1124 ic->view->drag.y = wy + ic->view->location.y;
1125 ic->view->drag.offset.x = downx - ic->view->drag.x;
1126 ic->view->drag.offset.y = downy - ic->view->drag.y;
1127
1128 if ((ww < 1) || (wh < 1)) D_RETURN;
1129 ic->view->drag.win = ecore_window_override_new(0, wx, wy, ww, wh);
1130 pmap = ecore_pixmap_new(ic->view->drag.win, ww, wh, 0);
1131 mask = ecore_pixmap_new(ic->view->drag.win, ww, wh, 1);
1132 {
1133 Imlib_Image im;
1134
1135 im = imlib_create_image(ww, wh);
1136 imlib_context_set_image(im);
1137 imlib_image_set_has_alpha(1);
1138 imlib_context_set_blend(1);
1139 imlib_image_clear();
1140 imlib_context_set_color_modifier(NULL);
1141 imlib_context_set_cliprect(0, 0, 0, 0);
1142 imlib_context_set_angle(0);
1143
1144 for (l = views; l; l = l->next)
1145 {
1146 E_View *v;
1147 Evas_List ll;
1148
1149 v = l->data;
1150 if (v->sel_count > 0)
1151 {
1152 for (ll = v->icons; ll; ll = ll->next) {
1153 E_Icon *ic;
1154
1155 ic = ll->data;
1156 if (ic->state.selected)
1157 {
1158 double ix, iy;
1159 int icx, icy;
1160 Imlib_Image im2;
1161 char icon[PATH_MAX];
1162
1163 evas_get_geometry(ic->view->evas,
1164 ic->obj.icon,
1165 &ix, &iy, NULL, NULL);
1166 icx = ix + v->location.x - wx;
1167 icy = iy + v->location.y - wy;
1168 if (!ic->info.icon)
1169 {
1170 D("EEEEEEEEEEK %s has no icon\n", ic->file);
1171 D_RETURN;
1172 }
1173 if (ic->state.clicked)
1174 {
1175 sprintf(icon, "%s:/icon/clicked", ic->info.icon);
1176 }
1177 else if (ic->state.selected)
1178 {
1179 sprintf(icon, "%s:/icon/selected", ic->info.icon);
1180 }
1181 else
1182 {
1183 sprintf(icon, "%s:/icon/normal", ic->info.icon);
1184 }
1185 im2 = imlib_load_image(icon);
1186 if (im2)
1187 {
1188 int iw, ih;
1189
1190 imlib_context_set_image(im2);
1191 iw = imlib_image_get_width();
1192 ih = imlib_image_get_height();
1193 imlib_context_set_image(im);
1194 imlib_blend_image_onto_image(im2, 1,
1195 0, 0, iw, ih,
1196 icx, icy, iw, ih);
1197 imlib_context_set_image(im2);
1198 imlib_free_image();
1199 imlib_context_set_image(im);
1200 }
1201 else
1202 {
1203 D("eek cant load\n");
1204 }
1205 }
1206 }
1207 }
1208 }
1209 imlib_context_set_image(im);
1210 if (ww * wh < (200 * 200)) imlib_context_set_dither_mask(1);
1211 else imlib_context_set_dither_mask(0);
1212 imlib_context_set_dither(1);
1213 imlib_context_set_drawable(pmap);
1214 imlib_context_set_mask(mask);
1215 imlib_context_set_blend(0);
1216 imlib_context_set_color_modifier(NULL);
1217 imlib_render_image_on_drawable(0, 0);
1218 imlib_free_image();
1219 }
1220 ecore_window_set_background_pixmap(ic->view->drag.win, pmap);
1221 ecore_window_set_shape_mask(ic->view->drag.win, mask);
1222 ecore_window_ignore(ic->view->drag.win);
1223 ecore_window_raise(ic->view->drag.win);
1224 ecore_window_show(ic->view->drag.win);
1225 ecore_pixmap_free(pmap);
1226 ecore_pixmap_free(mask);
1227 ic->view->drag.started = 1;
1228 }
1229 }
1230 if (ic->view->drag.started)
1231 {
1232 int x, y;
1233
1234 x = _x - ic->view->drag.offset.x;
1235 y = _y - ic->view->drag.offset.y;
1236 ic->view->drag.x = x;
1237 ic->view->drag.y = y;
1238 ic->view->drag.update = 1;
1239 ic->view->changed = 1;
1240 }
1241
1242 D_RETURN;
1243 UN(_e);
1244 UN(_o);
1245 UN(_b);
1246}
1247 724
1248static void 725static void
1249e_idle(void *data) 726e_idle(void *data)
@@ -1879,220 +1356,6 @@ e_view_filter_file(E_View *v, char *file)
1879 UN(v); 1356 UN(v);
1880} 1357}
1881 1358
1882static void
1883e_view_icon_cleanup(E_Icon *ic)
1884{
1885 D_ENTER;
1886
1887 /* FIXME: free stuff here! this leaks ... */
1888
1889 e_object_cleanup(E_OBJECT(ic));
1890
1891 D_RETURN;
1892}
1893
1894E_Icon *
1895e_view_icon_new(void)
1896{
1897 E_Icon *ic;
1898
1899 D_ENTER;
1900
1901 ic = NEW(E_Icon, 1);
1902 ZERO(ic, E_Icon, 1);
1903
1904 e_object_init(E_OBJECT(ic), (E_Cleanup_Func) e_view_icon_cleanup);
1905
1906 D_RETURN_(ic);
1907}
1908
1909E_Icon *
1910e_view_find_icon_by_file(E_View *view, char *file)
1911{
1912 Evas_List l;
1913
1914 D_ENTER;
1915
1916 for (l = view->icons; l; l = l->next)
1917 {
1918 E_Icon *ic;
1919
1920 ic = l->data;
1921 if ((ic) && (ic->file) && (file) && (!strcmp(ic->file, file)))
1922 D_RETURN_(ic);
1923 }
1924 D_RETURN_(NULL);
1925}
1926
1927void
1928e_view_icon_show(E_Icon *ic)
1929{
1930 D_ENTER;
1931
1932
1933 if (ic->state.visible) D_RETURN;
1934 ic->state.visible = 1;
1935 if (!ic->obj.event1)
1936 {
1937 ic->obj.event1 = evas_add_rectangle(ic->view->evas);
1938 ic->obj.event2 = evas_add_rectangle(ic->view->evas);
1939 evas_set_color(ic->view->evas, ic->obj.event1, 0, 0, 0, 0);
1940 evas_set_color(ic->view->evas, ic->obj.event2, 0, 0, 0, 0);
1941 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic);
1942 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_UP, e_icon_up_cb, ic);
1943 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_IN, e_icon_in_cb, ic);
1944 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_OUT, e_icon_out_cb, ic);
1945 evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic);
1946 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic);
1947 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_UP, e_icon_up_cb, ic);
1948 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_IN, e_icon_in_cb, ic);
1949 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_OUT, e_icon_out_cb, ic);
1950 evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic);
1951 }
1952 evas_set_layer(ic->view->evas, ic->obj.icon, 200);
1953 e_text_set_layer(ic->obj.text, 200);
1954 evas_set_layer(ic->view->evas, ic->obj.event1, 210);
1955 evas_set_layer(ic->view->evas, ic->obj.event2, 210);
1956
1957 evas_show(ic->view->evas, ic->obj.icon);
1958 e_text_show(ic->obj.text);
1959 evas_show(ic->view->evas, ic->obj.event1);
1960 evas_show(ic->view->evas, ic->obj.event2);
1961
1962 D_RETURN;
1963}
1964
1965void
1966e_view_icon_hide(E_Icon *ic)
1967{
1968 D_ENTER;
1969
1970 if (!ic->state.visible) D_RETURN;
1971 ic->state.visible = 0;
1972 evas_hide(ic->view->evas, ic->obj.icon);
1973 e_text_hide(ic->obj.text);
1974 evas_hide(ic->view->evas, ic->obj.event1);
1975 evas_hide(ic->view->evas, ic->obj.event2);
1976
1977 D_RETURN;
1978}
1979
1980void
1981e_view_icon_apply_xy(E_Icon *ic)
1982{
1983 D_ENTER;
1984
1985 /* threse calc icon extents for: */
1986 /* [I] */
1987 /* Ig */
1988 /* [txt] */
1989
1990 if (ic->geom.text.w > ic->geom.icon.w) ic->geom.w = ic->geom.text.w;
1991 else ic->geom.w = ic->geom.icon.w;
1992 ic->geom.h = ic->geom.icon.h + ic->geom.text.h + ic->view->spacing.icon.g;
1993
1994 evas_resize(ic->view->evas, ic->obj.event1,
1995 ic->geom.icon.w, ic->geom.icon.h);
1996 evas_resize(ic->view->evas, ic->obj.event2,
1997 ic->geom.text.w, ic->geom.text.h);
1998 evas_move(ic->view->evas, ic->obj.event1,
1999 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2),
2000 ic->view->scroll.y + ic->geom.y);
2001 evas_move(ic->view->evas, ic->obj.event2,
2002 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2),
2003 ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
2004 evas_move(ic->view->evas, ic->obj.icon,
2005 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2),
2006 ic->view->scroll.y + ic->geom.y);
2007 e_text_move(ic->obj.text,
2008 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2),
2009 ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
2010 if (ic->obj.sel.under.icon)
2011 {
2012 int pl, pr, pt, pb;
2013
2014 ebits_get_insets(ic->obj.sel.under.icon, &pl, &pr, &pt, &pb);
2015 ebits_move(ic->obj.sel.under.icon,
2016 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2) - pl,
2017 ic->view->scroll.y + ic->geom.y - pt);
2018 ebits_resize(ic->obj.sel.under.icon,
2019 ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb);
2020 ebits_show(ic->obj.sel.under.icon);
2021 }
2022 if (ic->obj.sel.under.text)
2023 {
2024 int pl, pr, pt, pb;
2025
2026 ebits_get_insets(ic->obj.sel.under.text, &pl, &pr, &pt, &pb);
2027 ebits_move(ic->obj.sel.under.text,
2028 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2) - pl,
2029 ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g - pt);
2030 ebits_resize(ic->obj.sel.under.text,
2031 ic->geom.text.w + pl + pr, ic->geom.text.h + pt + pb);
2032 ebits_show(ic->obj.sel.under.text);
2033 }
2034 if (ic->obj.sel.over.icon)
2035 {
2036 int pl, pr, pt, pb;
2037
2038 ebits_get_insets(ic->obj.sel.over.icon, &pl, &pr, &pt, &pb);
2039 ebits_move(ic->obj.sel.over.icon,
2040 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2) - pl,
2041 ic->view->scroll.y + ic->geom.y - pt);
2042 ebits_resize(ic->obj.sel.over.icon,
2043 ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb);
2044 ebits_show(ic->obj.sel.over.icon);
2045 }
2046 if (ic->obj.sel.over.text)
2047 {
2048 int pl, pr, pt, pb;
2049
2050 ebits_get_insets(ic->obj.sel.over.text, &pl, &pr, &pt, &pb);
2051 ebits_move(ic->obj.sel.over.text,
2052 ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2) - pl,
2053 ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g - pt);
2054 ebits_resize(ic->obj.sel.over.text,
2055 ic->geom.text.w + pl + pr, ic->geom.text.h + pt + pb);
2056 ebits_show(ic->obj.sel.over.text);
2057 }
2058 if ((ic->geom.x != ic->prev_geom.x) || (ic->geom.y != ic->prev_geom.y))
2059 {
2060 ic->q.write_xy = 1;
2061 e_view_queue_icon_xy_record(ic->view);
2062 }
2063 if (ic->geom.x != ic->prev_geom.x) ic->view->extents.valid = 0;
2064 else if (ic->geom.y != ic->prev_geom.y) ic->view->extents.valid = 0;
2065 else if (ic->geom.w != ic->prev_geom.w) ic->view->extents.valid = 0;
2066 else if (ic->geom.h != ic->prev_geom.h) ic->view->extents.valid = 0;
2067
2068 ic->prev_geom = ic->geom;
2069 ic->prev_geom.x = ic->geom.x;
2070 ic->prev_geom.y = ic->geom.y;
2071 ic->prev_geom.w = ic->geom.w;
2072 ic->prev_geom.h = ic->geom.h;
2073
2074 D_RETURN;
2075}
2076
2077
2078void
2079e_view_icon_check_permissions(E_Icon *ic)
2080{
2081 D_ENTER;
2082
2083 if (!ic || !ic->info.mime.base || ic->stat.st_ino == 0)
2084 D_RETURN;
2085
2086 if (!strcmp(ic->info.mime.base, "dir"))
2087 {
2088 if (e_file_can_exec(&ic->stat))
2089 evas_set_color(ic->view->evas, ic->obj.icon, 255, 255, 255, 255);
2090 else
2091 evas_set_color(ic->view->evas, ic->obj.icon, 128, 128, 128, 128);
2092 }
2093
2094 D_RETURN;
2095}
2096 1359
2097 1360
2098static int 1361static int
@@ -2160,7 +1423,7 @@ e_view_arrange(E_View *v)
2160 } 1423 }
2161 ic->geom.x = x; 1424 ic->geom.x = x;
2162 ic->geom.y = y; 1425 ic->geom.y = y;
2163 e_view_icon_apply_xy(ic); 1426 e_icon_apply_xy(ic);
2164 x += ic->geom.w + v->spacing.icon.s; 1427 x += ic->geom.w + v->spacing.icon.s;
2165 } 1428 }
2166 1429
@@ -2230,137 +1493,6 @@ e_view_queue_resort(E_View *v)
2230 D_RETURN; 1493 D_RETURN;
2231} 1494}
2232 1495
2233void
2234e_view_icon_initial_show(E_Icon *ic)
2235{
2236 D_ENTER;
2237
2238 /* check if we have enuf info and we havent been shown yet */
2239 if (!ic->info.icon) D_RETURN;
2240 if (ic->state.visible) D_RETURN;
2241
2242 /* first. lets figure out the size of the icon */
2243 evas_get_image_size(ic->view->evas, ic->obj.icon,
2244 &(ic->geom.icon.w), &(ic->geom.icon.h));
2245 {
2246 double tw, th;
2247
2248 e_text_get_geometry(ic->obj.text, NULL, NULL, &tw, &th);
2249 ic->geom.text.w = (int)tw;
2250 ic->geom.text.h = (int)th;
2251 }
2252
2253 /* now lets allocate space for it if we need to */
2254 ic->geom.x = 999999;
2255 ic->geom.y = 999999;
2256
2257 /* if needed queue a tiemout for a resort */
2258 e_view_queue_resort(ic->view);
2259
2260 /* actually show the icon */
2261 e_view_icon_apply_xy(ic);
2262 e_view_icon_show(ic);
2263
2264 D_RETURN;
2265}
2266
2267void
2268e_view_icon_set_mime(E_Icon *ic, char *base, char *mime)
2269{
2270 int diff = 0;
2271
2272 D_ENTER;
2273
2274 if (!ic->info.mime.base) diff = 1;
2275 if (!ic->info.mime.type) diff = 1;
2276 if ((ic->info.mime.base) && (strcmp(ic->info.mime.base, base))) diff = 1;
2277 if ((ic->info.mime.type) && (strcmp(ic->info.mime.base, mime))) diff = 1;
2278 if (!diff) D_RETURN;
2279 if (ic->info.mime.base) free(ic->info.mime.base);
2280 if (ic->info.mime.type) free(ic->info.mime.type);
2281 ic->info.mime.base = NULL;
2282 ic->info.mime.type = NULL;
2283 ic->info.mime.base = strdup(base);
2284 ic->info.mime.type = strdup(mime);
2285
2286 D("%40s: %s/%s\n", ic->file, base, mime);
2287
2288 /* effect changes here */
2289 if (ic->info.custom_icon)
2290 {
2291 if (ic->info.icon) free(ic->info.icon);
2292 ic->info.icon = NULL;
2293 ic->info.icon = strdup(ic->info.custom_icon);
2294 evas_set_image_file(ic->view->evas, ic->obj.icon, ic->info.custom_icon);
2295 e_view_queue_resort(ic->view);
2296 D_RETURN;
2297 }
2298 /* find an icon */
2299 {
2300 char icon[PATH_MAX];
2301 char type[PATH_MAX];
2302 char *p;
2303 int done = 0;
2304
2305 strcpy(type, ic->info.mime.type);
2306 for (p = type; *p; p++)
2307 {
2308 if (*p == '/') *p = '-';
2309 }
2310 do
2311 {
2312 sprintf(icon, "%s/data/icons/%s/%s.db", PACKAGE_DATA_DIR,
2313 ic->info.mime.base, type);
2314 if (e_file_exists(icon))
2315 {
2316 done = 1;
2317 break;
2318 }
2319 p = strrchr(type, '-');
2320 if (p) *p = 0;
2321 }
2322 while (p);
2323 if (!done)
2324 {
2325 if (!e_file_exists(icon))
2326 {
2327 sprintf(icon, "%s/data/icons/%s/default.db", PACKAGE_DATA_DIR,
2328 ic->info.mime.base);
2329 if (!e_file_exists(icon))
2330 sprintf(icon, "%s/data/icons/unknown/default.db", PACKAGE_DATA_DIR);
2331 }
2332 }
2333 ic->info.icon = strdup(icon);
2334 }
2335
2336 e_view_icon_update_state(ic);
2337
2338 D_RETURN;
2339}
2340
2341void
2342e_view_icon_set_link(E_Icon *ic, char *link)
2343{
2344 D_ENTER;
2345
2346 if ((!link) && (ic->info.link))
2347 {
2348 free(ic->info.link);
2349 ic->info.link = NULL;
2350 /* effect changes here */
2351 }
2352 else if (link)
2353 {
2354 if ((ic->info.link) && (!strcmp(ic->info.link, link)))
2355 {
2356 free(ic->info.link);
2357 ic->info.link = strdup(link);
2358 /* effect changes here */
2359 }
2360 }
2361
2362 D_RETURN;
2363}
2364 1496
2365void 1497void
2366e_view_file_added(int id, char *file) 1498e_view_file_added(int id, char *file)
@@ -2378,11 +1510,11 @@ e_view_file_added(int id, char *file)
2378 e_iconbar_file_add(v, file); 1510 e_iconbar_file_add(v, file);
2379 /* filter files here */ 1511 /* filter files here */
2380 if (!e_view_filter_file(v, file)) D_RETURN; 1512 if (!e_view_filter_file(v, file)) D_RETURN;
2381 if (!e_view_find_icon_by_file(v, file)) 1513 if (!e_icon_find_by_file(v, file))
2382 { 1514 {
2383 E_Icon *ic; 1515 E_Icon *ic;
2384 1516
2385 ic = e_view_icon_new(); 1517 ic = e_icon_new();
2386 ic->view = v; 1518 ic->view = v;
2387 ic->file = strdup(file); 1519 ic->file = strdup(file);
2388 ic->changed = 1; 1520 ic->changed = 1;
@@ -2410,10 +1542,10 @@ e_view_file_deleted(int id, char *file)
2410 { 1542 {
2411 E_Icon *ic; 1543 E_Icon *ic;
2412 1544
2413 ic = e_view_find_icon_by_file(v, file); 1545 ic = e_icon_find_by_file(v, file);
2414 if (ic) 1546 if (ic)
2415 { 1547 {
2416 e_view_icon_hide(ic); 1548 e_icon_hide(ic);
2417 e_object_unref(E_OBJECT(ic)); 1549 e_object_unref(E_OBJECT(ic));
2418 v->icons = evas_list_remove(v->icons, ic); 1550 v->icons = evas_list_remove(v->icons, ic);
2419 v->changed = 1; 1551 v->changed = 1;
@@ -2441,7 +1573,7 @@ e_view_file_changed(int id, char *file)
2441 { 1573 {
2442 E_Icon *ic; 1574 E_Icon *ic;
2443 1575
2444 ic = e_view_find_icon_by_file(v, file); 1576 ic = e_icon_find_by_file(v, file);
2445 if (ic) 1577 if (ic)
2446 { 1578 {
2447 } 1579 }
@@ -2467,7 +1599,7 @@ e_view_file_moved(int id, char *file)
2467 { 1599 {
2468 E_Icon *ic; 1600 E_Icon *ic;
2469 1601
2470 ic = e_view_find_icon_by_file(v, file); 1602 ic = e_icon_find_by_file(v, file);
2471 if (ic) 1603 if (ic)
2472 { 1604 {
2473 } 1605 }
@@ -2881,7 +2013,7 @@ e_view_handle_fs(EfsdEvent *ev)
2881 2013
2882 if ((v) && (file)) 2014 if ((v) && (file))
2883 { 2015 {
2884 ic = e_view_find_icon_by_file(v, file); 2016 ic = e_icon_find_by_file(v, file);
2885 if ((ic) && 2017 if ((ic) &&
2886 (ev->efsd_reply_event.data)) 2018 (ev->efsd_reply_event.data))
2887 { 2019 {
@@ -2903,14 +2035,14 @@ e_view_handle_fs(EfsdEvent *ev)
2903 strcpy(mime, "unknown"); 2035 strcpy(mime, "unknown");
2904 } 2036 }
2905/* D("MIME: %s\n", m); 2037/* D("MIME: %s\n", m);
2906*/ e_view_icon_set_mime(ic, base, mime); 2038*/ e_icon_set_mime(ic, base, mime);
2907 2039
2908 /* Try to update the GUI according to the file permissions. 2040 /* Try to update the GUI according to the file permissions.
2909 It's just a try because we need to have the file's stat 2041 It's just a try because we need to have the file's stat
2910 info as well. --cK. 2042 info as well. --cK.
2911 */ 2043 */
2912 e_view_icon_check_permissions(ic); 2044 e_icon_check_permissions(ic);
2913 e_view_icon_initial_show(ic); 2045 e_icon_initial_show(ic);
2914 } 2046 }
2915 } 2047 }
2916 } 2048 }
@@ -2933,12 +2065,12 @@ e_view_handle_fs(EfsdEvent *ev)
2933 2065
2934 if (v) 2066 if (v)
2935 { 2067 {
2936 ic = e_view_find_icon_by_file(v, e_file_get_file(efsd_reply_filename(ev))); 2068 ic = e_icon_find_by_file(v, e_file_get_file(efsd_reply_filename(ev)));
2937 2069
2938 if (ic) 2070 if (ic)
2939 { 2071 {
2940 ic->stat = *((struct stat*)efsd_reply_data(ev)); 2072 ic->stat = *((struct stat*)efsd_reply_data(ev));
2941 e_view_icon_check_permissions(ic); 2073 e_icon_check_permissions(ic);
2942 } 2074 }
2943 } 2075 }
2944 } 2076 }
@@ -2959,11 +2091,11 @@ e_view_handle_fs(EfsdEvent *ev)
2959 v = e_view_find_by_monitor_id(efsd_reply_id(ev)); 2091 v = e_view_find_by_monitor_id(efsd_reply_id(ev));
2960 if ((v) && (file)) 2092 if ((v) && (file))
2961 { 2093 {
2962 ic = e_view_find_icon_by_file(v, file); 2094 ic = e_icon_find_by_file(v, file);
2963 if ((ic) && 2095 if ((ic) &&
2964 (ev->efsd_reply_event.data)) 2096 (ev->efsd_reply_event.data))
2965 e_view_icon_set_link(ic, (char*)efsd_reply_data(ev)); 2097 e_icon_set_link(ic, (char*)efsd_reply_data(ev));
2966 e_view_icon_initial_show(ic); 2098 e_icon_initial_show(ic);
2967 } 2099 }
2968 } 2100 }
2969 break; 2101 break;
diff --git a/src/view.h b/src/view.h
index 719aaaeb7..e0fe2448a 100644
--- a/src/view.h
+++ b/src/view.h
@@ -5,16 +5,19 @@
5#include "background.h" 5#include "background.h"
6#include "scrollbar.h" 6#include "scrollbar.h"
7#include "fs.h" 7#include "fs.h"
8#include "text.h"
9#include "iconbar.h" 8#include "iconbar.h"
10#include "object.h" 9#include "object.h"
10#include "icons.h"
11 11
12#ifndef E_VIEW_TYPEDEF 12#ifndef E_VIEW_TYPEDEF
13#define E_VIEW_TYPEDEF 13#define E_VIEW_TYPEDEF
14typedef struct _E_View E_View; 14typedef struct _E_View E_View;
15#endif 15#endif
16 16
17typedef struct _E_Icon E_Icon; 17#ifndef E_ICON_TYPEDEF
18#define E_ICON_TYPEDEF
19typedef struct _E_Icon E_Icon;
20#endif
18 21
19#ifndef E_ICONBAR_TYPEDEF 22#ifndef E_ICONBAR_TYPEDEF
20#define E_ICONBAR_TYPEDEF 23#define E_ICONBAR_TYPEDEF
@@ -22,7 +25,6 @@ typedef struct _E_Iconbar E_Iconbar;
22#endif 25#endif
23 26
24 27
25
26struct _E_View 28struct _E_View
27{ 29{
28 E_Object o; 30 E_Object o;
@@ -145,66 +147,6 @@ struct _E_View
145}; 147};
146 148
147 149
148struct _E_Icon
149{
150 E_Object o;
151
152 char *file;
153 struct stat stat;
154
155 E_View *view;
156
157 struct {
158 char *icon;
159 char *custom_icon;
160 char *link;
161 struct {
162 char *base;
163 char *type;
164 } mime;
165 } info;
166
167 struct {
168 Evas_Object icon;
169 Evas_Object event1;
170 Evas_Object event2;
171 E_Text *text;
172 struct {
173 struct {
174 Ebits_Object icon;
175 Ebits_Object text;
176 } over, under;
177 } sel;
178 } obj;
179
180 struct {
181 int hilited;
182 int clicked;
183 int selected;
184 int running;
185 int disabled;
186 int visible;
187 int just_selected;
188 int just_executed;
189 } state;
190
191 struct {
192 int x, y, w, h;
193 struct {
194 int w, h;
195 } icon;
196 struct {
197 int w, h;
198 } text;
199 } geom, prev_geom;
200
201 struct {
202 int write_xy;
203 } q;
204
205 int changed;
206};
207
208 150
209/** 151/**
210 * e_view_init - View event handlers initialization. 152 * e_view_init - View event handlers initialization.
@@ -227,34 +169,13 @@ void e_view_scroll_by(E_View *v, int sx, int sy);
227void e_view_scroll_to_percent(E_View *v, double psx, double psy); 169void e_view_scroll_to_percent(E_View *v, double psx, double psy);
228void e_view_get_viewable_percentage(E_View *v, double *vw, double *vh); 170void e_view_get_viewable_percentage(E_View *v, double *vw, double *vh);
229void e_view_get_position_percentage(E_View *v, double *vx, double *vy); 171void e_view_get_position_percentage(E_View *v, double *vx, double *vy);
230void e_view_icon_update_state(E_Icon *ic);
231void e_view_icon_invert_selection(E_Icon *ic);
232void e_view_icon_select(E_Icon *ic);
233void e_view_icon_deselect(E_Icon *ic);
234 172
235/**
236 * e_view_icon_exec - handles execution paths when user activates an icon
237 * @ic: The activated icon
238 *
239 * This function takes care of opening views when the user activates a
240 * directory, launching commands when an executable is activated etc.
241 */
242void e_view_icon_exec(E_Icon *ic);
243
244void e_view_icon_initial_show(E_Icon *ic);
245void e_view_icon_set_mime(E_Icon *ic, char *base, char *mime);
246void e_view_icon_set_link(E_Icon *ic, char *link);
247E_Icon *e_view_icon_new(void);
248E_Icon *e_view_find_icon_by_file(E_View *view, char *file);
249void e_view_icon_show(E_Icon *ic);
250void e_view_icon_hide(E_Icon *ic);
251void e_view_icon_apply_xy(E_Icon *ic);
252void e_view_icon_check_permissions(E_Icon *ic);
253void e_view_resort_alphabetical(E_View *v); 173void e_view_resort_alphabetical(E_View *v);
254void e_view_arrange(E_View *v); 174void e_view_arrange(E_View *v);
255void e_view_resort(E_View *v); 175void e_view_resort(E_View *v);
256void e_view_queue_geometry_record(E_View *v);
257void e_view_geometry_record(E_View *v); 176void e_view_geometry_record(E_View *v);
177void e_view_queue_geometry_record(E_View *v);
178void e_view_queue_icon_xy_record(E_View *v);
258void e_view_queue_resort(E_View *v); 179void e_view_queue_resort(E_View *v);
259void e_view_file_added(int id, char *file); 180void e_view_file_added(int id, char *file);
260void e_view_file_deleted(int id, char *file); 181void e_view_file_deleted(int id, char *file);