Enlightenment CVS committal Author : handyande Project : misc Module : enotes
Dir : misc/enotes/src Modified Files: controlcentre.c controlcentre.h ipc.c note.c note.h storage.c storage.h Log Message: Remember shaded state of notes and the control centre Well, for themes that support it (postit) =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/controlcentre.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -3 -r1.24 -r1.25 --- controlcentre.c 16 Mar 2006 00:13:17 -0000 1.24 +++ controlcentre.c 18 Mar 2006 20:46:03 -0000 1.25 @@ -118,6 +118,12 @@ evas_object_name_set(cc->edje, "edje"); evas_object_pass_events_set(cc->edje, 0); evas_object_show(cc->edje); + if (pos->shaded) + edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_SHADE "_GO", + ""); + else + edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_UNSHADE "_GO", + ""); /* EDJE and ECORE min, max and resizing */ edje_object_size_max_get(cc->edje, &edje_w, &edje_h); @@ -130,8 +136,8 @@ /* Ecore Callbacks */ ecore_evas_callback_resize_set(cc->win, cc_resize); - ecore_evas_callback_destroy_set(cc->win, cc_close); - ecore_evas_callback_delete_request_set(cc->win, cc_close); + ecore_evas_callback_destroy_set(cc->win, cc_close_win); + ecore_evas_callback_delete_request_set(cc->win, cc_close_win); /* Edje Callbacks */ edje_object_signal_callback_add(cc->edje, @@ -145,6 +151,10 @@ (void *) cc_settings, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_NEW, "", (void *) cc_newnote, NULL); + edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SHADE, "", + (void *) cc_shade, NULL); + edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_UNSHADE, "", + (void *) cc_unshade, NULL); free(pos); return; @@ -159,6 +169,7 @@ p->y = ecore_config_int_get("controlcentre.y"); p->width = ecore_config_int_get("controlcentre.w"); p->height = ecore_config_int_get("controlcentre.h"); + p->shaded = ecore_config_boolean_get("controlcentre.shaded"); return (p); } @@ -209,53 +220,61 @@ } /** - * @param ee: The Ecore_Evas that has been closed by the wm. - * @brief: Ecore + Edje signal callback for the closing of the window + * @brief: Edje signal callback for the closing of the window * (window-manager side). This function simply ends the loop which * concequently allows for the freeing of variables, etc... before * enotes exits. */ void -cc_close(Ecore_Evas * ee) +cc_close_win(Ecore_Evas * data) +{ + ecore_main_loop_quit(); +} + +/** + * @brief: Ecore signal callback for the closing of the window + * (window-manager side). This function simply ends the loop which + * concequently allows for the freeing of variables, etc... before + * enotes exits. + */ +void +cc_close(void *data, Evas_Object * obj, const char *emission, + const char *source) { ecore_main_loop_quit(); - return; } /** - * @param data: This variable isn't used. It is data that could be supplied when - * the callback is made. * @brief: Edje signal callback for the clicking or selecting of the saveload option. * This calls up the saveload window. */ void -cc_saveload(void *data) +cc_saveload(void *data, Evas_Object * obj, const char *emission, + const char *source) { setup_saveload(); return; } /** - * @param data: This variable isn't used. It is data that could be supplied when - * the callback is made. * @brief: Edje signal callback for the clicking or selecting of the new note option. * This calls up a new note. */ void -cc_newnote(void *data) +cc_newnote(void *data, Evas_Object * obj, const char *emission, + const char *source) { new_note(); return; } /** - * @param data: This variable isn't used. It is data that could be supplied when - * the callback is made. * @brief: Edje signal callback for the clicking or selecting of the settings option. * This calls up the settings window. */ void -cc_settings(void *data) +cc_settings(void *data, Evas_Object * obj, const char *emission, + const char *source) { if (!ecore_exe_run("examine enotes", NULL)) msgbox("No Examine", "Please Install Examine for Settings!"); @@ -263,12 +282,11 @@ } /** - * @param data: This variable isn't used. It is data that could be supplied when - * the callback is made. * @brief: Edje signal callback for the clicking or selecting of the minimize button. */ void -cc_minimize(void *data) +cc_minimize(void *data, Evas_Object * obj, const char *emission, + const char *source) { /* FIXME: The line below should be removed when * * ecore_evas is fixed. */ @@ -278,6 +296,27 @@ return; } +/** + * @brief: Edje signal callback for the clicking or selecting of the shaded state. + */ +void +cc_shade(void *data, Evas_Object * obj, const char *emission, + const char *source) +{ + ecore_config_boolean_set("controlcentre.shaded", 1); +} + +/** + * @brief: Edje signal callback for the clicking or unselecting of the + * unshaded state. + */ +void +cc_unshade(void *data, Evas_Object * obj, const char *emission, + const char *source) +{ + ecore_config_boolean_set("controlcentre.shaded", 0); +} + /* Theme Change */ void cc_update_theme() =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/controlcentre.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- controlcentre.h 23 Mar 2005 10:41:43 -0000 1.11 +++ controlcentre.h 18 Mar 2006 20:46:03 -0000 1.12 @@ -45,6 +45,8 @@ #define EDJE_SIGNAL_CC_SAVELOAD "ENOTES_NOTES_SAVELOAD" #define EDJE_SIGNAL_CC_SETTINGS "ENOTES_SETTINGS" #define EDJE_SIGNAL_CC_MINIMIZE "ENOTES_CONTROL_MINIMIZE" +#define EDJE_SIGNAL_CC_SHADE "ENOTES_CONTROL_SHADE" +#define EDJE_SIGNAL_CC_UNSHADE "ENOTES_CONTROL_UNSHADE" /* Configuration */ #define DEF_CC_CONFIG_LOC "%s/.e/notes/cc.xml" @@ -61,6 +63,7 @@ int y; int width; int height; + int shaded; } CCPos; extern ControlCentre *controlcentre; @@ -76,11 +79,21 @@ /* Callbacks */ void cc_resize(Ecore_Evas * ee); -void cc_close(void *data); -void cc_saveload(void *data); -void cc_newnote(void *data); -void cc_settings(void *data); -void cc_minimize(void *data); +void cc_close_win(Ecore_Evas * ee); +void cc_close(void *data, Evas_Object * obj, const char *emission, + const char *source); +void cc_saveload(void *data, Evas_Object * obj, const char *emission, + const char *source); +void cc_newnote(void *data, Evas_Object * obj, const char *emission, + const char *source); +void cc_settings(void *data, Evas_Object * obj, const char *emission, + const char *source); +void cc_minimize(void *data, Evas_Object * obj, const char *emission, + const char *source); +void cc_shade(void *data, Evas_Object * obj, const char *emission, + const char *source); +void cc_unshade(void *data, Evas_Object * obj, const char *emission, + const char *source); /* Theme Change */ void cc_update_theme(); =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/ipc.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- ipc.c 16 Mar 2006 00:13:17 -0000 1.14 +++ ipc.c 18 Mar 2006 20:46:03 -0000 1.15 @@ -115,8 +115,8 @@ p->data); content = fix_newlines(note->content); new_note_with_values(note->x, note->y, - note->width, - note->height, content); + note->width, note->height, + note->shaded, content); free(content); free_note_stor(note); } @@ -128,14 +128,14 @@ free(controlcentre); controlcentre = NULL; } else { - new_note_with_values(0, 0, 325, 0, + new_note_with_values(0, 0, 325, 0, 0, "An IPC command was recieved which\nwants to close the controlcentre.\n\nSince the control centre isn't currently\nopen, it wasn't possible to do so!"); } } else if (p->cmd == CONTROLCENTREOPEN) { if (controlcentre == NULL) { setup_cc(); } else { - new_note_with_values(0, 0, 325, 0, + new_note_with_values(0, 0, 325, 0, 0, "An IPC command was recieved which\nwants to open the control centre, but the\ncontrol centre is already open!"); } } else if (p->cmd == DEFNOTE) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/note.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -3 -r1.60 -r1.61 --- note.c 16 Mar 2006 00:13:17 -0000 1.60 +++ note.c 18 Mar 2006 20:46:03 -0000 1.61 @@ -37,26 +37,28 @@ dml("Creating a Note", 2); new = append_note(); - setup_note(&new, 0, 0, 0, 0, DEF_CONTENT); + setup_note(&new, 0, 0, 0, 0, 0, DEF_CONTENT); return; } void -new_note_with_values(int x, int y, int width, int height, char *content) +new_note_with_values(int x, int y, int width, int height, int shaded, + char *content) { /*Note *p = */ - new_note_with_values_return(x, y, width, height, content); + new_note_with_values_return(x, y, width, height, shaded, content); } Note * -new_note_with_values_return(int x, int y, int width, int height, char *content) +new_note_with_values_return(int x, int y, int width, int height, int shaded, + char *content) { Evas_List *new; dml("Creating a Note", 2); new = append_note(); - setup_note(&new, x, y, width, height, content); + setup_note(&new, x, y, width, height, shaded, content); return (evas_list_data(new)); } @@ -153,8 +155,10 @@ note_close_dialog_delete_cb(Ewl_Widget * w, void *ev, void *data) { Note *p; - char *path = malloc(PATH_MAX); + char *path; + p = data; + path = malloc(PATH_MAX); note_close_dialog_unload_cb(w, ev, data); dml("Deleting Saved Note", 2); @@ -204,7 +208,7 @@ * @brief: Sets up the note objects, window, callbacks, etc... */ void -setup_note(Evas_List ** note, int x, int y, int width, int height, +setup_note(Evas_List ** note, int x, int y, int width, int height, int shaded, char *content) { Evas_List *pl; @@ -300,6 +304,14 @@ evas_object_move(p->edje, 0, 0); evas_object_layer_set(p->edje, 1); + p->shaded = shaded; + if (shaded) + edje_object_signal_emit(p->edje, EDJE_SIGNAL_NOTE_SHADE "_GO", + ""); + else + edje_object_signal_emit(p->edje, EDJE_SIGNAL_NOTE_UNSHADE "_GO", + ""); + edje_object_size_max_get(p->edje, &edje_w, &edje_h); ecore_evas_size_max_set(p->win, edje_w, edje_h); edje_object_size_min_get(p->edje, &edje_w, &edje_h); @@ -384,6 +396,10 @@ (void *) note_edje_minimise, *note); edje_object_signal_callback_add(p->edje, EDJE_SIGNAL_NOTE_SAVE, "", (void *) note_edje_save, *note); + edje_object_signal_callback_add(p->edje, EDJE_SIGNAL_NOTE_SHADE, "", + (void *) note_edje_shade, *note); + edje_object_signal_callback_add(p->edje, EDJE_SIGNAL_NOTE_UNSHADE, "", + (void *) note_edje_unshade, *note); /* Free Temporarily used Variables */ if (datestr != NULL) @@ -610,6 +626,26 @@ return; } +void +note_edje_shade(Evas_List * note, Evas_Object * o, + const char *emission, const char *source) +{ + Note *p; + + p = evas_list_data(note); + p->shaded = 1; +} + +void +note_edje_unshade(Evas_List * note, Evas_Object * o, + const char *emission, const char *source) +{ + Note *p; + + p = evas_list_data(note); + p->shaded = 0; +} + /* Misc */ /** =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/note.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- note.h 16 Mar 2006 00:13:17 -0000 1.27 +++ note.h 18 Mar 2006 20:46:03 -0000 1.28 @@ -35,6 +35,8 @@ #define EDJE_SIGNAL_NOTE_CLOSE "ENOTES_QUIT" #define EDJE_SIGNAL_NOTE_MINIMISE "ENOTES_MINIMIZE" #define EDJE_SIGNAL_NOTE_SAVE "ENOTES_SAVE" +#define EDJE_SIGNAL_NOTE_SHADE "ENOTES_SHADE" +#define EDJE_SIGNAL_NOTE_UNSHADE "ENOTES_UNSHADE" #define EDJE_CONTAINER "EnoteContainer" #define EDJE_TEXT_USER "EnoteUser" @@ -73,6 +75,7 @@ Evas_Object *edje; Evas_Object *dragger; Evas_Object *eventer; + int shaded; Evas_Object *eo; Ewl_Widget *emb; @@ -90,19 +93,14 @@ int stage; } _note; -typedef struct { - int x, y, w, h; - char *content; -} NoteInfo; - Evas_List *gbl_notes; /* High Level */ void new_note(void); void new_note_with_values(int x, int y, int width, int height, - char *content); + int shaded, char *content); Note *new_note_with_values_return(int x, int y, int width, int height, - char *content); + int shaded, char *content); /* Lists and Allocation */ Evas_List *append_note(void); @@ -110,7 +108,7 @@ /* GUI Setup */ void setup_note(Evas_List ** note, int x, int y, int width, - int height, char *content); + int height, int shaded, char *content); void configure_scrollbars(Ewl_Widget * pane, char *edjefn); void configure_scrollbars_default(Ewl_Widget * pane); @@ -130,6 +128,10 @@ const char *emission, const char *source); void note_edje_save(Evas_List * note, Evas_Object * o, const char *emission, const char *source); +void note_edje_shade(Evas_List * note, Evas_Object * o, + const char *emission, const char *source); +void note_edje_unshade(Evas_List * note, Evas_Object * o, + const char *emission, const char *source); /* Misc */ char *get_date_string(void); =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/storage.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- storage.c 16 Mar 2006 00:13:17 -0000 1.17 +++ storage.c 18 Mar 2006 20:46:03 -0000 1.18 @@ -116,6 +116,7 @@ note = new_note_with_values_return(p->x, p->y, p->width, p->height, + p->shaded, p->content); edje_object_signal_emit(note->edje, NOTE_LOADED_SIGNAL, ""); @@ -203,6 +204,7 @@ n->height = h; n->x = x; n->y = y; + n->shaded = note->shaded; n->content = strdup(get_content_by_note(tmp)); append_note_stor(n); free_note_stor(n); @@ -260,6 +262,16 @@ return (NULL); } + /* Add the new shaded field, but make it "optional" */ + if (e) { + p->shaded = atoi(strsep(&e, DEF_VALUE_SEPERATION)); + if (&e == NULL) { + p->shaded = 0; + } + } else { + p->shaded = 0; + } + return (p); } @@ -274,10 +286,10 @@ { char *retval = malloc(MAX_VALUE); - snprintf(retval, MAX_VALUE, "%s%s%d%s%d%s%d%s%d", p->content, + snprintf(retval, MAX_VALUE, "%s%s%d%s%d%s%d%s%d%s%d", p->content, DEF_VALUE_SEPERATION, p->width, DEF_VALUE_SEPERATION, p->height, DEF_VALUE_SEPERATION, p->x, DEF_VALUE_SEPERATION, - p->y); + p->y, DEF_VALUE_SEPERATION, p->shaded); return (retval); } =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/storage.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- storage.h 16 Mar 2006 00:05:56 -0000 1.10 +++ storage.h 18 Mar 2006 20:46:03 -0000 1.11 @@ -40,6 +40,7 @@ int y; int width; int height; + int shaded; } NoteStor; /* Freeing */ ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs