aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-11-11 04:26:25 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-11-11 04:26:25 +0000
commitb5be31c1c55ca0af9a7f28de0ccc4c7a02bc58da (patch)
tree320bb540ae3a9ff0de964376490b2ed8b8dcec07 /src
parentpatch from Holger Hanrath <barnabas76@arcor.de> (diff)
downloadenlightenment-b5be31c1c55ca0af9a7f28de0ccc4c7a02bc58da.tar.gz
finish off border selector dialog
SVN revision: 18423
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_border.c3
-rw-r--r--src/bin/e_int_border_border.c100
-rw-r--r--src/bin/e_theme.c163
-rw-r--r--src/bin/e_theme.h2
-rw-r--r--src/bin/e_widget_ilist.c60
-rw-r--r--src/bin/e_widget_ilist.h5
6 files changed, 228 insertions, 105 deletions
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
index 8d47996af..9fca59513 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -4808,6 +4808,9 @@ _e_border_eval(E_Border *bd)
snprintf(buf, sizeof(buf), "widgets/border/%s/border",
bd->client.border.name);
ok = e_theme_edje_object_set(o, "base/theme/borders", buf);
+ if ((!ok) && (strcmp(bd->client.border.name, "borderless")))
+ ok = e_theme_edje_object_set(o, "base/theme/borders",
+ "widgets/border/default/border");
if (ok)
{
const char *shape_option;
diff --git a/src/bin/e_int_border_border.c b/src/bin/e_int_border_border.c
index 9f5ce3614..638b1a806 100644
--- a/src/bin/e_int_border_border.c
+++ b/src/bin/e_int_border_border.c
@@ -5,6 +5,7 @@
/* PROTOTYPES - same all the time */
typedef struct _CFData CFData;
+typedef struct _CFBorder CFBorder;
static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
@@ -15,7 +16,15 @@ static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFDa
struct _CFData
{
E_Border *border;
+ char *bordername;
int remember_border;
+ Evas_List *cfblist;
+};
+
+struct _CFBorder
+{
+ CFData *cfdata;
+ const char *bordername;
};
/* a nice easy setup function that does the dirty work */
@@ -45,6 +54,7 @@ _fill_data(CFData *cfdata)
if ((cfdata->border->remember) &&
(cfdata->border->remember->apply & E_REMEMBER_APPLY_BORDER))
cfdata->remember_border = 1;
+ cfdata->bordername = strdup(cfdata->border->client.border.name);
}
static void *
@@ -67,6 +77,12 @@ _free_data(E_Config_Dialog *cfd, CFData *cfdata)
{
/* Free the cfdata */
cfdata->border->border_border_dialog = NULL;
+ E_FREE(cfdata->bordername);
+ while (cfdata->cfblist)
+ {
+ E_FREE(cfdata->cfblist->data);
+ cfdata->cfblist = evas_list_remove_list(cfdata->cfblist, cfdata->cfblist);
+ }
free(cfdata);
}
@@ -107,6 +123,13 @@ _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
}
}
}
+ if ((!cfdata->border->lock_border) && (!cfdata->border->shaded))
+ {
+ if (cfdata->border->client.border.name) free(cfdata->border->client.border.name);
+ cfdata->border->client.border.name = strdup(cfdata->bordername);
+ cfdata->border->client.border.changed = 1;
+ cfdata->border->changed = 1;
+ }
e_config_save_queue();
return 1; /* Apply was OK */
}
@@ -118,53 +141,58 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
/* generate the core widget layout for a basic dialog */
Evas_Object *o, *ob, *oi, *oj, *orect;
Evas_Coord wmw, wmh;
+ Evas_List *borders, *l;
+ int sel, n;
+ CFBorder *cfb;
_fill_data(cfdata);
o = e_widget_list_add(evas, 0, 0);
- oi = e_widget_ilist_add(evas, 80, 48);
+ oi = e_widget_ilist_add(evas, 80, 48, &(cfdata->bordername));
- ob = e_livethumb_add(evas);
- e_livethumb_vsize_set(ob, 160, 96);
- oj = edje_object_add(e_livethumb_evas_get(ob));
- e_theme_edje_object_set(oj, "base/theme/borders", "widgets/border/default/border");
- e_livethumb_thumb_set(ob, oj);
- orect = evas_object_rectangle_add(e_livethumb_evas_get(ob));
- evas_object_color_set(orect, 255, 255, 255, 128);
- evas_object_show(orect);
- edje_object_part_swallow(oj, "client", orect);
- e_widget_ilist_append(oi, ob, "default", NULL, NULL);
+ sel = 0;
+ borders = e_theme_border_list();
+
+ cfb = E_NEW(CFBorder, 1);
+ cfb->cfdata = cfdata;
+ cfb->bordername = "borderless";
+ cfdata->cfblist = evas_list_append(cfdata->cfblist, cfb);
+ orect = evas_object_rectangle_add(evas);
+ evas_object_color_set(orect, 0, 0, 0, 128);
+ e_widget_ilist_append(oi, orect, "borderless", NULL, NULL, "borderless");
- orect = evas_object_rectangle_add(e_livethumb_evas_get(ob));
- evas_object_color_set(orect, 255, 255, 255, 128);
- e_widget_ilist_append(oi, orect, "borderless", NULL, NULL);
+ for (n = 1, l = borders; l; l = l->next, n++)
+ {
+ char buf[4096];
+
+ cfb = E_NEW(CFBorder, 1);
+ cfb->cfdata = cfdata;
+ cfb->bordername = l->data;
+ cfdata->cfblist = evas_list_append(cfdata->cfblist, cfb);
+ ob = e_livethumb_add(evas);
+ e_livethumb_vsize_set(ob, 160, 96);
+ oj = edje_object_add(e_livethumb_evas_get(ob));
+ snprintf(buf, sizeof(buf), "widgets/border/%s/border",
+ (char *)l->data);
+ e_theme_edje_object_set(oj, "base/theme/borders", buf);
+ e_livethumb_thumb_set(ob, oj);
+ orect = evas_object_rectangle_add(e_livethumb_evas_get(ob));
+ evas_object_color_set(orect, 0, 0, 0, 128);
+ evas_object_show(orect);
+ edje_object_part_swallow(oj, "client", orect);
+ e_widget_ilist_append(oi, ob, (char *)l->data, NULL, NULL, l->data);
+ if (!strcmp(cfdata->border->client.border.name, (char *)l->data))
+ sel = n;
+ }
+ e_widget_ilist_select_set(oi, sel);
- ob = e_icon_add(evas);
- e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
- e_widget_ilist_append(oi, ob, "Item 2", NULL, NULL);
- ob = e_icon_add(evas);
- e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
- e_widget_ilist_append(oi, ob, "Item 3", NULL, NULL);
- ob = e_icon_add(evas);
- e_icon_file_set(ob, "/home/raster/C/stuff/icons/cd.png");
- e_widget_ilist_append(oi, ob, "Item 4", NULL, NULL);
e_widget_min_size_get(oi, &wmw, &wmh);
- e_widget_min_size_set(oi, wmw, 150);
+ e_widget_min_size_set(oi, wmw, 250);
e_widget_ilist_go(oi);
+
e_widget_list_object_append(o, oi, 1, 1, 0.5);
-/*
- of = e_widget_framelist_add(evas, _("Generic Locks"), 0);
- ob = e_widget_check_add(evas, _("Lock the Window so it does only what I tell it to"), &(cfdata->do_what_i_say));
- e_widget_framelist_object_append(of, ob);
- ob = e_widget_check_add(evas, _("Protect this window from me accidentally changing it"), &(cfdata->protect_from_me));
- e_widget_framelist_object_append(of, ob);
- ob = e_widget_check_add(evas, _("Protect this window from being accidentally closed because it is important"), &(cfdata->important_window));
- e_widget_framelist_object_append(of, ob);
- ob = e_widget_check_add(evas, _("Do not allow the border to change on this window"), &(cfdata->keep_my_border));
- e_widget_framelist_object_append(of, ob);
- e_widget_list_object_append(o, of, 1, 1, 0.5);
- */
+
ob = e_widget_check_add(evas, _("Remember this Border for this window next time it appears"), &(cfdata->remember_border));
e_widget_list_object_append(o, ob, 0, 0, 1.0);
return o;
diff --git a/src/bin/e_theme.c b/src/bin/e_theme.c
index ef8294e0a..733004033 100644
--- a/src/bin/e_theme.c
+++ b/src/bin/e_theme.c
@@ -14,7 +14,9 @@ struct _E_Theme_Result
static Evas_Bool _e_theme_mappings_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata);
static void _e_theme_category_register(const char *category);
-static void _e_theme_transition_register(const char *transition);
+static Evas_List *_e_theme_collection_item_register(Evas_List *list, const char *name);
+static Evas_List *_e_theme_collection_items_find(const char *base, const char *collname);
+
/* local subsystem globals */
static Evas_Hash *mappings = NULL;
@@ -22,6 +24,7 @@ static Evas_Hash *group_cache = NULL;
static Evas_List *categories = NULL;
static Evas_List *transitions = NULL;
+static Evas_List *borders = NULL;
/* externally accessible functions */
@@ -48,60 +51,8 @@ e_theme_init(void)
}
/* Find transitions */
- category = strdup("base/theme/transitions");
- if (category)
- {
- do
- {
- res = evas_hash_find(mappings, category);
- if (res)
- {
- char *str;
-
- /* if found check cached path */
- str = res->cache;
- if (!str)
- {
- /* no cached path */
- str = res->file;
- /* if its not an absolute path find it */
- if (str[0] != '/')
- str = e_path_find(path_themes, str);
- /* save cached value */
- if (str) res->cache = str;
- }
- if (str)
- {
- Evas_List *coll, *l;
- coll = edje_file_collection_list(str);
- if (coll)
- {
- for (l = coll; l; l = l->next)
- {
- if (!strncmp(l->data, "transitions", 11))
- {
- char *trans;
-
- trans = strdup(l->data);
- p = strchr(trans, '/');
- if (p)
- {
- p++;
- _e_theme_transition_register(p);
- }
- free(trans);
- }
- }
- edje_file_collection_list_free(coll);
- }
- }
- }
- p = strrchr(category, '/');
- if (p) *p = 0;
- }
- while (p);
- free(category);
- }
+ transitions = _e_theme_collection_items_find("base/theme/transitions", "transitions");
+ borders = _e_theme_collection_items_find("base/theme/borders", "widgets/border");
return 1;
}
@@ -164,6 +115,11 @@ e_theme_shutdown(void)
free(transitions->data);
transitions = evas_list_remove_list(transitions, transitions);
}
+ while (borders)
+ {
+ free(borders->data);
+ borders = evas_list_remove_list(borders, borders);
+ }
return 1;
}
@@ -450,6 +406,25 @@ e_theme_transition_list(void)
return transitions;
}
+int
+e_theme_border_find(const char *border)
+{
+ Evas_List *l;
+
+ for (l = borders; l; l = l->next)
+ {
+ if (!strcmp(border, l->data))
+ return 1;
+ }
+ return 0;
+}
+
+Evas_List *
+e_theme_border_list(void)
+{
+ return borders;
+}
+
/* local subsystem functions */
static Evas_Bool
@@ -478,16 +453,82 @@ _e_theme_category_register(const char *category)
categories = evas_list_append(categories, strdup(category));
}
-static void
-_e_theme_transition_register(const char *transition)
+static Evas_List *
+_e_theme_collection_item_register(Evas_List *list, const char *name)
{
Evas_List *l;
- for (l = transitions; l; l = l->next)
+ for (l = list; l; l = l->next)
{
- if (!strcmp(transition, l->data))
- return;
+ if (!strcmp(name, l->data)) return list;
}
+ list = evas_list_append(list, strdup(name));
+ return list;
+}
- transitions = evas_list_append(transitions, strdup(transition));
+static Evas_List *
+_e_theme_collection_items_find(const char *base, const char *collname)
+{
+ Evas_List *list = NULL;
+ E_Theme_Result *res;
+ char *category, *p, *p2;
+ int collname_len;
+
+ collname_len = strlen(collname);
+ category = strdup(base);
+ if (category)
+ {
+ do
+ {
+ res = evas_hash_find(mappings, category);
+ if (res)
+ {
+ char *str;
+
+ /* if found check cached path */
+ str = res->cache;
+ if (!str)
+ {
+ /* no cached path */
+ str = res->file;
+ /* if its not an absolute path find it */
+ if (str[0] != '/') str = e_path_find(path_themes, str);
+ /* save cached value */
+ if (str) res->cache = str;
+ }
+ if (str)
+ {
+ Evas_List *coll, *l;
+
+ coll = edje_file_collection_list(str);
+ if (coll)
+ {
+ for (l = coll; l; l = l->next)
+ {
+ if (!strncmp(l->data, collname, collname_len))
+ {
+ char *trans;
+
+ trans = strdup(l->data);
+ p = trans + collname_len + 1;
+ if (*p)
+ {
+ p2 = strchr(p, '/');
+ if (p2) *p2 = 0;
+ list = _e_theme_collection_item_register(list, p);
+ }
+ free(trans);
+ }
+ }
+ edje_file_collection_list_free(coll);
+ }
+ }
+ }
+ p = strrchr(category, '/');
+ if (p) *p = 0;
+ }
+ while (p);
+ free(category);
+ }
+ return list;
}
diff --git a/src/bin/e_theme.h b/src/bin/e_theme.h
index 69e042782..838acc6c2 100644
--- a/src/bin/e_theme.h
+++ b/src/bin/e_theme.h
@@ -22,6 +22,8 @@ EAPI int e_theme_category_find(const char *category);
EAPI Evas_List *e_theme_category_list(void);
EAPI int e_theme_transition_find(const char *transition);
EAPI Evas_List *e_theme_transition_list(void);
+EAPI int e_theme_border_find(const char *border);
+EAPI Evas_List *e_theme_border_list(void);
#endif
#endif
diff --git a/src/bin/e_widget_ilist.c b/src/bin/e_widget_ilist.c
index 568980fff..b22cd6511 100644
--- a/src/bin/e_widget_ilist.c
+++ b/src/bin/e_widget_ilist.c
@@ -4,9 +4,18 @@
#include "e.h"
typedef struct _E_Widget_Data E_Widget_Data;
+typedef struct _E_Widget_Callback E_Widget_Callback;
struct _E_Widget_Data
{
Evas_Object *o_widget, *o_scrollframe, *o_ilist;
+ Evas_List *callbacks;
+ char **value;
+};
+struct _E_Widget_Callback
+{
+ void (*func) (void *data);
+ void *data;
+ char *value;
};
static void _e_wid_del_hook(Evas_Object *obj);
@@ -17,7 +26,7 @@ static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *even
/* externally accessible functions */
Evas_Object *
-e_widget_ilist_add(Evas *evas, int icon_w, int icon_h)
+e_widget_ilist_add(Evas *evas, int icon_w, int icon_h, char **value)
{
Evas_Object *obj, *o;
E_Widget_Data *wd;
@@ -29,6 +38,8 @@ e_widget_ilist_add(Evas *evas, int icon_w, int icon_h)
e_widget_focus_hook_set(obj, _e_wid_focus_hook);
wd = calloc(1, sizeof(E_Widget_Data));
e_widget_data_set(obj, wd);
+
+ wd->value = value;
o = e_scrollframe_add(evas);
wd->o_scrollframe = o;
@@ -51,14 +62,19 @@ e_widget_ilist_add(Evas *evas, int icon_w, int icon_h)
}
void
-e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data)
+e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data, char *val)
{
E_Widget_Data *wd;
Evas_Coord mw, mh, vw, vh, w, h;
+ E_Widget_Callback *wcb;
wd = e_widget_data_get(obj);
- /* FIXME: need to actually store the callback and call it */
- e_ilist_append(wd->o_ilist, icon, label, _e_wid_cb_item_sel, wd, data);
+ wcb = E_NEW(E_Widget_Callback, 1);
+ wcb->func = func;
+ wcb->data = data;
+ if (val) wcb->value = strdup(val);
+ wd->callbacks = evas_list_append(wd->callbacks, wcb);
+ e_ilist_append(wd->o_ilist, icon, label, _e_wid_cb_item_sel, wd, wcb);
if (icon) evas_object_show(icon);
e_ilist_min_size_get(wd->o_ilist, &mw, &mh);
evas_object_resize(wd->o_ilist, mw, mh);
@@ -74,6 +90,15 @@ e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*f
}
void
+e_widget_ilist_select_set(Evas_Object *obj, int n)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ e_ilist_select_set(wd->o_ilist, n);
+}
+
+void
e_widget_ilist_go(Evas_Object *obj)
{
E_Widget_Data *wd;
@@ -88,6 +113,15 @@ _e_wid_del_hook(Evas_Object *obj)
E_Widget_Data *wd;
wd = e_widget_data_get(obj);
+ while (wd->callbacks)
+ {
+ E_Widget_Callback *wcb;
+
+ wcb = wd->callbacks->data;
+ if (wcb->value) free(wcb->value);
+ free(wcb);
+ wd->callbacks = evas_list_remove_list(wd->callbacks, wd->callbacks);
+ }
free(wd);
}
@@ -128,11 +162,25 @@ _e_wid_cb_item_sel(void *data, void *data2)
{
E_Widget_Data *wd;
Evas_Coord x, y, w, h;
-
+ E_Widget_Callback *wcb;
+
wd = data;
+ wcb = data2;
e_ilist_selected_geometry_get(wd->o_ilist, &x, &y, &w, &h);
e_scrollframe_child_region_show(wd->o_scrollframe, x, y, w, h);
- if (wd->o_widget) e_widget_change(wd->o_widget);
+ if (wd->o_widget)
+ {
+ e_widget_change(wd->o_widget);
+ if (wd->value)
+ {
+ if (*(wd->value)) free(*(wd->value));
+ if (wcb->value)
+ *(wd->value) = strdup(wcb->value);
+ else
+ *(wd->value) = NULL;
+ }
+ if (wcb->func) wcb->func(wcb->data);
+ }
}
static void
diff --git a/src/bin/e_widget_ilist.h b/src/bin/e_widget_ilist.h
index 98300d728..45ea777f3 100644
--- a/src/bin/e_widget_ilist.h
+++ b/src/bin/e_widget_ilist.h
@@ -6,8 +6,9 @@
#ifndef E_WIDGET_ILIST_H
#define E_WIDGET_ILIST_H
-EAPI Evas_Object *e_widget_ilist_add(Evas *evas, int icon_w, int icon_h);
-EAPI void e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data);
+EAPI Evas_Object *e_widget_ilist_add(Evas *evas, int icon_w, int icon_h, char **value);
+EAPI void e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data, char *val);
+EAPI void e_widget_ilist_select_set(Evas_Object *obj, int n);
EAPI void e_widget_ilist_go(Evas_Object *obj);
#endif