working on views, and icons.
authorCarsten Haitzler <raster@rasterman.com>
Thu, 8 Feb 2001 22:11:30 +0000 (22:11 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Thu, 8 Feb 2001 22:11:30 +0000 (22:11 +0000)
SVN revision: 4176

src/Makefile.am
src/e.h
src/icons.c [new file with mode: 0644]
src/view.c

index fb95cac..4db137e 100644 (file)
@@ -13,6 +13,7 @@ config.c \
 desktops.c \
 exec.c \
 icccm.c \
+icons.c \
 main.c \
 menu.c \
 menudb.c \
diff --git a/src/e.h b/src/e.h
index ee8f3ea..ddff0f0 100644 (file)
--- a/src/e.h
+++ b/src/e.h
@@ -130,6 +130,7 @@ typedef struct _E_Desktop             E_Desktop;
 typedef struct _E_Rect                E_Rect;
 typedef struct _E_Active_Action_Timer E_Active_Action_Timer;
 typedef struct _E_View                E_View;
+typedef struct _E_Icon                E_Icon;
 typedef struct _E_Menu                E_Menu;
 typedef struct _E_Menu_Item           E_Menu_Item;
 typedef struct _E_Build_Menu          E_Build_Menu;
@@ -323,8 +324,22 @@ struct _E_View
    struct {
       int                 x, y;
    } location;
+   struct {
+      int                 on;
+      int                 x, y, w, h;
+   } selection;
    
    Evas_List              icons;
+   
+   int                    changed;
+};
+
+struct _E_Icon
+{
+   OBJ_PROPERTIES;
+   
+   E_View *view;
+   int     changed;
 };
 
 struct _E_Menu
diff --git a/src/icons.c b/src/icons.c
new file mode 100644 (file)
index 0000000..1396812
--- /dev/null
@@ -0,0 +1,17 @@
+#include "e.h"
+
+void
+e_icon_free(E_Icon *icon)
+{
+}
+
+E_Icon *
+e_icon_new(void)
+{
+   E_Icon *icon;
+
+   icon = NEW(E_Icon, 1);
+   ZERO(icon, E_Icon, 1);
+   OBJ_INIT(icon, e_icon_free);
+   return icon;
+}
index 5630eea..b495d2f 100644 (file)
@@ -23,80 +23,198 @@ e_idle(void *data)
        E_View *v;
        
        v = l->data;
-       evas_render(v->evas);
+       e_view_update(v);
      }
+   return;
+   UN(data);
 }
 
 static void 
 e_wheel(Eevent * ev)
 {
    Ev_Wheel           *e;
+   Evas_List l;
    
    e = ev->event;
+   for (l = views; l; l = l->next)
+     {
+       E_View *v;
+       
+       v = l->data;    
+     }
 }
 
 static void
 e_key_down(Eevent * ev)
 {
    Ev_Key_Down          *e;
+   Evas_List l;
    
    e = ev->event;
+   for (l = views; l; l = l->next)
+     {
+       E_View *v;
+       
+       v = l->data;    
+       if ((e->win == v->win.base) ||
+           (e->win == v->win.main))
+         {
+            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)
+                   {
+                   }
+              }
+         }
+     }
 }
 
 static void
 e_key_up(Eevent * ev)
 {
    Ev_Key_Up          *e;
+   Evas_List l;
    
    e = ev->event;
+   for (l = views; l; l = l->next)
+     {
+       E_View *v;
+       
+       v = l->data;
+     }
 }
 
 static void
 e_mouse_down(Eevent * ev)
 {
    Ev_Mouse_Down          *e;
+   Evas_List l;
    
    e = ev->event;
+   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);
+         }
+     }
 }
 
 static void
 e_mouse_up(Eevent * ev)
 {
    Ev_Mouse_Up          *e;
+   Evas_List l;
    
    e = ev->event;
+   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);
+         }
+     }
 }
 
 static void
 e_mouse_move(Eevent * ev)
 {
    Ev_Mouse_Move          *e;
+   Evas_List l;
    
    e = ev->event;
+   for (l = views; l; l = l->next)
+     {
+       E_View *v;
+       
+       v = l->data;
+       if (e->win == v->win.main)
+         {
+            evas_event_move(v->evas, e->x, e->y);
+         }
+     }
 }
 
 static void
 e_mouse_in(Eevent * ev)
 {
    Ev_Window_Enter          *e;
+   Evas_List l;
    
    e = ev->event;
+   for (l = views; l; l = l->next)
+     {
+       E_View *v;
+       
+       v = l->data;
+       if (e->win == v->win.main)
+         {
+            evas_event_enter(v->evas);
+         }
+     }
 }
 
 static void
 e_mouse_out(Eevent * ev)
 {
    Ev_Window_Leave          *e;
+   Evas_List l;
    
    e = ev->event;
+   for (l = views; l; l = l->next)
+     {
+       E_View *v;
+       
+       v = l->data;
+       if (e->win == v->win.main)
+         {
+            evas_event_leave(v->evas);
+         }
+     }
 }
 
 static void
 e_window_expose(Eevent * ev)
 {
    Ev_Window_Expose          *e;
+   Evas_List l;
    
    e = ev->event;
+   for (l = views; l; l = l->next)
+     {
+       E_View *v;
+       
+       v = l->data;
+       if (e->win == v->win.main)
+         {
+            if (!(v->pmap))
+              evas_update_rect(v->evas, e->x, e->y, e->w, e->h);       
+         }
+     }
 }
 
 void
@@ -115,20 +233,111 @@ e_view_new(void)
    ZERO(v, E_View, 1);
    OBJ_INIT(v, e_view_free);
    
+   v->options.render_method = RENDER_METHOD_ALPHA_SOFTWARE;
+   v->options.back_pixmap = 1;
    
-   
-   views = evas_list_append(views, v);  
+   views = evas_list_append(views, v);
    return v;   
 }
 
 void
-e_view_realize(void)
+e_view_set_background(E_View *v)
+{
+}
+
+void
+e_view_set_dir(E_View *v, char *dir)
+{ 
+}
+
+void
+e_view_scroll(E_View *v, int dx, int dy)
 {
 }
 
 void
-e_view_unrealize(void)
+e_view_add_icon(E_View *v, E_Icon *icon)
 {
+   v->changed = 1;
+}
+
+void
+e_view_del_icon(E_View *v, E_Icon *icon)
+{
+   v->changed = 1;
+}
+
+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);
+   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);
+     }
+   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);
+   v->changed = 1;
+}
+
+void
+e_view_unrealize(E_View *v)
+{
+   if (!v->evas) return;
+}
+
+void
+e_view_update(E_View *v)
+{
+   if (!v->changed) return;
+   
+   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);
+   v->changed = 0;
 }
 
 void