summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2001-10-19 09:13:18 +0000
committerCarsten Haitzler <raster@rasterman.com>2001-10-19 09:13:18 +0000
commit8e5adf71a6fc2fa06ae602f8f51f8294e243b099 (patch)
tree15a6cc02cc158f74356e6c65514191142c0df052
parent5d2c820b96406198b3b74a40737455b2623bddf4 (diff)
much cleaner iconboar. ok - right now it doesn't scroll. use the buidl
scritp again (pass in a directory path to set up.. i'd suggest mkdir ~/.e mkdir ~/.e/desktop mkdir ~/.e/desktop/default build_iconbar_db.sh ~/.e/desktop/default the scritp is a bit smaller now :) SVN revision: 5519
-rw-r--r--Makefile.am2
-rw-r--r--config.h.in224
-rw-r--r--configure.in1
-rw-r--r--data/iconbar/iconbar_bottom.bits.dbbin0 -> 94208 bytes
-rwxr-xr-xdata/scripts/build_iconbar_db.sh83
-rw-r--r--src/config.c8
-rw-r--r--src/config.h3
-rw-r--r--src/iconbar.c806
-rw-r--r--src/iconbar.h104
-rw-r--r--src/view.c11
-rw-r--r--tools/.cvsignore5
-rw-r--r--tools/Makefile.am12
-rw-r--r--tools/e_img_import.c22
13 files changed, 482 insertions, 799 deletions
diff --git a/Makefile.am b/Makefile.am
index f08166129..71abbe967 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
1## Process this file with automake to produce Makefile.in 1## Process this file with automake to produce Makefile.in
2 2
3SUBDIRS = intl po src lib client doc 3SUBDIRS = intl po src lib client tools doc
4 4
5MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \ 5MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \
6 config.h.in config.sub configure install-sh \ 6 config.h.in config.sub configure install-sh \
diff --git a/config.h.in b/config.h.in
index de4217ab6..aa79be36e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,4 +1,48 @@
1/* config.h.in. Generated automatically from configure.ac by autoheader. */ 1/* config.h.in. Generated automatically from configure.in by autoheader. */
2
3/* Define if using alloca.c. */
4#undef C_ALLOCA
5
6/* Define to empty if the keyword does not work. */
7#undef const
8
9/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
10 This function is required for alloca.c support on those systems. */
11#undef CRAY_STACKSEG_END
12
13/* Define if you have alloca, as a function or macro. */
14#undef HAVE_ALLOCA
15
16/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
17#undef HAVE_ALLOCA_H
18
19/* Define if you have a working `mmap' system call. */
20#undef HAVE_MMAP
21
22/* Define as __inline if that's what the C compiler calls it. */
23#undef inline
24
25/* Define to `long' if <sys/types.h> doesn't define. */
26#undef off_t
27
28/* Define if you need to in order for stat and other things to work. */
29#undef _POSIX_SOURCE
30
31/* Define to `unsigned' if <sys/types.h> doesn't define. */
32#undef size_t
33
34/* If using the C implementation of alloca, define if you know the
35 direction of stack growth for your system; otherwise it will be
36 automatically deduced at run-time.
37 STACK_DIRECTION > 0 => grows toward higher addresses
38 STACK_DIRECTION < 0 => grows toward lower addresses
39 STACK_DIRECTION = 0 => direction of growth unknown
40 */
41#undef STACK_DIRECTION
42
43/* Define if you have the ANSI C header files. */
44#undef STDC_HEADERS
45
2#undef ENLIGHTENMENT_VERSION 46#undef ENLIGHTENMENT_VERSION
3#undef ENLIGHTENMENT_MAJOR 47#undef ENLIGHTENMENT_MAJOR
4#undef ENLIGHTENMENT_MINOR 48#undef ENLIGHTENMENT_MINOR
@@ -16,191 +60,81 @@
16#undef PACKAGE_LIB_DIR 60#undef PACKAGE_LIB_DIR
17#undef USE_FERITE 61#undef USE_FERITE
18 62
19/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP 63/* Define if you have the __argz_count function. */
20 systems. This function is required for `alloca.c' support on those systems. 64#undef HAVE___ARGZ_COUNT
21 */
22#undef CRAY_STACKSEG_END
23
24/* Define if using `alloca.c'. */
25#undef C_ALLOCA
26
27/* Define to 1 if translation of program messages to the user's native
28 language is requested. */
29#undef ENABLE_NLS
30
31/* Define if you have `alloca', as a function or macro. */
32#undef HAVE_ALLOCA
33 65
34/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ 66/* Define if you have the __argz_next function. */
35#undef HAVE_ALLOCA_H 67#undef HAVE___ARGZ_NEXT
36 68
37/* Define if you have the <argz.h> header file. */ 69/* Define if you have the __argz_stringify function. */
38#undef HAVE_ARGZ_H 70#undef HAVE___ARGZ_STRINGIFY
39 71
40/* Define if you have the `dcgettext' function. */ 72/* Define if you have the dcgettext function. */
41#undef HAVE_DCGETTEXT 73#undef HAVE_DCGETTEXT
42 74
43/* Define if you have the <dlfcn.h> header file. */ 75/* Define if you have the getcwd function. */
44#undef HAVE_DLFCN_H
45
46/* Define if you have the `feof_unlocked' function. */
47#undef HAVE_FEOF_UNLOCKED
48
49/* Define if you have the `fgets_unlocked' function. */
50#undef HAVE_FGETS_UNLOCKED
51
52/* Define if you have the `getcwd' function. */
53#undef HAVE_GETCWD 76#undef HAVE_GETCWD
54 77
55/* Define if you have the `getegid' function. */ 78/* Define if you have the getpagesize function. */
56#undef HAVE_GETEGID
57
58/* Define if you have the `geteuid' function. */
59#undef HAVE_GETEUID
60
61/* Define if you have the `getgid' function. */
62#undef HAVE_GETGID
63
64/* Define if you have the `getpagesize' function. */
65#undef HAVE_GETPAGESIZE 79#undef HAVE_GETPAGESIZE
66 80
67/* Define if the GNU gettext() function is already present or preinstalled. */ 81/* Define if you have the munmap function. */
68#undef HAVE_GETTEXT
69
70/* Define if you have the `getuid' function. */
71#undef HAVE_GETUID
72
73/* Define if you have the iconv() function. */
74#undef HAVE_ICONV
75
76/* Define if you have the <inttypes.h> header file. */
77#undef HAVE_INTTYPES_H
78
79/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
80#undef HAVE_LANGINFO_CODESET
81
82/* Define if your <locale.h> file defines LC_MESSAGES. */
83#undef HAVE_LC_MESSAGES
84
85/* Define if you have the <limits.h> header file. */
86#undef HAVE_LIMITS_H
87
88/* Define if you have the <locale.h> header file. */
89#undef HAVE_LOCALE_H
90
91/* Define if you have the <malloc.h> header file. */
92#undef HAVE_MALLOC_H
93
94/* Define if you have the <memory.h> header file. */
95#undef HAVE_MEMORY_H
96
97/* Define if you have the `mempcpy' function. */
98#undef HAVE_MEMPCPY
99
100/* Define if you have a working `mmap' system call. */
101#undef HAVE_MMAP
102
103/* Define if you have the `munmap' function. */
104#undef HAVE_MUNMAP 82#undef HAVE_MUNMAP
105 83
106/* Define if you have the <nl_types.h> header file. */ 84/* Define if you have the putenv function. */
107#undef HAVE_NL_TYPES_H
108
109/* Define if you have the `putenv' function. */
110#undef HAVE_PUTENV 85#undef HAVE_PUTENV
111 86
112/* Define if you have the `setenv' function. */ 87/* Define if you have the setenv function. */
113#undef HAVE_SETENV 88#undef HAVE_SETENV
114 89
115/* Define if you have the `setlocale' function. */ 90/* Define if you have the setlocale function. */
116#undef HAVE_SETLOCALE 91#undef HAVE_SETLOCALE
117 92
118/* Define if you have the <stddef.h> header file. */ 93/* Define if you have the stpcpy function. */
119#undef HAVE_STDDEF_H
120
121/* Define if you have the <stdint.h> header file. */
122#undef HAVE_STDINT_H
123
124/* Define if you have the <stdlib.h> header file. */
125#undef HAVE_STDLIB_H
126
127/* Define if you have the `stpcpy' function. */
128#undef HAVE_STPCPY 94#undef HAVE_STPCPY
129 95
130/* Define if you have the `strcasecmp' function. */ 96/* Define if you have the strcasecmp function. */
131#undef HAVE_STRCASECMP 97#undef HAVE_STRCASECMP
132 98
133/* Define if you have the `strchr' function. */ 99/* Define if you have the strchr function. */
134#undef HAVE_STRCHR 100#undef HAVE_STRCHR
135 101
136/* Define if you have the `strdup' function. */ 102/* Define if you have the strdup function. */
137#undef HAVE_STRDUP 103#undef HAVE_STRDUP
138 104
139/* Define if you have the <strings.h> header file. */ 105/* Define if you have the <argz.h> header file. */
140#undef HAVE_STRINGS_H 106#undef HAVE_ARGZ_H
141 107
142/* Define if you have the <string.h> header file. */ 108/* Define if you have the <limits.h> header file. */
143#undef HAVE_STRING_H 109#undef HAVE_LIMITS_H
144 110
145/* Define if you have the `strtoul' function. */ 111/* Define if you have the <locale.h> header file. */
146#undef HAVE_STRTOUL 112#undef HAVE_LOCALE_H
147 113
148/* Define if you have the <sys/param.h> header file. */ 114/* Define if you have the <malloc.h> header file. */
149#undef HAVE_SYS_PARAM_H 115#undef HAVE_MALLOC_H
150 116
151/* Define if you have the <sys/stat.h> header file. */ 117/* Define if you have the <nl_types.h> header file. */
152#undef HAVE_SYS_STAT_H 118#undef HAVE_NL_TYPES_H
153 119
154/* Define if you have the <sys/types.h> header file. */ 120/* Define if you have the <string.h> header file. */
155#undef HAVE_SYS_TYPES_H 121#undef HAVE_STRING_H
156 122
157/* Define if you have the `tsearch' function. */ 123/* Define if you have the <sys/param.h> header file. */
158#undef HAVE_TSEARCH 124#undef HAVE_SYS_PARAM_H
159 125
160/* Define if you have the <unistd.h> header file. */ 126/* Define if you have the <unistd.h> header file. */
161#undef HAVE_UNISTD_H 127#undef HAVE_UNISTD_H
162 128
163/* Define if you have the `__argz_count' function. */ 129/* Define if you have the i library (-li). */
164#undef HAVE___ARGZ_COUNT 130#undef HAVE_LIBI
165
166/* Define if you have the `__argz_next' function. */
167#undef HAVE___ARGZ_NEXT
168
169/* Define if you have the `__argz_stringify' function. */
170#undef HAVE___ARGZ_STRINGIFY
171
172/* Define as const if the declaration of iconv() needs const. */
173#undef ICONV_CONST
174 131
175/* Name of package */ 132/* Name of package */
176#undef PACKAGE 133#undef PACKAGE
177 134
178/* If using the C implementation of alloca, define if you know the
179 direction of stack growth for your system; otherwise it will be
180 automatically deduced at run-time.
181 STACK_DIRECTION > 0 => grows toward higher addresses
182 STACK_DIRECTION < 0 => grows toward lower addresses
183 STACK_DIRECTION = 0 => direction of growth unknown */
184#undef STACK_DIRECTION
185
186/* Define if you have the ANSI C header files. */
187#undef STDC_HEADERS
188
189/* Version number of package */ 135/* Version number of package */
190#undef VERSION 136#undef VERSION
191 137
192/* Define if using the dmalloc debugging malloc package */ 138/* Define if using the dmalloc debugging malloc package */
193#undef WITH_DMALLOC 139#undef WITH_DMALLOC
194 140
195/* Define to empty if `const' does not conform to ANSI C. */
196#undef const
197
198/* Define as `__inline' if that's what the C compiler calls it, or to nothing
199 if it is not supported. */
200#undef inline
201
202/* Define to `long' if <sys/types.h> does not define. */
203#undef off_t
204
205/* Define to `unsigned' if <sys/types.h> does not define. */
206#undef size_t
diff --git a/configure.in b/configure.in
index 97f0f3687..06c9a1f2f 100644
--- a/configure.in
+++ b/configure.in
@@ -252,6 +252,7 @@ lib/Makefile
252client/Makefile 252client/Makefile
253intl/Makefile 253intl/Makefile
254po/Makefile.in 254po/Makefile.in
255tools/Makefile
255doc/Makefile 256doc/Makefile
256doc/kernel-doc 257doc/kernel-doc
257doc/html-customizations.dsl 258doc/html-customizations.dsl
diff --git a/data/iconbar/iconbar_bottom.bits.db b/data/iconbar/iconbar_bottom.bits.db
new file mode 100644
index 000000000..7c042755e
--- /dev/null
+++ b/data/iconbar/iconbar_bottom.bits.db
Binary files differ
diff --git a/data/scripts/build_iconbar_db.sh b/data/scripts/build_iconbar_db.sh
index 1cbadbf23..836a65f23 100755
--- a/data/scripts/build_iconbar_db.sh
+++ b/data/scripts/build_iconbar_db.sh
@@ -1,83 +1,40 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# db to create 3DB=$1"/.e_iconbar.db"
4DB="./.e_iconbar.db" 4BIT=$1"/.e_iconbar.bits.db"
5 5
6# replace ICONDIR with where you keep icons, or just use full paths below
7setup () 6setup ()
8{ 7{
9 NUM=0 8 PREFIX="/usr/local"
10 ICONDIR="/usr/share/pixmaps" 9 SYSIC="/usr/share/pixmaps"
11 E_PREFIX="/usr/local" 10 USRIC=$HOME"/stuff/icons"
12 rm -f $DB 11 NUM=0
12 rm -f $DB
13} 13}
14 14
15finish () 15finish ()
16{ 16{
17 edb_ed $DB add "/ib/num" int $NUM 17 edb_ed $DB add "/icons/count" int $NUM
18} 18}
19 19
20# usage: icon 'image_path' 'exec'
21icon () 20icon ()
22{ 21{
23 edb_ed $DB add "/ib/"$NUM"/icon" str "$1" 22 e_img_import "$1" $DB":""/icons/"$NUM"/image"
24 edb_ed $DB add "/ib/"$NUM"/exec" str "$2" 23 edb_ed $DB add "/icons/"$NUM"/exec" str "$2"
25 NUM=$[ $NUM + 1 ]; 24 NUM=$[ $NUM + 1 ];
26} 25}
27 26
28config ()
29{
30 edb_ed $DB add "/ib/"$1 int $2
31}
32
33str ()
34{
35 edb_ed $DB add "/ib/"$1 str $2
36}
37#################################################
38##
39## Define Icons here
40##
41
42setup 27setup
43 28
44# title is put at top or left of bar, this may be removed in future 29icon $SYSIC"/gnome-term.png" "Eterm"
45# vline/hline are the images that are repeated as borders for the bar / scroll region (for vert / horiz. bars). 30icon $SYSIC"/gnome-ccdesktop.png" "sylpheed"
46 31icon $SYSIC"/netscape.png" "netscape"
47str 'image/title' $E_PREFIX'/share/enlightenment/data/images/ib_title.png' 32icon $USRIC"/mozilla.png" "mozilla"
48str 'image/vline' $E_PREFIX'/share/enlightenment/data/images/vline.png' 33icon $SYSIC"/gnome-irc.png" "xchat"
49str 'image/hline' $E_PREFIX'/share/enlightenment/data/images/hline.png' 34icon $SYSIC"/gnome-gimp.png" "gimp"
50 35icon $SYSIC"/mc/gnome-audio.png" "xmms"
51# 0 width / height makes it equal view's width / height, negative values for left/top go from bottowm right corner. scroll_w is used for both horizontal and vertical bars (i guess it should be renamed scroll_thikness or something). 36icon $USRIC"star_office.png" "/home/raster/.desktop/Office"
52
53config 'geom/w' 0
54config 'geom/h' 75
55config 'geom/top' -75
56config 'geom/left' 0
57config 'geom/scroll_w' 16
58config 'geom/horizontal' 1
59config 'scroll_when_less' 0
60
61# change icondir above, or replace with full pathname
62
63icon $ICONDIR'/gnome-term.png' 'Eterm'
64icon $ICONDIR'/gnome-ccdesktop.png' 'sylpheed'
65icon $ICONDIR'/netscape.png' 'netscape'
66icon $ICONDIR'/gnome-irc.png' 'xchat'
67
68icon $ICONDIR'/gnome-gimp.png' 'gimp'
69icon $ICONDIR'/mc/gnome-audio.png' 'xmms'
70icon $ICONDIR'/home/raster/stuff/icons/star_office.png' '/home/raster/.desktop/Office'
71
72#icon $ICONDIR'/write.png' 'abiword'
73#icon $ICONDIR'/spreadsheet.png' 'gnumeric'
74
75#icon $ICONDIR'/synth.png' 'SpiralSynth'
76#icon $ICONDIR'/modsynth.png' 'SpiralSynthModular'
77#icon $ICONDIR'/loops.png' 'SpiralLoops'
78#icon $ICONDIR'/drakconf.png' 'gnomecc'
79#icon $ICONDIR'/floppy.png' 'NULL'
80#icon $ICONDIR'/trash.png' 'NULL'
81 37
82finish 38finish
83 39
40cp -f $PREFIX"/share/enlightenment/data/iconbar/iconbar_bottom.bits.db" $BIT
diff --git a/src/config.c b/src/config.c
index baac6f5e7..6be697e7a 100644
--- a/src/config.c
+++ b/src/config.c
@@ -259,6 +259,14 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
259 (*((Evas_List *)(&(data[node->offset])))) = l2; 259 (*((Evas_List *)(&(data[node->offset])))) = l2;
260 } 260 }
261 break; 261 break;
262 case E_CFG_TYPE_KEY:
263 {
264 char *val;
265
266 sprintf(buf, "%s/%s", prefix, node->prefix);
267 (*((char **)(&(data[node->offset])))) = strdup(buf);
268 }
269 break;
262 default: 270 default:
263 break; 271 break;
264 } 272 }
diff --git a/src/config.h b/src/config.h
index 5ef3873ce..a1f9214cf 100644
--- a/src/config.h
+++ b/src/config.h
@@ -162,7 +162,8 @@ enum _e_config_datatype
162 E_CFG_TYPE_INT, 162 E_CFG_TYPE_INT,
163 E_CFG_TYPE_STR, 163 E_CFG_TYPE_STR,
164 E_CFG_TYPE_FLOAT, 164 E_CFG_TYPE_FLOAT,
165 E_CFG_TYPE_LIST 165 E_CFG_TYPE_LIST,
166 E_CFG_TYPE_KEY
166}; 167};
167 168
168struct _e_config_base_type 169struct _e_config_base_type
diff --git a/src/iconbar.c b/src/iconbar.c
index 94174aada..eeb5442f5 100644
--- a/src/iconbar.c
+++ b/src/iconbar.c
@@ -1,567 +1,363 @@
1#include "iconbar.h" 1#include "iconbar.h"
2 2
3static Evas_List iconbars; 3static Evas_List iconbars = NULL;
4 4
5E_Iconbar * 5static E_Config_Base_Type *cf_iconbar = NULL;
6e_iconbar_new(E_View *v) 6static E_Config_Base_Type *cf_iconbar_icon = NULL;
7{
8 /* vertical lines (left, center, right) and title */
9 /* Evas_Object ovl, ovc, ovr, ot; */
10
11 E_Iconbar *ib;
12
13 ib = NEW(E_Iconbar, 1);
14 ZERO(ib, E_Iconbar, 1);
15 OBJ_INIT(ib, e_iconbar_free);
16
17 printf("in ib_new()\n");
18
19 ib->v = v;
20 ib->e = v->evas;
21 /* ib->name = strdup(v->dir); */
22
23 /* e_iconbar_draw(ib); */
24 iconbars = evas_list_append(iconbars, ib);
25
26 if(e_iconbar_config(ib) == 0)
27 return NULL;
28 7
29 return ib; 8static void ib_bits_show(void *data);
30} 9static void ib_bits_hide(void *data);
10static void ib_bits_move(void *data, double x, double y);
11static void ib_bits_resize(void *data, double w, double h);
12static void ib_bits_raise(void *data);
13static void ib_bits_lower(void *data);
14static void ib_bits_set_layer(void *data, int l);
15static void ib_bits_set_clip(void *data, Evas_Object clip);
16static void ib_bits_set_color_class(void *data, char *cc, int r, int g, int b, int a);
17static void ib_bits_get_min_size(void *data, double *w, double *h);
18static void ib_bits_get_max_size(void *data, double *w, double *h);
19
20static void ib_mouse_in(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
21static void ib_mouse_out(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
22static void ib_mouse_down(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
23static void ib_mouse_up(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
31 24
32void 25void
33e_iconbar_realize(E_Iconbar *ib) 26e_iconbar_init()
34{ 27{
35 printf("in e_iconbar_realize()\n"); 28 cf_iconbar_icon = e_config_type_new();
36 29 E_CONFIG_NODE(cf_iconbar_icon, "exec", E_CFG_TYPE_STR, NULL, E_Iconbar_Icon, exec, 0, 0, "");
37 if(ib->geom.conf.left < 0) 30 E_CONFIG_NODE(cf_iconbar_icon, "image", E_CFG_TYPE_KEY, NULL, E_Iconbar_Icon, image_path, 0, 0, "");
38 ib->geom.left = ib->geom.conf.left + ib->v->size.w; 31
39 if(ib->geom.conf.top < 0) 32 cf_iconbar = e_config_type_new();
40 ib->geom.top = ib->geom.conf.top + ib->v->size.h; 33 E_CONFIG_NODE(cf_iconbar, "icons", E_CFG_TYPE_LIST, cf_iconbar_icon, E_Iconbar, icons, 0, 0, NULL);
41 if(ib->geom.conf.w == 0)
42 ib->geom.w = ib->v->size.w;
43 if(ib->geom.conf.h == 0)
44 ib->geom.h = ib->v->size.h;
45
46 printf("w: %i, h: %i\nt: %i, l: %i\n", ib->geom.w, ib->geom.h, ib->geom.top, ib->geom.left);
47
48
49 /* horizontal */
50 if (ib->geom.horizontal)
51 {
52 ib->obj.scroll = evas_add_rectangle(ib->e);
53 ib->obj.line_l = evas_add_image_from_file(ib->e, ib->image.hline);
54 ib->obj.line_c = evas_add_image_from_file(ib->e, ib->image.hline);
55 ib->obj.line_r = evas_add_image_from_file(ib->e, ib->image.hline);
56 ib->obj.title = evas_add_image_from_file(ib->e, ib->image.title);
57 ib->obj.clip = evas_add_rectangle(ib->e);
58
59 evas_get_image_size(ib->e, ib->obj.title, &ib->geom.title_w, &ib->geom.title_h);
60 evas_get_image_size(ib->e, ib->obj.line_l, &ib->geom.line_w, &ib->geom.line_h);
61
62 evas_set_layer(ib->e, ib->obj.scroll, 400);
63
64 evas_resize(ib->e, ib->obj.scroll, ib->geom.w, ib->geom.scroll_w);
65 evas_resize(ib->e, ib->obj.line_l, ib->geom.w, ib->geom.line_h);
66 evas_resize(ib->e, ib->obj.line_c, ib->geom.w, ib->geom.line_h);
67 evas_resize(ib->e, ib->obj.line_r, ib->geom.w, ib->geom.line_h);
68 evas_resize(ib->e, ib->obj.clip, ib->geom.w, ib->geom.h);
69
70 evas_set_image_fill(ib->e, ib->obj.line_l, 0, 0, ib->geom.line_w, ib->geom.line_h);
71 evas_set_image_fill(ib->e, ib->obj.line_c, 0, 0, ib->geom.line_w, ib->geom.line_h);
72 evas_set_image_fill(ib->e, ib->obj.line_r, 0, 0, ib->geom.line_w, ib->geom.line_h);
73
74 evas_move(ib->e, ib->obj.scroll, ib->geom.left, ib->geom.top + ib->geom.h - ib->geom.scroll_w);
75 evas_move(ib->e, ib->obj.line_l, ib->geom.left, ib->geom.top);
76 evas_move(ib->e, ib->obj.line_c, ib->geom.left, ib->geom.top + ib->geom.h - ib->geom.scroll_w);
77 evas_move(ib->e, ib->obj.line_r, ib->geom.left, ib->geom.top + ib->geom.h);
78 evas_move(ib->e, ib->obj.title, ib->geom.left - ib->geom.title_w - 5, ib->geom.top + (ib->geom.h - ib->geom.title_h) / 2);
79 evas_move(ib->e, ib->obj.clip, ib->geom.left, ib->geom.top);
80
81 evas_set_color(ib->e, ib->obj.scroll, 129, 129, 129, 0);
82 evas_set_color(ib->e, ib->obj.clip, 255, 255, 255, 255);
83 }
84
85 /* vertical */
86 if (!ib->geom.horizontal)
87 {
88 ib->obj.scroll = evas_add_rectangle(ib->e);
89 ib->obj.line_l = evas_add_image_from_file(ib->e, ib->image.vline);
90 ib->obj.line_c = evas_add_image_from_file(ib->e, ib->image.vline);
91 ib->obj.line_r = evas_add_image_from_file(ib->e, ib->image.vline);
92 ib->obj.title = evas_add_image_from_file(ib->e, ib->image.title);
93 ib->obj.clip = evas_add_rectangle(ib->e);
94
95 evas_get_image_size(ib->e, ib->obj.title, &ib->geom.title_w, &ib->geom.title_h);
96 evas_get_image_size(ib->e, ib->obj.line_l, &ib->geom.line_w, &ib->geom.line_h);
97
98 evas_set_layer(ib->e, ib->obj.scroll, 400);
99
100 evas_resize(ib->e, ib->obj.scroll, ib->geom.scroll_w, ib->geom.h);
101 evas_resize(ib->e, ib->obj.line_l, ib->geom.line_w, ib->geom.h);
102 evas_resize(ib->e, ib->obj.line_c, ib->geom.line_w, ib->geom.h);
103 evas_resize(ib->e, ib->obj.line_r, ib->geom.line_w, ib->geom.h);
104 evas_resize(ib->e, ib->obj.clip, ib->geom.w, ib->geom.h);
105
106 evas_set_image_fill(ib->e, ib->obj.line_l, 0, 0, ib->geom.line_w, ib->geom.line_h);
107 evas_set_image_fill(ib->e, ib->obj.line_c, 0, 0, ib->geom.line_w, ib->geom.line_h);
108 evas_set_image_fill(ib->e, ib->obj.line_r, 0, 0, ib->geom.line_w, ib->geom.line_h);
109
110 evas_move(ib->e, ib->obj.scroll, ib->geom.left + ib->geom.w - ib->geom.scroll_w, ib->geom.top);
111 evas_move(ib->e, ib->obj.line_l, ib->geom.left, ib->geom.top);
112 evas_move(ib->e, ib->obj.line_c, ib->geom.left + ib->geom.w - ib->geom.scroll_w, ib->geom.top);
113 evas_move(ib->e, ib->obj.line_r, ib->geom.left + ib->geom.w, ib->geom.top);
114 evas_move(ib->e, ib->obj.title, ib->geom.left + ((ib->geom.w - ib->geom.title_w - ib->geom.scroll_w) / 2 ), ib->geom.top - ib->geom.title_h - 5);
115 evas_move(ib->e, ib->obj.clip, ib->geom.left, ib->geom.top);
116
117 evas_set_color(ib->e, ib->obj.scroll, 129, 129, 129, 0);
118 evas_set_color(ib->e, ib->obj.clip, 255, 255, 255, 255);
119 }
120
121
122 /* Clip icons */
123 {
124 Evas_List l;
125 for (l = ib->icons; l; l = l->next)
126 {
127 E_Iconbar_Icon *i;
128 i = l->data;
129 evas_set_clip(ib->e, i->image, ib->obj.clip);
130 }
131 }
132
133 /* show the iconbar */
134 evas_show(ib->e, ib->obj.scroll);
135 evas_show(ib->e, ib->obj.line_l);
136 evas_show(ib->e, ib->obj.line_c);
137 evas_show(ib->e, ib->obj.line_r);
138 evas_show(ib->e, ib->obj.title);
139 evas_show(ib->e, ib->obj.clip);
140
141 evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_MOVE, s_mouse_move, ib);
142 evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_IN, s_mouse_in, ib);
143 evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_OUT, s_mouse_out, ib);
144
145 e_iconbar_fix_icons(ib);
146
147 printf("realized!\n");
148} 34}
149 35
150 36E_Iconbar *
151E_Iconbar_Icon * 37e_iconbar_new(E_View *v)
152e_iconbar_new_icon(E_Iconbar *ib, char *image, char *exec)
153{ 38{
154 E_Iconbar_Icon *i; 39 Evas_List l;
155 40 char buf[PATH_MAX];
156 i = NEW(E_Iconbar_Icon, 1); 41 E_Iconbar *ib;
157 i->image = evas_add_image_from_file(ib->e, image); 42
158 i->exec = strdup(exec); 43 sprintf(buf, "%s/.e_iconbar.db", v->dir);
159 evas_get_image_size(ib->e, i->image, &(i->w), &(i->h)); 44
160 45 ib = e_config_load(buf, "", cf_iconbar);
161 if (ib->geom.horizontal) 46 if (!ib) return NULL;
162 { 47
163 i->x = 0; 48 OBJ_INIT(ib, e_iconbar_free);
164 i->y = (ib->geom.h - i->h - ib->geom.scroll_w) / 2 + ib->geom.top; 49 ib->view = v;
165 } 50
166 else 51 for (l = ib->icons; l; l = l->next)
167 { 52 {
168 i->x = (ib->geom.w - i->w - ib->geom.scroll_w) / 2 + ib->geom.left; 53 E_Iconbar_Icon *ic;
169 i->y = 0; 54
170 } 55 ic = l->data;
171 56 OBJ_INIT(ic, e_iconbar_icon_free);
172 printf("x: %f, y: %f\n", i->x, i->y); 57 ic->iconbar = ib;
173 evas_callback_add(ib->e, i->image, CALLBACK_MOUSE_IN, i_mouse_in, NULL); 58 }
174 evas_callback_add(ib->e, i->image, CALLBACK_MOUSE_OUT, i_mouse_out, NULL); 59 sprintf(buf, "%s/.e_iconbar.bits.db", v->dir);
175 evas_callback_add(ib->e, i->image, CALLBACK_MOUSE_DOWN, i_mouse_down, i->exec); 60
176 61 ib->bit = ebits_load(buf);
177 evas_set_color(ib->e, i->image, 255, 255, 255, 128); 62 if (!ib->bit)
178 evas_set_layer(ib->e, i->image, 400); 63 {
179 /* evas_set_clip(ib->e, i->image, ib->obj.clip); */ 64 OBJ_UNREF(ib);
180 /* printf("before ib->icons set\n"); */ 65 return NULL;
181 ib->icons = evas_list_append(ib->icons, i); 66 }
182 /* printf("after set\n"); */ 67
183 68 return ib;
184 return i; 69}
185}
186
187 70
188int 71void
189e_iconbar_config(E_Iconbar *ib) 72e_iconbar_free(E_Iconbar *ib)
190{ 73{
191 E_DB_File *db; 74 iconbars = evas_list_remove(iconbars, ib);
192 char buf[PATH_MAX], *userdir;
193
194 /* userdir = e_config_user_dir(); */
195 /* sprintf(buf, "%sbehavior/iconbar.db", userdir); */
196 sprintf(buf, "%s/.e_iconbar.db", ib->v->dir);
197 ib->db = strdup(buf);
198 db = e_db_open_read(ib->db);
199
200 if (!db)
201 {
202 /* ib->no_show = 1;
203
204 db = e_db_open(ib->db);
205 e_db_int_set(db, "/ib/num", 0);
206 e_db_int_set(db, "/ib/geom/w", 75);
207 e_db_int_set(db, "/ib/geom/h", 620);
208 e_db_int_set(db, "/ib/geom/top", 165);
209 e_db_int_set(db, "/ib/geom/left", -150);
210 e_db_int_set(db, "/ib/geom/scroll_w", 16);
211 e_db_int_set(db, "/ib/geom/horizontal", 0);
212 e_db_int_set(db, "/ib/scroll_when_less", 0);
213 e_db_str_set(db, "/ib/image/title", "/usr/local/share/enlightenment/data/ib_title.png");
214 e_db_str_set(db, "/ib/image/vline", "/usr/local/share/enlightenment/data/vline.png");
215 e_db_str_set(db, "/ib/image/hline", "/usr/local/share/enlightenment/data/hline.png");
216 */
217 return 0;
218 }
219
220 e_db_int_get(db, "/ib/geom/w", &(ib->geom.conf.w) );
221 e_db_int_get(db, "/ib/geom/h", &(ib->geom.conf.h));
222 e_db_int_get(db, "/ib/geom/top", &(ib->geom.conf.top));
223 e_db_int_get(db, "/ib/geom/left", &(ib->geom.conf.left));
224 e_db_int_get(db, "/ib/geom/scroll_w", &(ib->geom.scroll_w));
225 e_db_int_get(db, "/ib/geom/horizontal", &(ib->geom.horizontal));
226 e_db_int_get(db, "/ib/scroll_when_less", &(ib->scroll_when_less));
227 ib->image.title = e_db_str_get(db, "/ib/image/title");
228 ib->image.vline = e_db_str_get(db, "/ib/image/vline");
229 ib->image.hline = e_db_str_get(db, "/ib/image/hline");
230
231 ib->start = 0.0;
232 ib->icons = NULL;
233
234 ib->geom.left = ib->geom.conf.left;
235 ib->geom.top = ib->geom.conf.top;
236 ib->geom.w = ib->geom.conf.w;
237 ib->geom.h = ib->geom.conf.h;
238
239 /*
240 {
241 double w, h;
242 evas_get_viewport(ib->e, NULL, NULL, &w, &h);
243
244 if(ib->geom.conf.left < 0)
245 ib->geom.left = ib->geom.conf.left + w;
246 else
247 ib->geom.left = ib->geom.conf.left;
248 if(ib->geom.conf.top < 0)
249 ib->geom.top = ib->geom.conf.top + h;
250 else
251 ib->geom.top = ib->geom.conf.top;
252 }
253 75
254 */ 76 ib->view->changed = 1;
255 printf("w: %i, h: %i\nt: %i, l: %i\n", ib->geom.w, ib->geom.h, ib->geom.top, ib->geom.left); 77 if (ib->bit) ebits_free(ib->bit);
256 78 if (ib->icons)
79 {
80 Evas_List l;
257 81
258 { 82 for (l = ib->icons; l; l = l->next)
259 int i, num;
260
261 if (e_db_int_get(db, "/ib/num", &num))
262 {
263 printf("making %i icons...\n", num);
264
265 for ( i = 0; i < num; i++)
266 { 83 {
267 char *icon, *exec, buf[PATH_MAX]; 84 E_Iconbar_Icon *ic;
268 85
269 sprintf(buf, "/ib/%i/icon", i); 86 ic = l->data;
270 /* printf("reading #%i's icon...\n", i); */ 87 OBJ_UNREF(ic);
271 icon = e_db_str_get(db, buf);
272 /* printf("icon: %s, reading #%i's exec...\n", icon, i); */
273 sprintf(buf, "/ib/%i/exec", i);
274 exec = e_db_str_get(db, buf);
275 printf("exec: %s... creating icon\n", exec);
276
277 /* printf("creating icon, %s, %s\n", icon, exec); */
278 e_iconbar_new_icon(ib, icon, exec);
279 printf("created...\n");
280 } 88 }
281 } 89 evas_list_free(ib->icons);
282 } 90 }
283 /* printf("created icon.\n"); */ 91 FREE(ib);
284
285 e_db_close(db);
286
287 return 1;
288} 92}
289
290 93
291void 94void
292e_iconbar_fix_icons(E_Iconbar *ib) 95e_iconbar_icon_free(E_Iconbar_Icon *ic)
293{ 96{
294 Evas_List l; 97 if (ic->image) evas_del_object(ic->iconbar->view->evas, ic->image);
295 double cur, spacer; 98 IF_FREE(ic->image_path);
296 99 IF_FREE(ic->exec);
297 spacer = 8.0; 100 FREE(ic);
298
299 if (!ib->geom.horizontal)
300 {
301 cur = ib->geom.top + ib->start + spacer;
302 for (l = ib->icons; l; l = l->next)
303 {
304 E_Iconbar_Icon *i;
305
306 i = l->data;
307 i->y = cur;
308 i->x = (ib->geom.w - i->w - ib->geom.scroll_w) / 2 + ib->geom.left;
309 cur = cur + i->h + spacer;
310
311 evas_move(ib->e, i->image, i->x, i->y);
312 evas_show(ib->e, i->image);
313 }
314
315 ib->length = cur - ib->start - ib->geom.top;
316 }
317 else
318 {
319 cur = ib->geom.left + ib->start + spacer;
320 for (l = ib->icons; l; l = l->next)
321 {
322 E_Iconbar_Icon *i;
323
324 i = l->data;
325 i->x = cur;
326 i->y = (ib->geom.h - i->h - ib->geom.scroll_w) / 2 + ib->geom.top;
327 cur = cur + i->w + spacer;
328
329 evas_move(ib->e, i->image, i->x, i->y);
330 evas_show(ib->e, i->image);
331 }
332
333 ib->length = cur - ib->start - ib->geom.left;
334 }
335} 101}
336 102
337void 103void
338e_iconbar_scroll(int val, void *data) 104e_iconbar_realize(E_Iconbar *ib)
339{ 105{
340 E_Iconbar *ib; 106 Evas_List l;
341 double vis_length; 107
342 108 for (l = ib->icons; l; l = l->next)
343 /* printf("before scroll data to ib set\n"); */ 109 {
344 ib = data; 110 E_Iconbar_Icon *ic;
345 /* printf("after data set\n"); */ 111 char buf[PATH_MAX];
346 /* printf("start: %f, speed: %f\n", ib->start, ib->speed); */ 112
347 ib->start = ib->start - ib->speed; 113 ic = l->data;
348 if (ib->geom.horizontal) vis_length = ib->geom.w; 114 sprintf(buf, "%s/.e_iconbar.db:%s", ib->view->dir, ic->image_path);
349 else vis_length = ib->geom.h; 115 ic->image = evas_add_image_from_file(ib->view->evas, buf);
350 116 evas_set_color(ib->view->evas, ic->image, 255, 255, 255, 128);
351 if (ib->length > vis_length) 117 evas_callback_add(ib->view->evas, ic->image, CALLBACK_MOUSE_IN, ib_mouse_in, ic);
352 { 118 evas_callback_add(ib->view->evas, ic->image, CALLBACK_MOUSE_OUT, ib_mouse_out, ic);
353 if (ib->start > 0) 119 evas_callback_add(ib->view->evas, ic->image, CALLBACK_MOUSE_DOWN, ib_mouse_down, ic);
354 ib->start = 0; 120 evas_callback_add(ib->view->evas, ic->image, CALLBACK_MOUSE_UP, ib_mouse_up, ic);
355 else if (ib->start < vis_length - ib->length) 121 }
356 ib->start = vis_length - ib->length; 122 ebits_add_to_evas(ib->bit, ib->view->evas);
357 } 123 ebits_set_named_bit_replace(ib->bit, "Icons",
358 else if (ib->scroll_when_less) 124 ib_bits_show,
359 { 125 ib_bits_hide,
360 /* icons scroll even if they don't fill the bar */ 126 ib_bits_move,
361 if (ib->start < 0) 127 ib_bits_resize,
362 ib->start = 0; 128 ib_bits_raise,
363 else if (ib->start > vis_length - ib->length) 129 ib_bits_lower,
364 ib->start = vis_length - ib->length; 130 ib_bits_set_layer,
365 131 ib_bits_set_clip,
366 } 132 ib_bits_set_color_class,
367 else 133 ib_bits_get_min_size,
368 { 134 ib_bits_get_max_size,
369 ib->start = 0; 135 ib);
370 } 136 ebits_set_layer(ib->bit, 10000);
371 /* printf("before fix\n"); */ 137 e_iconbar_fix(ib);
372 e_iconbar_fix_icons(ib);
373 /* printf("after fix\n"); */
374
375 if (ib->scrolling)
376 {
377 /* printf("before timer\n"); */
378 ecore_add_event_timer("e_iconbar_scroll()", 0.01, e_iconbar_scroll, 1, ib);
379 /* printf("after timer\n"); */
380 }
381} 138}
382 139
383void 140void
384i_mouse_in(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) 141e_iconbar_fix(E_Iconbar *ib)
385{ 142{
386 evas_set_color(_e, _o, 255, 255, 255, 255); 143 Evas_List l;
144 double ix, iy, aw, ah;
145
146 ebits_move(ib->bit, 0, 0);
147 ebits_resize(ib->bit, ib->view->size.w, ib->view->size.h);
148 ebits_show(ib->bit);
149 ib->view->changed = 1;
150
151 ix = ib->icon_area.x;
152 iy = ib->icon_area.y;
153 aw = ib->icon_area.w;
154 ah = ib->icon_area.h;
155
156 if (aw > ah) /* horizontal */
157 {
158 }
159 else /* vertical */
160 {
161 }
162
163 for (l = ib->icons; l; l = l->next)
164 {
165 E_Iconbar_Icon *ic;
166 int iw, ih;
167 double w, h;
168 double ox, oy;
169
170 ic = l->data;
171 evas_get_image_size(ic->iconbar->view->evas, ic->image, &iw, &ih);
172 w = iw;
173 h = ih;
174 ox = 0;
175 oy = 0;
176 if (aw > ah) /* horizontal */
177 {
178 if (h > ah)
179 {
180 w = (ah * w) / h;
181 h = ah;
182 }
183 ox = 0;
184 oy = (ah - h) / 2;
185 evas_move(ic->iconbar->view->evas, ic->image, ix + ox, iy + oy);
186 evas_resize(ic->iconbar->view->evas, ic->image, w, h);
187 ix += w;
188 }
189 else /* vertical */
190 {
191 if (w > aw)
192 {
193 h = (aw * h) / w;
194 w = aw;
195 }
196 ox = (aw - w) / 2;
197 oy = 0;
198 evas_move(ic->iconbar->view->evas, ic->image, ix + ox, iy + oy);
199 evas_resize(ic->iconbar->view->evas, ic->image, w, h);
200 iy += h;
201 }
202 }
387} 203}
388 204
389void 205static void
390i_mouse_out(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) 206ib_bits_show(void *data)
391{ 207{
392 evas_set_color(_e, _o, 255, 255, 255, 128); 208 E_Iconbar *ib;
209 Evas_List l;
210
211 ib = (E_Iconbar *)data;
212 for (l = ib->icons; l; l = l->next)
213 {
214 E_Iconbar_Icon *ic;
215
216 ic = l->data;
217 evas_show(ic->iconbar->view->evas, ic->image);
218 }
393} 219}
394 220
395void 221static void
396i_mouse_down(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) 222ib_bits_hide(void *data)
397{ 223{
398 char *file = _data; 224 E_Iconbar *ib;
399 e_exec_run(file); 225 Evas_List l;
226
227 ib = (E_Iconbar *)data;
228 for (l = ib->icons; l; l = l->next)
229 {
230 E_Iconbar_Icon *ic;
231
232 ic = l->data;
233 evas_hide(ic->iconbar->view->evas, ic->image);
234 }
400} 235}
401 236
237static void
238ib_bits_move(void *data, double x, double y)
239{
240 E_Iconbar *ib;
241 Evas_List l;
242
243 ib = (E_Iconbar *)data;
244 ib->icon_area.x = x;
245 ib->icon_area.y = y;
246}
402 247
403void 248static void
404s_mouse_move(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) 249ib_bits_resize(void *data, double w, double h)
405{ 250{
406 E_Iconbar *ib; 251 E_Iconbar *ib;
407 252 Evas_List l;
408 double center; 253
409 int top_speed; 254 ib = (E_Iconbar *)data;
410 double r; 255 ib->icon_area.w = w;
411 256 ib->icon_area.h = h;
412 /* printf("set ib in s_mouse_move\n"); */ 257}
413 258
414 ib = _data; 259static void
415 260ib_bits_raise(void *data)
416 top_speed = 5; 261{
417 262 E_Iconbar *ib;
418 if (ib->geom.horizontal) 263 Evas_List l;
419 { 264
420 center = ib->geom.left + (.5 * ib->geom.w); 265 ib = (E_Iconbar *)data;
421 r = (_x - center) / (.5 * ib->geom.w); 266 for (l = ib->icons; l; l = l->next)
422 } 267 {
423 else 268 E_Iconbar_Icon *ic;
424 { 269
425 center = ib->geom.top + (.5 * ib->geom.h); 270 ic = l->data;
426 r = (_y - center) / (.5 * ib->geom.h); 271 evas_raise(ic->iconbar->view->evas, ic->image);
427 } 272 }
428
429 ib->speed = r * (double)top_speed;
430
431 e_iconbar_scroll(1, ib);
432} 273}
433 274
434void 275static void
435s_mouse_in(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) 276ib_bits_lower(void *data)
436{ 277{
437 E_Iconbar *ib; 278 E_Iconbar *ib;
438 ib = _data; 279 Evas_List l;
439 /* printf("setting scrolling\n"); */ 280
440 ib->scrolling = 1; 281 ib = (E_Iconbar *)data;
441 /* printf("set scrolling\n"); */ 282 for (l = ib->icons; l; l = l->next)
283 {
284 E_Iconbar_Icon *ic;
285
286 ic = l->data;
287 evas_lower(ic->iconbar->view->evas, ic->image);
288 }
442} 289}
443 290
444void 291static void
445s_mouse_out(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) 292ib_bits_set_layer(void *data, int lay)
446{ 293{
447 E_Iconbar *ib; 294 E_Iconbar *ib;
448 ib = _data; 295 Evas_List l;
449 ib->scrolling = 0; 296
297 ib = (E_Iconbar *)data;
298 for (l = ib->icons; l; l = l->next)
299 {
300 E_Iconbar_Icon *ic;
301
302 ic = l->data;
303 evas_set_layer(ic->iconbar->view->evas, ic->image, lay);
304 }
450} 305}
451 306
452void 307static void
453e_iconbar_free(E_Iconbar *ib) 308ib_bits_set_clip(void *data, Evas_Object clip)
454{ 309{
455
456 Evas_List l;
457
458 printf("in e_iconbar_clean_up()\n");
459
460 iconbars = evas_list_remove(iconbars, ib);
461
462 for (l = ib->icons; l; l = l->next)
463 {
464 E_Iconbar_Icon *i;
465 i = l->data;
466 FREE(i);
467 }
468 FREE(ib->icons);
469 FREE(ib);
470 e_db_runtime_flush();
471
472 printf("e_iconbar_clean_up() run successfully\n");
473} 310}
474 311
312static void
313ib_bits_set_color_class(void *data, char *cc, int r, int g, int b, int a)
314{
315}
475 316
476static void 317static void
477e_iconbar_idle(void *data) 318ib_bits_get_min_size(void *data, double *w, double *h)
478{ 319{
479 Evas_List l; 320 *w = 0;
480 321 *h = 0;
481 for (l = iconbars; l; l = l->next)
482 {
483 E_Iconbar *ib;
484
485 ib = l->data;
486 e_iconbar_update(ib);
487 /* e_iconbar_redraw(ib); */
488 }
489} 322}
490 323
491void 324static void
492e_iconbar_update(E_Iconbar *ib) 325ib_bits_get_max_size(void *data, double *w, double *h)
493{ 326{
494 if (ib->v->changed) 327 *w = 999999;
495 { 328 *h = 999999;
496 e_iconbar_redraw(ib);
497 }
498} 329}
499 330
331static void
332ib_mouse_in(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
333{
334 E_Iconbar_Icon *ic;
335
336 ic = (E_Iconbar_Icon *)data;
337 evas_set_color(ic->iconbar->view->evas, ic->image, 255, 255, 255, 255);
338 ic->iconbar->view->changed = 1;
339}
500 340
501void 341static void
502e_iconbar_redraw(E_Iconbar *ib) 342ib_mouse_out(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
503{ 343{
504 if(ib->geom.conf.left < 0) 344 E_Iconbar_Icon *ic;
505 ib->geom.left = ib->geom.conf.left + ib->v->size.w; 345
506 if(ib->geom.conf.top < 0) 346 ic = (E_Iconbar_Icon *)data;
507 ib->geom.top = ib->geom.conf.top + ib->v->size.h; 347 evas_set_color(ic->iconbar->view->evas, ic->image, 255, 255, 255, 128);
508 if(ib->geom.conf.w == 0) 348 ic->iconbar->view->changed = 1;
509 ib->geom.w = ib->v->size.w;
510 if(ib->geom.conf.h == 0)
511 ib->geom.h = ib->v->size.h;
512
513
514 /* horizontal */
515 if (ib->geom.horizontal)
516 {
517 evas_move(ib->e, ib->obj.scroll, ib->geom.left, ib->geom.top + ib->geom.h - ib->geom.scroll_w);
518 evas_move(ib->e, ib->obj.line_l, ib->geom.left, ib->geom.top);
519 evas_move(ib->e, ib->obj.line_c, ib->geom.left, ib->geom.top + ib->geom.h - ib->geom.scroll_w);
520 evas_move(ib->e, ib->obj.line_r, ib->geom.left, ib->geom.top + ib->geom.h);
521 evas_move(ib->e, ib->obj.title, ib->geom.left - ib->geom.title_w - 5, ib->geom.top + (ib->geom.h - ib->geom.title_h) / 2);
522 evas_move(ib->e, ib->obj.clip, ib->geom.left, ib->geom.top);
523 }
524
525 /* vertical */
526 if (!ib->geom.horizontal)
527 {
528 evas_move(ib->e, ib->obj.scroll, ib->geom.left + ib->geom.w - ib->geom.scroll_w, ib->geom.top);
529 evas_move(ib->e, ib->obj.line_l, ib->geom.left, ib->geom.top);
530 evas_move(ib->e, ib->obj.line_c, ib->geom.left + ib->geom.w - ib->geom.scroll_w, ib->geom.top);
531 evas_move(ib->e, ib->obj.line_r, ib->geom.left + ib->geom.w, ib->geom.top);
532 evas_move(ib->e, ib->obj.title, ib->geom.left + ((ib->geom.w - ib->geom.title_w - ib->geom.scroll_w) / 2 ), ib->geom.top - ib->geom.title_h - 5);
533 evas_move(ib->e, ib->obj.clip, ib->geom.left, ib->geom.top);
534 }
535
536
537 /* Clip icons */
538 {
539 Evas_List l;
540 for (l = ib->icons; l; l = l->next)
541 {
542 E_Iconbar_Icon *i;
543 i = l->data;
544 evas_set_clip(ib->e, i->image, ib->obj.clip);
545 }
546 }
547
548 /* show the iconbar */
549 evas_show(ib->e, ib->obj.scroll);
550 evas_show(ib->e, ib->obj.line_l);
551 evas_show(ib->e, ib->obj.line_c);
552 evas_show(ib->e, ib->obj.line_r);
553 evas_show(ib->e, ib->obj.title);
554 evas_show(ib->e, ib->obj.clip);
555
556 evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_MOVE, s_mouse_move, ib);
557 evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_IN, s_mouse_in, ib);
558 evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_OUT, s_mouse_out, ib);
559
560 e_iconbar_fix_icons(ib);
561} 349}
562 350
563void 351static void
564e_iconbar_init() 352ib_mouse_down(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
353{
354 E_Iconbar_Icon *ic;
355
356 ic = (E_Iconbar_Icon *)data;
357 e_exec_run(ic->exec);
358}
359
360static void
361ib_mouse_up(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
565{ 362{
566 ecore_event_filter_idle_handler_add(e_iconbar_idle, NULL);
567} 363}
diff --git a/src/iconbar.h b/src/iconbar.h
index f5482d3d0..eb66e9afc 100644
--- a/src/iconbar.h
+++ b/src/iconbar.h
@@ -6,11 +6,7 @@
6#include "exec.h" 6#include "exec.h"
7#include "view.h" 7#include "view.h"
8 8
9#define SCROLL_W 16 9typedef struct _E_Iconbar_Icon E_Iconbar_Icon;
10#define SCREEN_W 1280
11
12typedef struct _iconbar_icon E_Iconbar_Icon;
13
14#ifndef E_ICONBAR_TYPEDEF 10#ifndef E_ICONBAR_TYPEDEF
15#define E_ICONBAR_TYPEDEF 11#define E_ICONBAR_TYPEDEF
16typedef struct _E_Iconbar E_Iconbar; 12typedef struct _E_Iconbar E_Iconbar;
@@ -21,86 +17,38 @@ typedef struct _E_Iconbar E_Iconbar;
21typedef struct _E_View E_View; 17typedef struct _E_View E_View;
22#endif 18#endif
23 19
24 20struct _E_Iconbar
25struct _iconbar_icon
26{ 21{
27 OBJ_PROPERTIES; 22 OBJ_PROPERTIES;
28 23
29 Evas_Object image; 24 E_View *view;
30 char *exec; 25 Evas_List icons;
31 int w, h;
32 double x, y;
33 26
34 int selected; 27 Ebits_Object *bit;
28 struct {
29 double x, y, w, h;
30 } icon_area;
35}; 31};
36 32
37struct _E_Iconbar 33struct _E_Iconbar_Icon
38{ 34{
39 OBJ_PROPERTIES; 35 OBJ_PROPERTIES;
40 36
41 char *name; 37 E_Iconbar *iconbar;
42 E_View *v; 38
43 Evas e; 39 Evas_Object image;
44 Evas_List icons; 40
45 char *db; 41 char *image_path;
46 42 char *exec;
47 struct { 43
48 Evas_Object clip; 44 int selected;
49 Evas_Object scroll;
50 Evas_Object line_l;
51 Evas_Object line_c;
52 Evas_Object line_r;
53 Evas_Object title;
54 } obj;
55
56 struct {
57 char *title;
58 char *vline;
59 char *hline;
60 } image;
61
62
63 double start, speed, length;
64
65 int scrolling, scroll_when_less;
66
67 struct {
68 int w;
69 int h;
70 int top;
71 int left;
72 int scroll_w;
73 int title_w, title_h, line_w, line_h;
74
75 int horizontal; /* 1 - horiz, 0 - vert */
76
77 struct {
78 int top;
79 int left;
80 int h;
81 int w;
82 } conf;
83 } geom;
84}; 45};
85 46
86
87void e_iconbar_init(void); 47void e_iconbar_init(void);
88E_Iconbar *e_iconbar_new(E_View *); 48E_Iconbar *e_iconbar_new(E_View *v);
89int e_iconbar_config(E_Iconbar *); 49void e_iconbar_free(E_Iconbar *ib);
90void e_iconbar_realize(E_Iconbar *); 50void e_iconbar_icon_free(E_Iconbar_Icon *);
91void e_iconbar_redraw(E_Iconbar *); 51void e_iconbar_realize(E_Iconbar *ib);
92E_Iconbar_Icon *e_iconbar_new_icon(E_Iconbar *, char *, char *); 52void e_iconbar_fix(E_Iconbar *ib);
93void e_iconbar_fix_icons(E_Iconbar *);
94void e_iconbar_create_icons_from_db(E_Iconbar *);
95void e_iconbar_free(E_Iconbar *);
96void e_iconbar_update(E_Iconbar *);
97
98void i_mouse_in(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
99void i_mouse_out(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
100void i_mouse_down(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
101
102void s_mouse_move(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
103void s_mouse_in(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
104void s_mouse_out(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
105 53
106#endif 54#endif
diff --git a/src/view.c b/src/view.c
index db14248f6..b290229f3 100644
--- a/src/view.c
+++ b/src/view.c
@@ -1264,6 +1264,7 @@ e_configure(Ecore_Event * ev)
1264 e_scrollbar_resize(v->scrollbar.v, 12, v->size.h - 12); 1264 e_scrollbar_resize(v->scrollbar.v, 12, v->size.h - 12);
1265 e_scrollbar_move(v->scrollbar.h, 0, v->size.h - 12); 1265 e_scrollbar_move(v->scrollbar.h, 0, v->size.h - 12);
1266 e_scrollbar_resize(v->scrollbar.h, v->size.w - 12, 12); 1266 e_scrollbar_resize(v->scrollbar.h, v->size.w - 12, 12);
1267 if (v->iconbar) e_iconbar_fix(v->iconbar);
1267 } 1268 }
1268 } 1269 }
1269 } 1270 }
@@ -2184,6 +2185,7 @@ e_view_free(E_View *v)
2184{ 2185{
2185 char name[PATH_MAX]; 2186 char name[PATH_MAX];
2186 2187
2188 if (v->iconbar) OBJ_UNREF(v->iconbar);
2187 2189
2188 sprintf(name, "resort_timer.%s", v->dir); 2190 sprintf(name, "resort_timer.%s", v->dir);
2189 ecore_del_event_timer(name); 2191 ecore_del_event_timer(name);
@@ -2199,7 +2201,6 @@ e_view_free(E_View *v)
2199 v->restarter = NULL; 2201 v->restarter = NULL;
2200 ecore_window_destroy(v->win.base); 2202 ecore_window_destroy(v->win.base);
2201 2203
2202 if (v->iconbar) e_iconbar_free(v->iconbar);
2203 2204
2204 FREE(v); 2205 FREE(v);
2205} 2206}
@@ -2252,7 +2253,6 @@ _member.r = _r; _member.g = _g; _member.b = _b; _member.a = _a;
2252 v->spacing.icon.s = 7; 2253 v->spacing.icon.s = 7;
2253 v->spacing.icon.g = 7; 2254 v->spacing.icon.g = 7;
2254 v->spacing.icon.b = 7; 2255 v->spacing.icon.b = 7;
2255// v->iconbar = e_iconbar_new(v);
2256 2256
2257 views = evas_list_append(views, v); 2257 views = evas_list_append(views, v);
2258 return v; 2258 return v;
@@ -2288,8 +2288,8 @@ e_view_set_dir(E_View *v, char *dir)
2288 v->geom_get.h = efsd_get_metadata(e_fs_get_connection(), 2288 v->geom_get.h = efsd_get_metadata(e_fs_get_connection(),
2289 "/view/h", v->dir, EFSD_INT); 2289 "/view/h", v->dir, EFSD_INT);
2290 v->geom_get.busy = 1; 2290 v->geom_get.busy = 1;
2291 v->getbg = efsd_get_metadata(e_fs_get_connection(), "/view/background", v->dir, EFSD_STRING); 2291 v->getbg = efsd_get_metadata(e_fs_get_connection(), "/view/background", v->dir, EFSD_STRING);
2292 { 2292 {
2293 EfsdOptions *ops; 2293 EfsdOptions *ops;
2294 2294
2295 ops = efsd_ops(2, efsd_op_get_stat(), efsd_op_get_filetype()); 2295 ops = efsd_ops(2, efsd_op_get_stat(), efsd_op_get_filetype());
@@ -2392,8 +2392,7 @@ e_view_realize(E_View *v)
2392 } 2392 }
2393 2393
2394 v->iconbar = e_iconbar_new(v); 2394 v->iconbar = e_iconbar_new(v);
2395 2395 if (v->iconbar) e_iconbar_realize(v->iconbar);
2396 if(v->iconbar) e_iconbar_realize(v->iconbar);
2397 2396
2398 v->changed = 1; 2397 v->changed = 1;
2399} 2398}
diff --git a/tools/.cvsignore b/tools/.cvsignore
new file mode 100644
index 000000000..03206ec26
--- /dev/null
+++ b/tools/.cvsignore
@@ -0,0 +1,5 @@
1e_ipc_client
2Makefile.in
3Makefile
4.libs
5.deps
diff --git a/tools/Makefile.am b/tools/Makefile.am
new file mode 100644
index 000000000..81500fa33
--- /dev/null
+++ b/tools/Makefile.am
@@ -0,0 +1,12 @@
1## Process this file with automake to produce Makefile.in
2
3INCLUDES = \
4 -I$(top_srcdir)/intl \
5 @evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ @efsd_cflags@ @ferite_cflags@
6
7bin_PROGRAMS = e_img_import
8
9e_img_import_SOURCES = \
10e_img_import.c
11
12e_img_import_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @ferite_libs@ -lm -lc $(INTLLIBS)
diff --git a/tools/e_img_import.c b/tools/e_img_import.c
new file mode 100644
index 000000000..ba5a1898e
--- /dev/null
+++ b/tools/e_img_import.c
@@ -0,0 +1,22 @@
1#include <X11/Xlib.h>
2#include <Imlib2.h>
3
4int main(int argc, char **argv)
5{
6 Imlib_Image im;
7
8 if (argc == 1)
9 {
10 printf("usage:\n\t%s source_image.png dest.db:/key/in/db\n", argv[0]);
11 exit(-1);
12 }
13 im = imlib_load_image(argv[1]);
14 if (im)
15 {
16 imlib_context_set_image(im);
17 imlib_image_attach_data_value("compression", NULL, 9, NULL);
18 imlib_image_set_format("db");
19 imlib_save_image(argv[2]);
20 }
21 return 0;
22}