2000-12-18 13:28:44 -08:00
|
|
|
#include "e.h"
|
|
|
|
|
2000-12-27 14:42:59 -08:00
|
|
|
static Evas_List views = NULL;
|
2001-02-17 18:56:37 -08:00
|
|
|
static Eevent *current_ev = NULL;
|
2000-12-27 14:42:59 -08:00
|
|
|
|
2001-02-17 18:56:37 -08:00
|
|
|
static void e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
|
|
|
static void e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
2001-02-06 00:23:36 -08:00
|
|
|
static void e_idle(void *data);
|
|
|
|
static void e_wheel(Eevent * ev);
|
|
|
|
static void e_key_down(Eevent * ev);
|
|
|
|
static void e_key_up(Eevent * ev);
|
|
|
|
static void e_mouse_down(Eevent * ev);
|
|
|
|
static void e_mouse_up(Eevent * ev);
|
|
|
|
static void e_mouse_move(Eevent * ev);
|
|
|
|
static void e_mouse_in(Eevent * ev);
|
|
|
|
static void e_mouse_out(Eevent * ev);
|
|
|
|
static void e_window_expose(Eevent * ev);
|
2001-02-12 10:58:51 -08:00
|
|
|
static void e_view_handle_fs(EfsdEvent *ev);
|
2001-04-26 13:41:23 -07:00
|
|
|
static void e_view_handle_fs_restart(void *data);
|
2001-02-06 00:23:36 -08:00
|
|
|
|
2001-03-04 19:04:33 -08:00
|
|
|
/* FIXME: hack to test entry boxes */
|
|
|
|
static E_Entry *entry = NULL;
|
|
|
|
|
2001-02-17 18:56:37 -08:00
|
|
|
static void
|
|
|
|
e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
|
|
|
{
|
|
|
|
Ev_Mouse_Down *ev;
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
ev = current_ev->event;
|
|
|
|
v = _data;
|
|
|
|
if (_b == 1)
|
|
|
|
{
|
|
|
|
v->selection.on = 1;
|
|
|
|
v->selection.start_x = _x;
|
|
|
|
v->selection.start_y = _y;
|
|
|
|
v->selection.x = _x;
|
|
|
|
v->selection.y = _y;
|
|
|
|
v->selection.w = 1;
|
|
|
|
v->selection.h = 1;
|
|
|
|
if (!v->selection.obj_rect)
|
|
|
|
{
|
|
|
|
v->selection.obj_rect = evas_add_rectangle(v->evas);
|
|
|
|
v->selection.obj_l1 = evas_add_line(v->evas);
|
|
|
|
v->selection.obj_l2 = evas_add_line(v->evas);
|
|
|
|
v->selection.obj_l3 = evas_add_line(v->evas);
|
|
|
|
v->selection.obj_l4 = evas_add_line(v->evas);
|
|
|
|
evas_set_color(v->evas, v->selection.obj_rect, 255, 255, 255, 100);
|
|
|
|
evas_set_color(v->evas, v->selection.obj_l1, 0, 0, 0, 200);
|
|
|
|
evas_set_color(v->evas, v->selection.obj_l2, 0, 0, 0, 200);
|
|
|
|
evas_set_color(v->evas, v->selection.obj_l3, 0, 0, 0, 200);
|
|
|
|
evas_set_color(v->evas, v->selection.obj_l4, 0, 0, 0, 200);
|
|
|
|
evas_set_layer(v->evas, v->selection.obj_rect, 100);
|
|
|
|
evas_set_layer(v->evas, v->selection.obj_l1, 100);
|
|
|
|
evas_set_layer(v->evas, v->selection.obj_l2, 100);
|
|
|
|
evas_set_layer(v->evas, v->selection.obj_l3, 100);
|
|
|
|
evas_set_layer(v->evas, v->selection.obj_l4, 100);
|
|
|
|
}
|
|
|
|
e_view_update_selection(v, _x, _y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
|
|
|
|
{
|
|
|
|
Ev_Mouse_Up *ev;
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
ev = current_ev->event;
|
|
|
|
v = _data;
|
2001-03-24 18:47:41 -08:00
|
|
|
if (((v->selection.w < 6) && (v->selection.h < 6)) ||
|
|
|
|
(!v->selection.on))
|
2001-02-17 18:56:37 -08:00
|
|
|
{
|
|
|
|
if (_b == 1)
|
|
|
|
{
|
|
|
|
static E_Build_Menu *buildmenu = NULL;
|
|
|
|
|
|
|
|
if (!buildmenu)
|
|
|
|
{
|
|
|
|
char *apps_menu_db;
|
|
|
|
|
|
|
|
apps_menu_db = e_config_get("apps_menu");
|
|
|
|
if (apps_menu_db) buildmenu = e_build_menu_new_from_db(apps_menu_db);
|
|
|
|
}
|
|
|
|
if (buildmenu)
|
|
|
|
{
|
|
|
|
static E_Menu *menu = NULL;
|
|
|
|
menu = buildmenu->menu;
|
|
|
|
if (menu)
|
|
|
|
e_menu_show_at_mouse(menu, ev->rx, ev->ry, ev->time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (_b == 3)
|
|
|
|
{
|
2001-03-20 20:39:45 -08:00
|
|
|
static E_Build_Menu *buildmenu = NULL;
|
|
|
|
|
|
|
|
if (!buildmenu)
|
|
|
|
{
|
|
|
|
buildmenu = e_build_menu_new_from_gnome_apps("/usr/share/gnome/apps");
|
|
|
|
}
|
|
|
|
if (buildmenu)
|
|
|
|
{
|
|
|
|
static E_Menu *menu = NULL;
|
|
|
|
menu = buildmenu->menu;
|
|
|
|
if (menu)
|
|
|
|
e_menu_show_at_mouse(menu, ev->rx, ev->ry, ev->time);
|
|
|
|
}
|
|
|
|
/*
|
2001-02-17 18:56:37 -08:00
|
|
|
static E_Menu *menu = NULL;
|
|
|
|
|
|
|
|
if (!menu)
|
|
|
|
{
|
|
|
|
E_Menu_Item *menuitem;
|
|
|
|
|
|
|
|
menu = e_menu_new();
|
|
|
|
e_menu_set_padding_icon(menu, 8);
|
|
|
|
e_menu_set_padding_state(menu, 8);
|
|
|
|
menuitem = e_menu_item_new("Enlightenment "VERSION);
|
|
|
|
e_menu_item_set_icon(menuitem, PACKAGE_DATA_DIR"/data/images/e_logo.png");
|
|
|
|
e_menu_add_item(menu, menuitem);
|
|
|
|
}
|
|
|
|
if (menu)
|
|
|
|
e_menu_show_at_mouse(menu, ev->rx, ev->ry, ev->time);
|
2001-03-20 20:39:45 -08:00
|
|
|
*/
|
2001-02-17 18:56:37 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ev->button == 1)
|
|
|
|
{
|
|
|
|
v->selection.on = 0;
|
|
|
|
e_view_update_selection(v, _x, _y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-06 00:23:36 -08:00
|
|
|
static void
|
|
|
|
e_idle(void *data)
|
|
|
|
{
|
|
|
|
Evas_List l;
|
2001-02-12 10:58:51 -08:00
|
|
|
|
2001-02-06 00:23:36 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
2001-02-08 14:11:30 -08:00
|
|
|
e_view_update(v);
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
2001-02-08 14:11:30 -08:00
|
|
|
return;
|
|
|
|
UN(data);
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_wheel(Eevent * ev)
|
|
|
|
{
|
|
|
|
Ev_Wheel *e;
|
2001-02-08 14:11:30 -08:00
|
|
|
Evas_List l;
|
2001-02-06 00:23:36 -08:00
|
|
|
|
|
|
|
e = ev->event;
|
2001-02-08 14:11:30 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
2001-02-15 15:27:34 -08:00
|
|
|
v = l->data;
|
|
|
|
if (e->win == v->win.main)
|
|
|
|
{
|
|
|
|
e_view_scroll(v, 0, - (e->z * 10));
|
|
|
|
}
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_key_down(Eevent * ev)
|
|
|
|
{
|
|
|
|
Ev_Key_Down *e;
|
2001-02-08 14:11:30 -08:00
|
|
|
Evas_List l;
|
2001-02-06 00:23:36 -08:00
|
|
|
|
|
|
|
e = ev->event;
|
2001-02-08 14:11:30 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
if ((e->win == v->win.base) ||
|
|
|
|
(e->win == v->win.main))
|
|
|
|
{
|
2001-03-04 19:04:33 -08:00
|
|
|
/* FIXME: hack to test enty boxes */
|
|
|
|
if (entry) e_entry_handle_keypress(entry, e);
|
2001-02-08 14:11:30 -08:00
|
|
|
if (!strcmp(e->key, "Up"))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (!strcmp(e->key, "Down"))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (!strcmp(e->key, "Left"))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (!strcmp(e->key, "Right"))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (!strcmp(e->key, "Escape"))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char *type;
|
|
|
|
|
|
|
|
type = e_key_press_translate_into_typeable(e);
|
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2001-02-12 10:58:51 -08:00
|
|
|
return;
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
}
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_key_up(Eevent * ev)
|
|
|
|
{
|
|
|
|
Ev_Key_Up *e;
|
2001-02-08 14:11:30 -08:00
|
|
|
Evas_List l;
|
2001-02-06 00:23:36 -08:00
|
|
|
|
|
|
|
e = ev->event;
|
2001-02-12 10:58:51 -08:00
|
|
|
return;
|
2001-02-08 14:11:30 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
}
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_mouse_down(Eevent * ev)
|
|
|
|
{
|
|
|
|
Ev_Mouse_Down *e;
|
2001-02-08 14:11:30 -08:00
|
|
|
Evas_List l;
|
2001-02-06 00:23:36 -08:00
|
|
|
|
|
|
|
e = ev->event;
|
2001-02-17 18:56:37 -08:00
|
|
|
current_ev = ev;
|
2001-02-08 14:11:30 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
if (e->win == v->win.main)
|
|
|
|
{
|
|
|
|
evas_event_button_down(v->evas, e->x, e->y, e->button);
|
2001-02-17 18:56:37 -08:00
|
|
|
current_ev = NULL;
|
2001-02-12 10:58:51 -08:00
|
|
|
return;
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
}
|
2001-02-17 18:56:37 -08:00
|
|
|
current_ev = NULL;
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_mouse_up(Eevent * ev)
|
|
|
|
{
|
|
|
|
Ev_Mouse_Up *e;
|
2001-02-08 14:11:30 -08:00
|
|
|
Evas_List l;
|
2001-02-06 00:23:36 -08:00
|
|
|
|
|
|
|
e = ev->event;
|
2001-02-17 18:56:37 -08:00
|
|
|
current_ev = ev;
|
2001-02-08 14:11:30 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
if (e->win == v->win.main)
|
|
|
|
{
|
|
|
|
evas_event_button_up(v->evas, e->x, e->y, e->button);
|
2001-02-17 18:56:37 -08:00
|
|
|
current_ev = NULL;
|
|
|
|
return;
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
}
|
2001-02-17 18:56:37 -08:00
|
|
|
current_ev = NULL;
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_mouse_move(Eevent * ev)
|
|
|
|
{
|
|
|
|
Ev_Mouse_Move *e;
|
2001-02-08 14:11:30 -08:00
|
|
|
Evas_List l;
|
2001-02-06 00:23:36 -08:00
|
|
|
|
|
|
|
e = ev->event;
|
2001-02-08 14:11:30 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
if (e->win == v->win.main)
|
|
|
|
{
|
2001-02-12 10:58:51 -08:00
|
|
|
e_view_update_selection(v, e->x, e->y);
|
2001-02-08 14:11:30 -08:00
|
|
|
evas_event_move(v->evas, e->x, e->y);
|
2001-02-12 10:58:51 -08:00
|
|
|
return;
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
}
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_mouse_in(Eevent * ev)
|
|
|
|
{
|
|
|
|
Ev_Window_Enter *e;
|
2001-02-08 14:11:30 -08:00
|
|
|
Evas_List l;
|
2001-02-06 00:23:36 -08:00
|
|
|
|
|
|
|
e = ev->event;
|
2001-02-08 14:11:30 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
if (e->win == v->win.main)
|
|
|
|
{
|
2001-02-12 10:58:51 -08:00
|
|
|
/* FIXME: temporary for now- should only do this if its a deskop */
|
|
|
|
/* view and desktops accept focus on mouse. */
|
|
|
|
e_focus_to_window(e->win);
|
2001-02-08 14:11:30 -08:00
|
|
|
evas_event_enter(v->evas);
|
2001-02-12 10:58:51 -08:00
|
|
|
return;
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
}
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_mouse_out(Eevent * ev)
|
|
|
|
{
|
|
|
|
Ev_Window_Leave *e;
|
2001-02-08 14:11:30 -08:00
|
|
|
Evas_List l;
|
2001-02-06 00:23:36 -08:00
|
|
|
|
|
|
|
e = ev->event;
|
2001-02-08 14:11:30 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
if (e->win == v->win.main)
|
|
|
|
{
|
|
|
|
evas_event_leave(v->evas);
|
2001-02-12 10:58:51 -08:00
|
|
|
return;
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
}
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
e_window_expose(Eevent * ev)
|
|
|
|
{
|
|
|
|
Ev_Window_Expose *e;
|
2001-02-08 14:11:30 -08:00
|
|
|
Evas_List l;
|
2001-02-06 00:23:36 -08:00
|
|
|
|
|
|
|
e = ev->event;
|
2001-02-08 14:11:30 -08:00
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
if (e->win == v->win.main)
|
|
|
|
{
|
|
|
|
if (!(v->pmap))
|
2001-02-12 10:58:51 -08:00
|
|
|
evas_update_rect(v->evas, e->x, e->y, e->w, e->h);
|
|
|
|
v->changed = 1;
|
|
|
|
return;
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
}
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
2001-04-26 13:41:23 -07:00
|
|
|
static void
|
|
|
|
e_view_handle_fs_restart(void *data)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
Evas_List icons = NULL, l;
|
|
|
|
|
|
|
|
v = data;
|
|
|
|
|
|
|
|
printf("e_view_handle_fs_restart\n");
|
|
|
|
for (l = v->icons; l; l = l->next)
|
|
|
|
{
|
|
|
|
icons = evas_list_prepend(icons, l->data);
|
|
|
|
}
|
|
|
|
if (icons)
|
|
|
|
{
|
|
|
|
for (l = icons; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_Icon *i;
|
|
|
|
|
|
|
|
i = l->data;
|
|
|
|
e_view_file_deleted(v->monitor_id, i->file);
|
|
|
|
}
|
|
|
|
evas_list_free(icons);
|
|
|
|
}
|
|
|
|
if (e_fs_get_connection())
|
2001-06-18 20:40:51 -07:00
|
|
|
v->monitor_id = efsd_start_monitor_dir(e_fs_get_connection(), v->dir,
|
|
|
|
efsd_ops(2,
|
|
|
|
efsd_op_get_stat(),
|
|
|
|
efsd_op_get_filetype()
|
|
|
|
)
|
2001-04-26 13:41:23 -07:00
|
|
|
);
|
|
|
|
printf("restarted monior id (connection = %p), %i for %s\n", e_fs_get_connection(), v->monitor_id, v->dir);
|
|
|
|
v->is_listing = 1;
|
|
|
|
}
|
|
|
|
|
2001-03-31 15:50:22 -08:00
|
|
|
Eevent *
|
|
|
|
e_view_get_current_event(void)
|
|
|
|
{
|
|
|
|
return current_ev;
|
|
|
|
}
|
|
|
|
|
2001-02-12 10:58:51 -08:00
|
|
|
int
|
|
|
|
e_view_filter_file(E_View *v, char *file)
|
|
|
|
{
|
|
|
|
if (file[0] == '.') return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_view_update_selection(E_View *v, int x, int y)
|
|
|
|
{
|
|
|
|
if (v->selection.on)
|
|
|
|
{
|
|
|
|
if (x < v->selection.start_x)
|
|
|
|
{
|
|
|
|
v->selection.w = (-(x - v->selection.start_x)) + 1;
|
|
|
|
v->selection.x = x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
v->selection.w = (x - v->selection.start_x) + 1;
|
|
|
|
v->selection.x = v->selection.start_x;
|
|
|
|
}
|
|
|
|
if (y < v->selection.start_y)
|
|
|
|
{
|
|
|
|
v->selection.h = (-(y - v->selection.start_y)) + 1;
|
|
|
|
v->selection.y = y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
v->selection.h = (y - v->selection.start_y) + 1;
|
|
|
|
v->selection.y = v->selection.start_y;
|
|
|
|
}
|
|
|
|
evas_move(v->evas, v->selection.obj_rect, v->selection.x, v->selection.y);
|
|
|
|
evas_resize(v->evas, v->selection.obj_rect, v->selection.w, v->selection.h);
|
|
|
|
evas_set_line_xy(v->evas, v->selection.obj_l1, v->selection.x, v->selection.y, v->selection.x + v->selection.w - 1, v->selection.y);
|
|
|
|
evas_set_line_xy(v->evas, v->selection.obj_l2, v->selection.x, v->selection.y, v->selection.x, v->selection.y + v->selection.h - 1);
|
|
|
|
evas_set_line_xy(v->evas, v->selection.obj_l3, v->selection.x, v->selection.y + v->selection.h - 1, v->selection.x + v->selection.w - 1, v->selection.y + v->selection.h - 1);
|
|
|
|
evas_set_line_xy(v->evas, v->selection.obj_l4, v->selection.x + v->selection.w - 1, v->selection.y, v->selection.x + v->selection.w - 1, v->selection.y + v->selection.h - 1);
|
|
|
|
evas_show(v->evas, v->selection.obj_rect);
|
|
|
|
evas_show(v->evas, v->selection.obj_l1);
|
|
|
|
evas_show(v->evas, v->selection.obj_l2);
|
|
|
|
evas_show(v->evas, v->selection.obj_l3);
|
|
|
|
evas_show(v->evas, v->selection.obj_l4);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_hide(v->evas, v->selection.obj_rect);
|
|
|
|
evas_hide(v->evas, v->selection.obj_l1);
|
|
|
|
evas_hide(v->evas, v->selection.obj_l2);
|
|
|
|
evas_hide(v->evas, v->selection.obj_l3);
|
|
|
|
evas_hide(v->evas, v->selection.obj_l4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_view_file_added(int id, char *file)
|
|
|
|
{
|
|
|
|
E_Icon *icon;
|
|
|
|
E_View *v;
|
2001-03-24 18:47:41 -08:00
|
|
|
/* char *realfile; */
|
|
|
|
/* char buf[4096]; */
|
2001-02-12 10:58:51 -08:00
|
|
|
|
|
|
|
/* if we get a path - ignore it - its not a file in the a dir */
|
|
|
|
if (!file) return;
|
|
|
|
if (file[0] == '/') return;
|
|
|
|
v = e_view_find_by_monitor_id(id);
|
|
|
|
if (!v) return;
|
|
|
|
/* filter files here */
|
|
|
|
if (!e_view_filter_file(v, file)) return;
|
2001-03-25 13:37:09 -08:00
|
|
|
printf("e_view_file_added(%i, \"%s\");\n", id, file);
|
2001-02-12 10:58:51 -08:00
|
|
|
icon = e_icon_new();
|
2001-02-16 13:31:59 -08:00
|
|
|
e_icon_set_filename(icon, file);
|
2001-02-12 10:58:51 -08:00
|
|
|
e_view_add_icon(v, icon);
|
2001-03-22 16:47:25 -08:00
|
|
|
|
2001-02-12 10:58:51 -08:00
|
|
|
v->changed = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_view_file_deleted(int id, char *file)
|
|
|
|
{
|
|
|
|
E_Icon *icon;
|
|
|
|
E_View *v;
|
2001-03-24 18:47:41 -08:00
|
|
|
/* char *realfile; */
|
2001-02-12 10:58:51 -08:00
|
|
|
|
|
|
|
v = e_view_find_by_monitor_id(id);
|
|
|
|
if (!v) return;
|
2001-02-15 21:53:12 -08:00
|
|
|
icon = e_view_find_icon_by_file(v, file);
|
2001-04-26 13:41:23 -07:00
|
|
|
printf("%p %s\n", icon, file);
|
2001-03-25 13:37:09 -08:00
|
|
|
if (icon)
|
|
|
|
{
|
|
|
|
e_view_del_icon(v, icon);
|
|
|
|
printf("e_view_file_deleted(%i, \"%s\");\n", id, file);
|
|
|
|
}
|
2001-02-15 21:53:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
E_Icon *
|
|
|
|
e_view_find_icon_by_file(E_View *v, char *file)
|
|
|
|
{
|
|
|
|
Evas_List l;
|
|
|
|
|
|
|
|
for (l = v->icons; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_Icon *icon;
|
|
|
|
|
|
|
|
icon = l->data;
|
|
|
|
if (!strcmp(file, icon->file)) return icon;
|
|
|
|
}
|
|
|
|
return NULL;
|
2001-02-12 10:58:51 -08:00
|
|
|
}
|
|
|
|
|
2001-02-16 13:31:59 -08:00
|
|
|
E_Icon *
|
|
|
|
e_view_find_icon_by_path(char *path)
|
|
|
|
{
|
|
|
|
char *dir;
|
|
|
|
char *file;
|
|
|
|
Evas_List l;
|
|
|
|
|
|
|
|
dir = e_file_get_dir(path);
|
|
|
|
file = e_file_get_file(path);
|
|
|
|
|
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
Evas_List ll;
|
|
|
|
|
|
|
|
E_View *v;
|
|
|
|
v = l->data;
|
|
|
|
if (!strcmp(v->dir, dir))
|
|
|
|
{
|
|
|
|
for (ll = v->icons; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
E_Icon *icon;
|
|
|
|
|
|
|
|
icon = ll->data;
|
|
|
|
if (!strcmp(file, icon->file))
|
|
|
|
{
|
|
|
|
IF_FREE(dir);
|
|
|
|
IF_FREE(file);
|
|
|
|
return icon;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IF_FREE(dir);
|
|
|
|
IF_FREE(file);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-02-12 10:58:51 -08:00
|
|
|
static void
|
|
|
|
e_view_handle_fs(EfsdEvent *ev)
|
|
|
|
{
|
|
|
|
switch (ev->type)
|
|
|
|
{
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_EVENT_FILECHANGE:
|
|
|
|
switch (ev->efsd_filechange_event.changetype)
|
2001-02-12 10:58:51 -08:00
|
|
|
{
|
2001-06-18 20:40:51 -07:00
|
|
|
case EFSD_FILE_CREATED:
|
2001-06-27 16:06:28 -07:00
|
|
|
e_view_file_added(efsd_reply_id(ev), efsd_reply_filename(ev));
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-06-18 20:40:51 -07:00
|
|
|
case EFSD_FILE_EXISTS:
|
2001-06-27 16:06:28 -07:00
|
|
|
e_view_file_added(efsd_reply_id(ev), efsd_reply_filename(ev));
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-06-18 20:40:51 -07:00
|
|
|
case EFSD_FILE_DELETED:
|
2001-06-27 16:06:28 -07:00
|
|
|
e_view_file_deleted(efsd_reply_id(ev), efsd_reply_filename(ev));
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-06-18 20:40:51 -07:00
|
|
|
case EFSD_FILE_CHANGED:
|
2001-03-25 13:37:09 -08:00
|
|
|
/* printf("EFSD_CHANGE_CHANGED: %i %s\n",
|
2001-02-12 10:58:51 -08:00
|
|
|
ev->efsd_filechange_event.id,
|
|
|
|
ev->efsd_filechange_event.file);
|
2001-03-25 13:37:09 -08:00
|
|
|
*/ break;
|
2001-06-18 20:40:51 -07:00
|
|
|
case EFSD_FILE_MOVED:
|
2001-03-25 13:37:09 -08:00
|
|
|
/* printf("EFSD_CHANGE_MOVED: %i %s\n",
|
2001-02-12 10:58:51 -08:00
|
|
|
ev->efsd_filechange_event.id,
|
|
|
|
ev->efsd_filechange_event.file);
|
2001-03-25 13:37:09 -08:00
|
|
|
*/ break;
|
2001-06-18 20:40:51 -07:00
|
|
|
case EFSD_FILE_END_EXISTS:
|
2001-04-26 13:41:23 -07:00
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
2001-06-27 16:06:28 -07:00
|
|
|
v = e_view_find_by_monitor_id(efsd_reply_id(ev));
|
2001-04-26 13:41:23 -07:00
|
|
|
if (v) v->is_listing = 0;
|
|
|
|
printf("EFSD_CHANGE_END_EXISTS: %i %s\n",
|
2001-06-27 16:06:28 -07:00
|
|
|
efsd_reply_id(ev), efsd_reply_filename(ev));
|
2001-04-26 13:41:23 -07:00
|
|
|
}
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_EVENT_REPLY:
|
2001-02-12 10:58:51 -08:00
|
|
|
switch (ev->efsd_reply_event.command.type)
|
|
|
|
{
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_REMOVE:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_MOVE:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_SYMLINK:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_LISTDIR:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_MAKEDIR:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_CHMOD:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-04-02 17:23:01 -07:00
|
|
|
case EFSD_CMD_GETFILETYPE:
|
2001-03-25 13:37:09 -08:00
|
|
|
/* printf("Getmime event %i\n",
|
|
|
|
ev->efsd_reply_event.command.efsd_file_cmd.id);
|
|
|
|
*/ if (ev->efsd_reply_event.status == SUCCESS)
|
|
|
|
{
|
|
|
|
E_Icon *icon;
|
|
|
|
|
2001-06-27 16:06:28 -07:00
|
|
|
icon = e_view_find_icon_by_path(efsd_reply_filename(ev));
|
2001-03-25 13:37:09 -08:00
|
|
|
if (icon)
|
|
|
|
{
|
|
|
|
/* figure out icons to use */
|
2001-03-31 15:50:22 -08:00
|
|
|
e_icon_apply_mime(icon, (char*)ev->efsd_reply_event.data);
|
|
|
|
e_icon_get_icon(icon);
|
|
|
|
e_icon_pre_show(icon);
|
2001-03-25 13:37:09 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_STAT:
|
2001-03-25 13:37:09 -08:00
|
|
|
/* printf("Stat event %i stating file %s\n",
|
2001-02-16 13:31:59 -08:00
|
|
|
ev->efsd_reply_event.command.efsd_file_cmd.id,
|
|
|
|
ev->efsd_reply_event.command.efsd_file_cmd.file);
|
2001-03-25 13:37:09 -08:00
|
|
|
*/ {
|
2001-02-16 13:31:59 -08:00
|
|
|
struct stat *st;
|
|
|
|
E_Icon *icon;
|
|
|
|
|
|
|
|
st = (struct stat*) ev->efsd_reply_event.data;
|
|
|
|
|
2001-06-27 16:06:28 -07:00
|
|
|
icon = e_view_find_icon_by_path(efsd_reply_filename(ev));
|
2001-03-25 13:37:09 -08:00
|
|
|
if (icon)
|
|
|
|
{
|
|
|
|
char f[4096];
|
|
|
|
|
|
|
|
/*
|
2001-02-16 13:31:59 -08:00
|
|
|
if (S_ISREG(st->st_mode))
|
|
|
|
printf("%s is a regular file.\n",
|
|
|
|
ev->efsd_reply_event.command.efsd_file_cmd.file);
|
|
|
|
if (S_ISLNK(st->st_mode))
|
|
|
|
printf("%s is a symlink.\n",
|
|
|
|
ev->efsd_reply_event.command.efsd_file_cmd.file);
|
|
|
|
if (S_ISDIR(st->st_mode))
|
|
|
|
printf("%s is a directory.\n",
|
|
|
|
ev->efsd_reply_event.command.efsd_file_cmd.file);
|
2001-03-25 13:37:09 -08:00
|
|
|
*/ sprintf(f, "%s/%s", icon->view->dir, icon->file);
|
2001-02-19 11:45:24 -08:00
|
|
|
/* should get mime type here */
|
|
|
|
/* perhaps this flag should be part of the mime? */
|
|
|
|
if (S_ISDIR(st->st_mode)) icon->info.is_dir = 1;
|
|
|
|
/* this should be able to be returned by efsd */
|
2001-02-26 14:59:54 -08:00
|
|
|
if (S_ISLNK(st->st_mode))
|
|
|
|
{
|
|
|
|
icon->info.link_get_id =
|
|
|
|
efsd_readlink(e_fs_get_connection(), f);
|
|
|
|
}
|
2001-03-31 15:50:22 -08:00
|
|
|
if ((!icon->info.link_get_id) && (!icon->info.is_dir))
|
|
|
|
icon->info.is_exe = e_file_can_exec(st);
|
2001-02-19 11:45:24 -08:00
|
|
|
icon->changed = 1;
|
2001-02-20 10:32:09 -08:00
|
|
|
icon->view->changed = 1;
|
2001-03-25 13:37:09 -08:00
|
|
|
/* if (!icon->info.link_get_id)
|
|
|
|
e_icon_pre_show(icon);*/
|
2001-02-16 13:31:59 -08:00
|
|
|
}
|
|
|
|
}
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-02-20 10:32:09 -08:00
|
|
|
case EFSD_CMD_READLINK:
|
|
|
|
if (ev->efsd_reply_event.status == SUCCESS)
|
|
|
|
{
|
2001-02-26 14:59:54 -08:00
|
|
|
Evas_List l;
|
|
|
|
|
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
Evas_List ll;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
for (ll = v->icons; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
E_Icon *icon;
|
|
|
|
|
|
|
|
icon = ll->data;
|
|
|
|
|
2001-06-27 16:06:28 -07:00
|
|
|
if (icon->info.link_get_id == efsd_reply_id(ev))
|
2001-02-26 14:59:54 -08:00
|
|
|
{
|
|
|
|
IF_FREE(icon->info.link);
|
|
|
|
icon->info.link = malloc(ev->efsd_reply_event.data_len + 1);
|
|
|
|
memcpy(icon->info.link, (char*)ev->efsd_reply_event.data, ev->efsd_reply_event.data_len);
|
|
|
|
icon->info.link[ev->efsd_reply_event.data_len] = 0;
|
|
|
|
icon->info.link_get_id = 0;
|
2001-03-15 17:14:42 -08:00
|
|
|
if (!icon->info.link_get_id)
|
|
|
|
e_icon_pre_show(icon);
|
2001-02-26 14:59:54 -08:00
|
|
|
icon->changed = 1;
|
|
|
|
icon->view->changed = 1;
|
|
|
|
printf("link_to = %s\n", icon->info.link);
|
|
|
|
goto done_readlink;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
done_readlink:
|
2001-02-20 10:32:09 -08:00
|
|
|
}
|
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_CLOSE:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_SETMETA:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_GETMETA:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-06-18 20:40:51 -07:00
|
|
|
case EFSD_CMD_STARTMON_DIR:
|
2001-06-27 16:06:28 -07:00
|
|
|
printf("Startmon event %i\n", efsd_reply_id(ev));
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
2001-06-18 20:40:51 -07:00
|
|
|
case EFSD_CMD_STARTMON_FILE:
|
2001-06-27 16:06:28 -07:00
|
|
|
printf("Startmon file event %i\n", efsd_reply_id(ev));
|
2001-06-18 20:40:51 -07:00
|
|
|
break;
|
2001-02-20 10:07:58 -08:00
|
|
|
case EFSD_CMD_STOPMON:
|
2001-02-12 10:58:51 -08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
E_View *
|
|
|
|
e_view_find_by_monitor_id(int id)
|
|
|
|
{
|
|
|
|
Evas_List l;
|
|
|
|
|
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = l->data;
|
|
|
|
if (v->monitor_id == id) return v;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-12-27 14:42:59 -08:00
|
|
|
void
|
|
|
|
e_view_free(E_View *v)
|
|
|
|
{
|
|
|
|
views = evas_list_remove(views, v);
|
2001-04-26 13:41:23 -07:00
|
|
|
if (v->restarter)
|
|
|
|
e_fs_del_restart_handler(v->restarter);
|
|
|
|
v->restarter = NULL;
|
2000-12-27 14:42:59 -08:00
|
|
|
FREE(v);
|
|
|
|
}
|
|
|
|
|
2000-12-18 13:28:44 -08:00
|
|
|
E_View *
|
|
|
|
e_view_new(void)
|
|
|
|
{
|
|
|
|
E_View *v;
|
|
|
|
|
|
|
|
v = NEW(E_View, 1);
|
|
|
|
ZERO(v, E_View, 1);
|
2000-12-27 14:42:59 -08:00
|
|
|
OBJ_INIT(v, e_view_free);
|
2001-03-04 19:04:33 -08:00
|
|
|
#define SOFT_DESK
|
2001-02-19 11:45:24 -08:00
|
|
|
/* #define X_DESK */
|
2001-03-04 19:04:33 -08:00
|
|
|
/* #define GL_DESK */
|
2001-02-19 11:45:24 -08:00
|
|
|
|
|
|
|
#ifdef SOFT_DESK
|
2001-02-12 10:58:51 -08:00
|
|
|
/* ONLY alpha software can be "backing stored" */
|
2001-02-08 14:11:30 -08:00
|
|
|
v->options.render_method = RENDER_METHOD_ALPHA_SOFTWARE;
|
|
|
|
v->options.back_pixmap = 1;
|
2001-02-12 10:58:51 -08:00
|
|
|
#else
|
2001-02-19 11:45:24 -08:00
|
|
|
#ifdef X_DESK
|
2001-02-12 10:58:51 -08:00
|
|
|
v->options.render_method = RENDER_METHOD_BASIC_HARDWARE;
|
|
|
|
v->options.back_pixmap = 0;
|
2001-02-19 11:45:24 -08:00
|
|
|
#else
|
|
|
|
v->options.render_method = RENDER_METHOD_3D_HARDWARE;
|
|
|
|
v->options.back_pixmap = 0;
|
|
|
|
#endif
|
2001-02-12 10:58:51 -08:00
|
|
|
#endif
|
2001-03-31 15:50:22 -08:00
|
|
|
{
|
|
|
|
Ebits_Object obj;
|
|
|
|
int pl, pr, pt, pb;
|
|
|
|
|
|
|
|
pl = pr = pt = pb = 0;
|
|
|
|
v->spacing.inset.left = 2;
|
|
|
|
v->spacing.inset.right = 2;
|
|
|
|
v->spacing.inset.top = 2;
|
|
|
|
v->spacing.inset.bottom = 2;
|
|
|
|
obj = ebits_load(PACKAGE_DATA_DIR"/data/config/appearance/default/selections/file.bits.db");
|
|
|
|
if (obj)
|
|
|
|
{
|
|
|
|
ebits_get_insets(obj, &pl, &pr, &pt, &pb);
|
|
|
|
ebits_free(obj);
|
|
|
|
}
|
|
|
|
v->spacing.icon.left = pl;
|
|
|
|
v->spacing.icon.right = pr;
|
|
|
|
v->spacing.icon.top = pt;
|
|
|
|
v->spacing.icon.bottom = pb;
|
|
|
|
v->spacing.spacing.left = 1;
|
|
|
|
v->spacing.spacing.right = 1;
|
|
|
|
v->spacing.spacing.top = 1;
|
|
|
|
v->spacing.spacing.bottom = 1;
|
|
|
|
}
|
2001-02-08 14:11:30 -08:00
|
|
|
views = evas_list_append(views, v);
|
2001-03-15 17:14:42 -08:00
|
|
|
|
|
|
|
/*
|
2001-02-17 18:56:37 -08:00
|
|
|
{
|
|
|
|
E_Shelf *sh;
|
|
|
|
|
|
|
|
sh = e_shelf_new();
|
|
|
|
e_shelf_set_name(sh, "Test Shelf");
|
|
|
|
e_shelf_set_view(sh, v);
|
|
|
|
e_shelf_show(sh);
|
|
|
|
e_shelf_move(sh, 10, 10);
|
2001-02-19 17:19:27 -08:00
|
|
|
e_shelf_resize(sh, 500, 350);
|
2001-02-17 18:56:37 -08:00
|
|
|
v->shelves = evas_list_append(v->shelves, sh);
|
|
|
|
}
|
2001-03-15 17:14:42 -08:00
|
|
|
*/
|
2000-12-27 14:42:59 -08:00
|
|
|
return v;
|
2000-12-18 13:28:44 -08:00
|
|
|
}
|
|
|
|
|
2001-02-06 00:23:36 -08:00
|
|
|
void
|
2001-02-08 14:11:30 -08:00
|
|
|
e_view_set_background(E_View *v)
|
|
|
|
{
|
2001-02-09 00:13:16 -08:00
|
|
|
v->changed = 1;
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_view_set_dir(E_View *v, char *dir)
|
2001-02-09 00:13:16 -08:00
|
|
|
{
|
|
|
|
/* stop monitoring old dir */
|
2001-02-12 10:58:51 -08:00
|
|
|
IF_FREE(v->dir);
|
|
|
|
v->dir = e_file_real(dir);
|
2001-02-09 00:13:16 -08:00
|
|
|
/* start monitoring new dir */
|
2001-03-22 16:47:25 -08:00
|
|
|
|
2001-04-26 13:41:23 -07:00
|
|
|
v->restarter = e_fs_add_restart_handler(e_view_handle_fs_restart, v);
|
|
|
|
if (e_fs_get_connection())
|
|
|
|
{
|
2001-06-18 20:40:51 -07:00
|
|
|
v->monitor_id = efsd_start_monitor_dir(e_fs_get_connection(), v->dir,
|
|
|
|
efsd_ops(2,
|
|
|
|
efsd_op_get_stat(),
|
|
|
|
efsd_op_get_filetype()
|
|
|
|
)
|
|
|
|
);
|
2001-04-26 13:41:23 -07:00
|
|
|
v->is_listing = 1;
|
|
|
|
v->changed = 1;
|
|
|
|
}
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_view_scroll(E_View *v, int dx, int dy)
|
2001-02-06 00:23:36 -08:00
|
|
|
{
|
2001-02-15 15:27:34 -08:00
|
|
|
Evas_List l;
|
|
|
|
|
2001-03-31 15:50:22 -08:00
|
|
|
v->viewport.x -= dx;
|
|
|
|
v->viewport.y -= dy;
|
2001-02-15 15:27:34 -08:00
|
|
|
for (l = v->icons; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_Icon *icon;
|
2001-02-16 13:31:59 -08:00
|
|
|
int x, y;
|
2001-02-15 15:27:34 -08:00
|
|
|
|
|
|
|
icon = l->data;
|
2001-02-16 13:31:59 -08:00
|
|
|
e_icon_get_xy(icon, &x, &y);
|
|
|
|
e_icon_set_xy(icon, x + dx, y + dy);
|
2001-02-15 15:27:34 -08:00
|
|
|
}
|
2001-02-09 00:13:16 -08:00
|
|
|
v->changed = 1;
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
2001-03-31 15:50:22 -08:00
|
|
|
void
|
|
|
|
e_view_scroll_to(E_View *v, int x, int y)
|
|
|
|
{
|
|
|
|
e_view_scroll(v, v->viewport.x - x, v->viewport.y - y);
|
|
|
|
}
|
|
|
|
|
2001-02-06 00:23:36 -08:00
|
|
|
void
|
2001-02-08 14:11:30 -08:00
|
|
|
e_view_add_icon(E_View *v, E_Icon *icon)
|
2001-02-06 00:23:36 -08:00
|
|
|
{
|
2001-02-09 00:13:16 -08:00
|
|
|
if (icon->view) return;
|
|
|
|
icon->view = v;
|
2001-02-12 10:58:51 -08:00
|
|
|
e_icon_realize(icon);
|
2001-02-08 14:11:30 -08:00
|
|
|
v->changed = 1;
|
2001-02-15 15:27:34 -08:00
|
|
|
v->icons = evas_list_append(v->icons, icon);
|
2001-03-15 17:14:42 -08:00
|
|
|
/* e_shelf_add_icon(v->shelves->data, icon); */
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_view_del_icon(E_View *v, E_Icon *icon)
|
|
|
|
{
|
2001-02-09 00:13:16 -08:00
|
|
|
if (!icon->view) return;
|
2001-03-15 17:14:42 -08:00
|
|
|
/* e_shelf_del_icon(v->shelves->data, icon); */
|
2001-02-12 10:58:51 -08:00
|
|
|
e_icon_unrealize(icon);
|
2001-02-15 21:53:12 -08:00
|
|
|
OBJ_UNREF(icon);
|
2001-02-09 00:13:16 -08:00
|
|
|
icon->view = NULL;
|
|
|
|
icon->changed = 1;
|
2001-02-08 14:11:30 -08:00
|
|
|
v->changed = 1;
|
2001-02-15 15:27:34 -08:00
|
|
|
v->icons = evas_list_remove(v->icons, icon);
|
2001-02-08 14:11:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_view_realize(E_View *v)
|
|
|
|
{
|
|
|
|
int max_colors = 216;
|
|
|
|
int font_cache = 1024 * 1024;
|
|
|
|
int image_cache = 8192 * 1024;
|
|
|
|
char *font_dir;
|
|
|
|
|
|
|
|
if (v->evas) return;
|
|
|
|
v->win.base = e_window_override_new(0,
|
|
|
|
v->location.x, v->location.y,
|
|
|
|
v->size.w, v->size.h);
|
|
|
|
font_dir = e_config_get("fonts");
|
|
|
|
v->evas = evas_new_all(e_display_get(),
|
|
|
|
v->win.base,
|
|
|
|
0, 0, v->size.w, v->size.h,
|
|
|
|
v->options.render_method,
|
|
|
|
max_colors,
|
|
|
|
font_cache,
|
|
|
|
image_cache,
|
|
|
|
font_dir);
|
|
|
|
v->win.main = evas_get_window(v->evas);
|
2001-03-15 17:14:42 -08:00
|
|
|
evas_event_move(v->evas, -999999, -999999);
|
2001-02-08 14:11:30 -08:00
|
|
|
e_add_child(v->win.base, v->win.main);
|
|
|
|
if (v->options.back_pixmap)
|
|
|
|
{
|
|
|
|
v->pmap = e_pixmap_new(v->win.main, v->size.w, v->size.h, 0);
|
|
|
|
evas_set_output(v->evas, e_display_get(), v->pmap,
|
|
|
|
evas_get_visual(v->evas),
|
|
|
|
evas_get_colormap(v->evas));
|
|
|
|
e_window_set_background_pixmap(v->win.main, v->pmap);
|
|
|
|
}
|
2001-02-12 10:58:51 -08:00
|
|
|
if (v->bg)
|
|
|
|
{
|
|
|
|
v->bg->geom.w = v->size.w;
|
|
|
|
v->bg->geom.h = v->size.h;
|
|
|
|
e_background_realize(v->bg, v->evas);
|
|
|
|
}
|
2001-02-17 18:56:37 -08:00
|
|
|
v->obj_bg = evas_add_rectangle(v->evas);
|
|
|
|
evas_callback_add(v->evas, v->obj_bg, CALLBACK_MOUSE_DOWN, e_bg_down_cb, v);
|
|
|
|
evas_callback_add(v->evas, v->obj_bg, CALLBACK_MOUSE_UP, e_bg_up_cb, v);
|
|
|
|
evas_set_layer(v->evas, v->obj_bg, 1);
|
|
|
|
evas_move(v->evas, v->obj_bg, 0, 0);
|
|
|
|
evas_resize(v->evas, v->obj_bg, 999999, 999999);
|
|
|
|
evas_set_color(v->evas, v->obj_bg, 0, 0, 0, 0);
|
|
|
|
evas_show(v->evas, v->obj_bg);
|
|
|
|
|
2001-02-08 14:11:30 -08:00
|
|
|
e_window_set_events(v->win.main,
|
|
|
|
XEV_EXPOSE | XEV_MOUSE_MOVE |
|
|
|
|
XEV_BUTTON | XEV_IN_OUT | XEV_KEY);
|
|
|
|
e_window_show(v->win.main);
|
2001-02-12 10:58:51 -08:00
|
|
|
{
|
|
|
|
char *dir;
|
|
|
|
|
|
|
|
dir = v->dir;
|
|
|
|
v->dir = NULL;
|
|
|
|
e_view_set_dir(v, dir);
|
|
|
|
IF_FREE(dir);
|
|
|
|
}
|
2001-02-17 18:56:37 -08:00
|
|
|
|
|
|
|
if (v->shelves)
|
|
|
|
{
|
|
|
|
Evas_List l;
|
|
|
|
|
|
|
|
for (l = v->shelves; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_Shelf *sh;
|
|
|
|
|
|
|
|
sh = l->data;
|
|
|
|
e_shelf_realize(sh);
|
|
|
|
}
|
|
|
|
}
|
2001-03-04 19:04:33 -08:00
|
|
|
|
|
|
|
/* FIXME: hack to test entry boxes */
|
2001-04-26 13:41:23 -07:00
|
|
|
/*
|
2001-03-04 19:04:33 -08:00
|
|
|
{
|
|
|
|
entry = e_entry_new();
|
|
|
|
e_entry_set_evas(entry, v->evas);
|
|
|
|
e_entry_set_layer(entry, 100);
|
|
|
|
e_entry_move(entry, 100, 100);
|
|
|
|
e_entry_resize(entry, 100, 24);
|
|
|
|
e_entry_set_focus(entry, 1);
|
|
|
|
e_entry_show(entry);
|
2001-03-07 00:18:39 -08:00
|
|
|
e_entry_set_text(entry, "Some Test Entry Text... Play with me!");
|
|
|
|
{
|
|
|
|
int ew, eh;
|
|
|
|
|
|
|
|
e_entry_query_max_size(entry, &ew, &eh);
|
|
|
|
e_entry_resize(entry, ew, eh);
|
|
|
|
}
|
2001-03-04 19:04:33 -08:00
|
|
|
}
|
2001-04-26 13:41:23 -07:00
|
|
|
*/
|
2001-02-08 14:11:30 -08:00
|
|
|
v->changed = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_view_unrealize(E_View *v)
|
|
|
|
{
|
|
|
|
if (!v->evas) return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_view_update(E_View *v)
|
|
|
|
{
|
2001-02-15 15:27:34 -08:00
|
|
|
Evas_List l;
|
|
|
|
|
2001-02-17 18:56:37 -08:00
|
|
|
if (v->changed)
|
2001-02-15 15:27:34 -08:00
|
|
|
{
|
2001-02-17 18:56:37 -08:00
|
|
|
for (l = v->icons; l; l = l->next)
|
|
|
|
{
|
|
|
|
E_Icon *icon;
|
|
|
|
|
|
|
|
icon = l->data;
|
|
|
|
e_icon_update(icon);
|
|
|
|
}
|
2001-02-15 15:27:34 -08:00
|
|
|
}
|
2001-02-08 14:11:30 -08:00
|
|
|
if (v->options.back_pixmap)
|
|
|
|
{
|
|
|
|
Imlib_Updates up;
|
|
|
|
|
|
|
|
up = evas_render_updates(v->evas);
|
|
|
|
if (up)
|
|
|
|
{
|
|
|
|
Imlib_Updates u;
|
|
|
|
|
|
|
|
for (u = up; u; u = imlib_updates_get_next(u))
|
|
|
|
{
|
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
imlib_updates_get_coordinates(u, &x, &y, &w, &h);
|
|
|
|
e_window_clear_area(v->win.main, x, y, w, h);
|
|
|
|
}
|
|
|
|
imlib_updates_free(up);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_render(v->evas);
|
2001-02-17 18:56:37 -08:00
|
|
|
v->changed = 0;
|
2001-02-06 00:23:36 -08:00
|
|
|
}
|
|
|
|
|
2000-12-18 13:28:44 -08:00
|
|
|
void
|
|
|
|
e_view_init(void)
|
|
|
|
{
|
2001-02-06 00:23:36 -08:00
|
|
|
e_event_filter_handler_add(EV_MOUSE_DOWN, e_mouse_down);
|
|
|
|
e_event_filter_handler_add(EV_MOUSE_UP, e_mouse_up);
|
|
|
|
e_event_filter_handler_add(EV_MOUSE_MOVE, e_mouse_move);
|
|
|
|
e_event_filter_handler_add(EV_MOUSE_IN, e_mouse_in);
|
|
|
|
e_event_filter_handler_add(EV_MOUSE_OUT, e_mouse_out);
|
|
|
|
e_event_filter_handler_add(EV_WINDOW_EXPOSE, e_window_expose);
|
|
|
|
e_event_filter_handler_add(EV_KEY_DOWN, e_key_down);
|
|
|
|
e_event_filter_handler_add(EV_KEY_UP, e_key_up);
|
|
|
|
e_event_filter_handler_add(EV_MOUSE_WHEEL, e_wheel);
|
|
|
|
e_event_filter_idle_handler_add(e_idle, NULL);
|
2001-02-12 10:58:51 -08:00
|
|
|
e_fs_add_event_handler(e_view_handle_fs);
|
2000-12-18 13:28:44 -08:00
|
|
|
}
|