Enlightenment CVS committal
Author : rephorm
Project : e17
Module : apps/iconbar
Dir : e17/apps/iconbar/src
Modified Files:
Makefile.am iconbar.c iconbar.h main.c
Added Files:
icon.c icon.h icon_editor.c icon_editor.h iconbar_smart.c
Log Message:
move some stuff to separate files to make things a bit more managable.
start an icon editor.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/iconbar/src/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- Makefile.am 17 Jan 2004 17:29:41 -0000 1.2
+++ Makefile.am 20 Feb 2004 03:23:49 -0000 1.3
@@ -5,14 +5,18 @@
@evas_cflags@ \
@edje_cflags@ \
@ecore_cflags@ \
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@ \
[EMAIL PROTECTED]@
bin_PROGRAMS = iconbar
iconbar_SOURCES = \
iconbar.c iconbar.h \
+iconbar_smart.c \
+icon.c icon.h \
util.c util.h \
prefs.c prefs.h \
+icon_editor.c icon_editor.h \
main.c
iconbar_LDADD = \
@@ -20,6 +24,8 @@
@evas_libs@ \
@edje_libs@ \
@ecore_libs@ \
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@ \
[EMAIL PROTECTED]@ \
+-ledje_edit
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/iconbar/src/iconbar.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- iconbar.c 20 Jan 2004 06:20:40 -0000 1.14
+++ iconbar.c 20 Feb 2004 03:23:49 -0000 1.15
@@ -1,42 +1,20 @@
#include "iconbar.h"
+#include "icon.h"
#include "util.h"
#include <math.h>
#include <time.h>
#include "prefs.h"
-
-/* smart object handlers */
-void iconbar_add(Evas_Object *o);
-void iconbar_del(Evas_Object *o);
-void iconbar_layer_set(Evas_Object *o, int l);
-void iconbar_raise(Evas_Object *o);
-void iconbar_lower(Evas_Object *o);
-void iconbar_stack_above(Evas_Object *o, Evas_Object *above);
-void iconbar_stack_below(Evas_Object *o, Evas_Object *below);
-void iconbar_move(Evas_Object *o, double x, double y);
-void iconbar_resize(Evas_Object *o, double w, double h);
-void iconbar_show(Evas_Object *o);
-void iconbar_hide(Evas_Object *o);
-void iconbar_color_set(Evas_Object *o, int r, int g, int b, int a);
-void iconbar_clip_set(Evas_Object *o, Evas_Object *clip);
-void iconbar_clip_unset(Evas_Object *o);
+#include "icon_editor.h"
void iconbar_icon_move(Icon *icon);
void iconbar_icons_fix(Iconbar *ib);
void iconbar_icons_load(Iconbar *ib);
void write_out_order(void *data);
-
static int clock_timer(void *data);
static void cb_iconbar(void *data, Evas_Object *o, const char *sig, const char *src);
-static void cb_icon(void *data, Evas_Object *o, const char *sig, const char *src);
-static void cb_exec(void *data, Evas_Object *o, const char *sig, const char *src);
static void cb_window(void *data, Evas_Object *o, const char *sig, const char *src);
-
-/* keep this global, so it only has to be created once */
-static Evas_Smart *smart = NULL;
-
-
Evas_Object *
iconbar_new(Evas *evas)
{
@@ -46,6 +24,7 @@
return iconbar;
}
+
Evas_Object *
iconbar_gui_get(Evas_Object *o)
{
@@ -57,6 +36,7 @@
}
return(NULL);
}
+
/* set the path for data (bits, order, icons) */
void
iconbar_path_set(Evas_Object *obj, char *path)
@@ -118,236 +98,6 @@
return NULL;
}
-Evas_Smart *
-iconbar_smart_get()
-{
- if (smart) return smart;
-
- smart = evas_smart_new ("iconbar",
- iconbar_add,
- iconbar_del,
- iconbar_layer_set,
- iconbar_raise,
- iconbar_lower,
- iconbar_stack_above,
- iconbar_stack_below,
- iconbar_move,
- iconbar_resize,
- iconbar_show,
- iconbar_hide,
- iconbar_color_set,
- iconbar_clip_set,
- iconbar_clip_unset,
- NULL
- );
-
- return smart;
-
-}
-
-
-/*********** smart object functions **************/
-void
-iconbar_add(Evas_Object *o)
-{
- Iconbar *ib;
- Evas *evas;
-
- ib = (Iconbar *)malloc(sizeof(Iconbar));
- memset(ib, 0, sizeof(Iconbar));
-
- evas_object_smart_data_set(o, ib);
- ib->obj = o;
-
- evas = evas_object_evas_get(o);
-
- ib->cont = e_container_new(evas);
- e_container_direction_set(ib->cont, 1);
- e_container_spacing_set(ib->cont, 5);
- e_container_alignment_set(ib->cont, CONTAINER_ALIGN_CENTER);
- e_container_fill_policy_set(ib->cont, CONTAINER_FILL_POLICY_FILL_X |
- CONTAINER_FILL_POLICY_KEEP_ASPECT);
- e_container_move_button_set(ib->cont, 2);
-}
-
-
-void
-iconbar_del(Evas_Object *o)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
-}
-
-void
-iconbar_layer_set(Evas_Object *o, int l)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
-
- if (ib->gui)
- evas_object_layer_set(ib->gui, l);
-}
-
-void
-iconbar_raise(Evas_Object *o)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
-
- if (ib->gui)
- evas_object_raise(ib->gui);
-}
-
-void
-iconbar_lower(Evas_Object *o)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
-
- if (ib->gui)
- evas_object_lower(ib->gui);
-}
-
-void
-iconbar_stack_above(Evas_Object *o, Evas_Object *above)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
- evas_object_stack_above(ib->gui, above);
-}
-
-void
-iconbar_stack_below(Evas_Object *o, Evas_Object *below)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
- evas_object_stack_below(ib->gui, below);
-}
-
-void
-iconbar_move(Evas_Object *o, double x, double y)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
-
- if (ib->gui)
- evas_object_move(ib->gui, x, y);
-// iconbar_icons_fix(ib);
-}
-
-void
-iconbar_resize(Evas_Object *o, double w, double h)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
-
- if (ib->gui)
- evas_object_resize(ib->gui, w, h);
-
- if (w > h)
- {
- e_container_direction_set(ib->cont, 0);
- e_container_fill_policy_set(ib->cont, CONTAINER_FILL_POLICY_FILL_Y |
- CONTAINER_FILL_POLICY_KEEP_ASPECT);
- e_container_padding_set(ib->cont, 5, 5, 11, 11);
- }
- else
- {
- e_container_direction_set(ib->cont, 1);
- e_container_fill_policy_set(ib->cont, CONTAINER_FILL_POLICY_FILL_X |
- CONTAINER_FILL_POLICY_KEEP_ASPECT);
- e_container_padding_set(ib->cont, 11, 11, 5, 5);
- }
-}
-
-void
-iconbar_show(Evas_Object *o)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
-
- /* show the iconbar */
- if (ib->gui)
- evas_object_show(ib->gui);
-
- evas_object_show(ib->cont);
-}
-
-void
-iconbar_hide(Evas_Object *o)
-{
- Iconbar *ib;
-//Evas_List *l;
-
- ib = evas_object_smart_data_get(o);
-
- if (ib->gui)
- evas_object_hide(ib->gui);
-
- evas_object_hide(ib->cont);
-}
-
-void
-iconbar_color_set(Evas_Object *o, int r, int g, int b, int a)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
- evas_object_color_set(ib->gui, r, g, b, a);
-}
-
-void
-iconbar_clip_set(Evas_Object *o, Evas_Object *clip)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
- evas_object_clip_set(ib->gui, clip);
-}
-
-void
-iconbar_clip_unset(Evas_Object *o)
-{
- Iconbar *ib;
-
- ib = evas_object_smart_data_get(o);
- evas_object_clip_unset(ib->gui);
-}
-
-Icon *
-iconbar_icon_new(Iconbar *ib, char *path)
-{
- Evas *evas;
- Icon *ic;
-
- evas = evas_object_evas_get(ib->obj);
- ic = (Icon *)malloc(sizeof(Icon));
- memset(ic, 0, sizeof(Icon));
-
- ic->iconbar = ib;
- ic->file = (char *)strdup(path);
-
- /* load up the icon edje FIXME make sure it loaded... */
-
- ic->image = edje_object_add(evas);
- edje_object_file_set(ic->image, ic->file, "icon");
- evas_object_data_set(ic->image, "Icon", ic);
- evas_object_resize(ic->image, 32, 32);
- evas_object_show(ic->image);
-
- edje_object_signal_callback_add(ic->image, "exec*", "*", cb_exec, ic);
- edje_object_signal_callback_add(ic->image, "mouse*", "*", cb_icon, ic);
- return ic;
-}
void
iconbar_icons_load(Iconbar *ib)
@@ -377,7 +127,7 @@
closedir(dirp);
}
- /* add them to the container as specified in order.txt */
+ /* add them to the container as specified in config.db */
{
Evas_List *l, *ll;
char buf[PATH_MAX];
@@ -486,37 +236,12 @@
int layer = evas_object_layer_get(ib->gui);
evas_object_layer_set(ib->gui, layer - 1);
evas_object_layer_set(ib->gui, layer);
- }
- }
-}
-static void
-cb_icon(void *data, Evas_Object *o, const char *sig, const char *src)
-{
- /* FIXME put icon dragging stuff in here */
- if (!strcmp(sig, "mouse,down,2"))
- {
- }
- else if (!strcmp(sig, "mouse,up,2"))
- {
- }
- else if (!strcmp(sig, "mouse,move"))
- {
+ }
}
}
static void
-cb_exec(void *data, Evas_Object *o, const char *sig, const char *src)
-{
- char *exec = (char *)(sig+5);
-
- if (!exec_run_in_dir(exec, get_user_home()))
- {
- printf("Error: failed to run \"%s\"\n", exec);
- }
-
-}
-static void
cb_window(void *data, Evas_Object *o, const char *sig, const char *src)
{
Iconbar *ib;
@@ -556,6 +281,7 @@
}
}
+
static int
clock_timer(void *data)
{
@@ -573,3 +299,17 @@
}
return(0);
}
+
+/*
+ * Make sure the container, icons, etc have the proper stacking
+ * This is a bit hackish, and probably due to a container bug
+ */
+void
+iconbar_fix(Evas_Object *obj)
+{
+ Evas_Object *gui = iconbar_gui_get(obj);
+ int layer = evas_object_layer_get(gui);
+
+ evas_object_layer_set(gui, layer - 1);
+ evas_object_layer_set(gui, layer);
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/iconbar/src/iconbar.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- iconbar.h 17 Jan 2004 01:34:05 -0000 1.3
+++ iconbar.h 20 Feb 2004 03:23:49 -0000 1.4
@@ -9,8 +9,10 @@
#include <stdio.h>
#include <dirent.h>
+
typedef struct _Iconbar Iconbar;
-typedef struct _Icon Icon;
+
+#include "icon.h"
struct _Iconbar
{
@@ -27,22 +29,9 @@
int scroll;
Ecore_Timer *scroll_timer;
Ecore_Timer *clock_timer;
-
- Evas_Object *clock;
};
-struct _Icon
-{
- Iconbar *iconbar;
- Evas_Object *image;
-
- char *file;
-
- pid_t launch_pid;
- int launch_id;
- void *launch_id_cb;
-};
Evas_Object *iconbar_new(Evas *evas);
Evas_Object *iconbar_gui_get(Evas_Object *o);
@@ -52,5 +41,8 @@
void iconbar_path_set(Evas_Object *iconbar, char *path);
char *iconbar_path_get(Evas_Object *iconbar);
+/* hack -- see the .c file */
+void iconbar_fix(Evas_Object *obj);
+
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/iconbar/src/main.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- main.c 16 Feb 2004 05:18:47 -0000 1.23
+++ main.c 20 Feb 2004 03:23:49 -0000 1.24
@@ -9,6 +9,7 @@
#include "util.h"
#include "config.h"
#include "prefs.h"
+#include "icon_editor.h"
static void window_resize(Ecore_Evas *ee);
static void window_leave(Ecore_Evas *ee);
@@ -42,6 +43,7 @@
edje_frametime_set(1.0/30.0);
iconbar_config_init();
iconbar_config_geometry_get(&x, &y, &w, &h);
+ icon_editor_init(&argc, argv);
ee = ecore_evas_software_x11_new(NULL, 0, x, y, w, h);
win = ecore_evas_software_x11_window_get(ee);
@@ -59,7 +61,7 @@
ecore_evas_sticky_set(ee, iconbar_config_sticky_get());
ecore_evas_avoid_damage_set(ee, 1);
ecore_x_window_prop_xy_set(win, x, y);
- ecore_x_window_prop_layer_set(win, 1);
+ //ecore_x_window_prop_layer_set(win, 1);
iconbar_config_ecore_evas_set(ee);
#ifdef HAVE_TRANS_BG
@@ -103,7 +105,7 @@
if((edjew > 0) && (edjeh > 0))
{
if (edjew > INT_MAX) edjew = INT_MAX;
- if (edjeh > INT_MAX) edjew = INT_MAX;
+ if (edjeh > INT_MAX) edjeh = INT_MAX;
ecore_evas_size_max_set(ee, (int)edjew, (int)edjeh);
}
if(iconbar_config_sticky_get() > 0)
@@ -138,6 +140,7 @@
ecore_main_loop_begin();
iconbar_config_free();
+ evas_object_del(iconbar);
edje_shutdown();
ecore_evas_shutdown();
ecore_shutdown();
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs