Enlightenment CVS committal
Author : codewarrior
Project : e17
Module : apps/e_modules
Dir : e17/apps/e_modules/src/modules/notes
Modified Files:
TODO e_mod_main.c e_mod_main.h
Log Message:
focus support (which is broken if you move) and support for multiple notes
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e_modules/src/modules/notes/TODO,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- TODO 30 Mar 2005 13:40:08 -0000 1.3
+++ TODO 30 Mar 2005 22:46:02 -0000 1.4
@@ -1,3 +1,4 @@
+* bug: when we move a note, we cant get focus events on it any more (mouse_in)
* add Contiguration -> Options -> Background (color changes?) (done, refine)
* add Contiguration -> Options -> Transparency (0% 25% 50% 75% 100%) (add cb)
* allow for multiple note creation
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/e_modules/src/modules/notes/e_mod_main.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- e_mod_main.c 30 Mar 2005 18:08:37 -0000 1.7
+++ e_mod_main.c 30 Mar 2005 22:46:03 -0000 1.8
@@ -25,6 +25,10 @@
static int _note_face_init (Note_Face *nf);
static void _note_face_free (Note_Face *nf);
+static int _note_face_add (Note *n);
+static void _note_face_focus (void *data, Evas *e, Evas_Object *obj,
void *event_info);
+static void _note_face_unfocus (void *data, Evas *e, Evas_Object *obj,
void *event_info);
+
char *_note_module_dir;
static int _note_count;
@@ -108,7 +112,6 @@
_note_init (E_Module *m)
{
Note *n;
- Evas_List *managers, *l, *l2;
_note_count = 0;
n = calloc(1, sizeof(Note));
@@ -136,6 +139,16 @@
E_CONFIG_LIMIT(n->conf->width, 48, 800);
E_CONFIG_LIMIT(n->conf->bgcolor, 0, 10);
+ if(!_note_face_add(n))
+ return NULL;
+
+ return n;
+}
+
+int
+_note_face_add(Note *n)
+{
+ Evas_List *managers, *l, *l2;
managers = e_manager_list ();
for (l = managers; l; l = l->next)
{
@@ -144,32 +157,38 @@
man = l->data;
for (l2 = man->containers; l2; l2 = l2->next)
{
+
E_Container *con;
Note_Face *nf;
con = l2->data;
+
nf = calloc(1, sizeof(Note_Face));
if (nf)
{
- n->face = nf;
+ n->faces = evas_list_append(n->faces, nf);
nf->note = n;
nf->con = con;
nf->evas = con->bg_evas;
if (!_note_face_init(nf))
- return NULL;
+ return 0;
}
}
- }
-
- return n;
+ }
+ return 1;
}
static void
_note_shutdown (Note *n)
{
+ Evas_List *l;
free(n->conf);
E_CONFIG_DD_FREE(n->conf_edd);
- _note_face_free(n->face);
+ l = n->faces;
+ while(l) {
+ _note_face_free(l->data);
+ l = l->next;
+ }
free(n);
}
@@ -260,7 +279,11 @@
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, "Transparency");
e_menu_item_submenu_set(mi, n->config_menu_trans);
-
+
+ mi = e_menu_item_new(mn);
+ e_menu_item_label_set(mi, "Add Note");
+ e_menu_item_callback_set (mi, _note_face_add, n);
+
return mn;
}
@@ -271,9 +294,9 @@
Evas_Object *bg;
n = (Note *)data;
- bg = evas_object_rectangle_add(n->face->evas);
- evas_object_color_set(bg, 187, 243, 168, 100);
- esmart_textarea_bg_set(n->face->note_object, bg);
+// bg = evas_object_rectangle_add(n->face->evas);
+// evas_object_color_set(bg, 187, 243, 168, 100);
+// esmart_textarea_bg_set(n->face->note_object, bg);
}
static void
@@ -283,9 +306,9 @@
Evas_Object *bg;
n = (Note *)data;
- bg = evas_object_rectangle_add(n->face->evas);
- evas_object_color_set(bg, 245, 248, 27, 100);
- esmart_textarea_bg_set(n->face->note_object, bg);
+// bg = evas_object_rectangle_add(n->face->evas);
+// evas_object_color_set(bg, 245, 248, 27, 100);
+// esmart_textarea_bg_set(n->face->note_object, bg);
}
static void
@@ -295,9 +318,9 @@
Evas_Object *bg;
n = (Note *)data;
- bg = evas_object_rectangle_add(n->face->evas);
- evas_object_color_set(bg, 255, 255, 255, 100);
- esmart_textarea_bg_set(n->face->note_object, bg);
+// bg = evas_object_rectangle_add(n->face->evas);
+// evas_object_color_set(bg, 255, 255, 255, 100);
+// esmart_textarea_bg_set(n->face->note_object, bg);
}
static void
@@ -307,9 +330,9 @@
Evas_Object *bg;
n = (Note *)data;
- bg = evas_object_rectangle_add(n->face->evas);
- evas_object_color_set(bg, 149, 207, 226, 100);
- esmart_textarea_bg_set(n->face->note_object, bg);
+// bg = evas_object_rectangle_add(n->face->evas);
+// evas_object_color_set(bg, 149, 207, 226, 100);
+// esmart_textarea_bg_set(n->face->note_object, bg);
}
@@ -339,6 +362,26 @@
// }
//}
+static void
+_note_face_focus(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ Evas_Event_Mouse_In *ev = event_info;
+ Note_Face *nf = data;
+ printf("Note focused!\n");
+ esmart_textarea_focus_set(nf->note_object, 1);
+}
+
+static void
+_note_face_unfocus(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ Evas_Event_Mouse_In *ev = event_info;
+ Note_Face *nf = data;
+ printf("Note unfocused!\n");
+ esmart_textarea_focus_set(nf->note_object, 0);
+}
+
static int
_note_face_init (Note_Face *nf)
{
@@ -349,15 +392,28 @@
/* set up the note object */
o = esmart_textarea_add (nf->evas);
+ nf->note_object = o;
evas_output_viewport_get(nf->evas, NULL, NULL, &ww, &hh);
nf->ww = ww;
evas_object_move (o, 0, hh - nf->note->conf->height + 3);
//evas_object_resize (o, nf->ww, nf->note->conf->height);
evas_object_resize(o, nf->note->conf->width, nf->note->conf->height);
evas_object_pass_events_set(o, 1);
- evas_object_layer_set (o, 20);
- evas_object_show (o);
- nf->note_object = o;
+ evas_object_layer_set (o, 1);
+ esmart_textarea_focus_set(o, 0);
+ evas_object_show (o);
+
+ o = evas_object_rectangle_add(nf->evas);
+ nf->event_object = o;
+ evas_object_layer_set(o, 2);
+ evas_object_repeat_events_set(o, 1);
+ evas_object_color_set(o, 100, 0, 0, 100);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN,
+ _note_face_focus, nf);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT,
+ _note_face_unfocus, nf);
+ evas_object_show(o);
+
evas_event_freeze(nf->con->bg_evas);
@@ -406,11 +462,16 @@
{
case E_GADMAN_CHANGE_MOVE_RESIZE:
e_gadman_client_geometry_get(nf->gmc, &x, &y, &w, &h);
+
evas_object_move(nf->note_object, x, y);
evas_object_resize(nf->note_object, w, h);
+
+ evas_object_move(nf->event_object, x, y);
+ evas_object_resize(nf->event_object, w, h);
break;
case E_GADMAN_CHANGE_RAISE:
evas_object_raise(nf->note_object);
+ evas_object_raise(nf->event_object);
break;
case E_GADMAN_CHANGE_EDGE:
case E_GADMAN_CHANGE_ZONE:
@@ -428,10 +489,12 @@
e_object_del(E_OBJECT(nf->gmc));
evas_object_del (nf->note_object);
+ evas_object_del (nf->event_object);
_note_count--;
free (nf);
}
+/* this is NOT used */
static int
_note_cb_event_container_resize(void *data, int type, void *event)
{
@@ -449,5 +512,8 @@
evas_object_move (o, 0, hh - nf->note->conf->height + 3);
evas_object_resize (o, nf->note->conf->width, nf->note->conf->height);
+ o = nf->event_object;
+ evas_object_move (o, 0, hh - nf->note->conf->height + 3);
+ evas_object_resize (o, nf->note->conf->width, nf->note->conf->height);
return 1;
}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/apps/e_modules/src/modules/notes/e_mod_main.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- e_mod_main.h 30 Mar 2005 13:38:29 -0000 1.3
+++ e_mod_main.h 30 Mar 2005 22:46:03 -0000 1.4
@@ -24,7 +24,7 @@
E_Menu *config_menu;
E_Menu *config_menu_bg;
E_Menu *config_menu_trans;
- Note_Face *face;
+ Evas_List *faces;
E_Config_DD *conf_edd;
Config *conf;
@@ -37,6 +37,7 @@
Evas *evas;
Evas_Object *note_object;
Evas_Object *note_edje;
+ Evas_Object *event_object;
Evas_Coord xx, yy, ww;
E_Gadman_Client *gmc;
E_Menu *menu;
-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs