Enlightenment CVS committal

Author  : fletch3k
Project : misc
Module  : enotes

Dir     : misc/enotes/src


Modified Files:
        Makefile.am config.c config.h controlcentre.c controlcentre.h 
        ipc.h main.c main.h note.c note.h welcome.c 
Added Files:
        menu.c menu.h 
Removed Files:
        settings.c settings.h usage.c usage.h 


Log Message:
Ecore_Config use, bug fixes, new bugs - updated TODO

===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Makefile.am 27 Aug 2004 20:40:37 -0000      1.4
+++ Makefile.am 6 Oct 2004 17:12:34 -0000       1.5
@@ -16,14 +16,10 @@
 controlcentre.h \
 storage.c \
 storage.h \
-usage.c \
-usage.h \
 msgbox.c \
 msgbox.h \
 saveload.c \
 saveload.h \
-settings.h \
-settings.c \
 ipc.c \
 ipc.h \
 xml.c \
@@ -31,6 +27,8 @@
 debug.c \
 debug.h \
 welcome.c \
-welcome.h
+welcome.h \
+menu.c \
+menu.h
 
 enotes_LDADD = @ewl_libs@ @ecore_libs@ @evas_libs@ @edje_libs@ @edb_libs@ 
@imlib2_libs@ @libxml2_libs@ @esmart_libs@ -lesmart_draggies
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/config.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- config.c    24 Sep 2004 13:59:56 -0000      1.12
+++ config.c    6 Oct 2004 17:12:34 -0000       1.13
@@ -56,33 +56,14 @@
        return;
 }
 
-/**
- * @param p: The MainConfig variable to store the read settings into.
- * @brief: Reads the global configuration settings and stores them into p.
- */
-void
-read_global_configuration(MainConfig * p)
-{
-       char           *locfn = malloc(PATH_MAX);
-
-       snprintf(locfn, PATH_MAX, "%s/config.xml", PACKAGE_DATA_DIR);
-       read_configuration(p, locfn);
-       free(locfn);
-       return;
-}
+/* LISTENERS */
 
-/**
- * @param p: The MainConfig variable to store the read settings into.
- * @brief: Reads the local configuration and stores the settings into p.
- */
-void
-read_local_configuration(MainConfig * p)
+theme_listener(const char *key, const Ecore_Config_Type type, const int tag,
+              void *data)
 {
-       char           *locfn = malloc(PATH_MAX);
-
-       snprintf(locfn, PATH_MAX, DEF_CONFIG_LOC, getenv("HOME"));
-       read_configuration(p, locfn);
-       free(locfn);
+       main_config->theme = ecore_config_theme_get(key);
+       cc_update_theme();
+       notes_update_themes();
        return;
 }
 
@@ -92,103 +73,49 @@
  * @brief: Reads the configuration file pointed to by fn, and stores the
  *         settings into p.
  */
-void
-read_configuration(MainConfig * p, char *fn)
+int
+read_configuration(MainConfig * p)
 {
-       XmlReadHandle  *h;
-       XmlEntry       *tmp;
+       ecore_config_int_create("enotes.debug", 0, 'd', "debug",
+                               "Debugging Level [0-2]");
+       ecore_config_string_create("enotes.engine", "software", 'r',
+                                  "render-method",
+                                  "Rendering Method [GL/Software]");
+       ecore_config_boolean_create("enotes.autosave", 0, 'A', "auto-save",
+                                   "Use the Autosave Feature?");
+       ecore_config_boolean_create("enotes.controlcentre", 1, 'C',
+                                   "control-centre",
+                                   "Use the Control Centre?");
+       ecore_config_boolean_create("enotes.welcome", 1, 'w', "welcome",
+                                   "Display the Welcome Message?");
+       ecore_config_boolean_create("enotes.ontop", 1, 'o', "ontop",
+                                   "Keep Enotes Windows Ontop?");
+       ecore_config_boolean_create("enotes.sticky", 1, 's', "sticky",
+                                   "Make E-Notes Sticky?");
+
+       ecore_config_theme_create("enotes.theme", "postit", 't', "theme",
+                                 "GUI Theme");
+       ecore_config_theme_preview_group_set("enotes.theme", "preview");
+       ecore_config_theme_search_path_append(PACKAGE_DATA_DIR "/themes/");
 
-       h = xml_read(fn);
-       while (h->cur != NULL) {
-               tmp = xml_read_entry_get_entry(h);
-               processopt(tmp, p);
-               free_xmlentry(tmp);
-               xml_read_next_entry(h);
-       }
-       xml_read_end(h);
-       return;
-}
+       ecore_config_load();
 
-/**
- * @param info: The xml tag to process.
- * @param p: The MainConfig variable to apply the value to.
- * @brief: Processed an xml tag and applies the individual setting
- *         it reads to p.
- */
-void
-processopt(XmlEntry * info, MainConfig * p)
-{
-       if (!strcmp(info->name, "render_method")) {
-               if (p->render_method != NULL)
-                       free(p->render_method);
-               p->render_method = strdup(info->value);
-       } else if (!strcmp(info->name, "theme")) {
-               if (p->theme != NULL)
-                       free(p->theme);
-               p->theme = strdup(info->value);
-       } else if (!strcmp(info->name, "controlcentre")) {
-               if (info->value != NULL)
-                       p->controlcentre = atoi(info->value);
-       } else if (!strcmp(info->name, "debug")) {
-               if (info->value != NULL)
-                       p->debug = atoi(info->value);
-       } else if (!strcmp(info->name, "autosave")) {
-               if (info->value != NULL)
-                       p->autosave = atoi(info->value);
-       } else if (!strcmp(info->name, "welcome")) {
-               if (info->value != NULL)
-                       p->welcome = atoi(info->value);
-       } else if (!strcmp(info->name, "sticky")) {
-               if (info->value != NULL)
-                       p->sticky = atoi(info->value);
-       } else if (!strcmp(info->name, "ontop")) {
-               if (info->value != NULL)
-                       p->ontop = atoi(info->value);
+       if (ecore_config_args_parse() != ECORE_CONFIG_PARSE_CONTINUE) {
+               return (-1);
        }
 
-       return;
-}
+       p->render_method = ecore_config_string_get("enotes.engine");
+       p->theme = ecore_config_theme_get("enotes.theme");
+       p->controlcentre = ecore_config_boolean_get("enotes.controlcentre");
+       p->debug = ecore_config_boolean_get("enotes.debug");
+       p->autosave = ecore_config_boolean_get("enotes.autosave");
+       p->welcome = ecore_config_boolean_get("enotes.welcome");
+       p->ontop = ecore_config_boolean_get("enotes.ontop");
+       p->sticky = ecore_config_boolean_get("enotes.sticky");
 
-/**
- * @brief: Check whether a local configuration exists, and if not it
- *         will create the necessary files and folders so the user can
- *         immediately begin to edit his/her configuration.
- */
-void
-check_local_configuration(void)
-{
-       char           *homedir_e = malloc(PATH_MAX);
-       char           *homedir_e_notes = malloc(PATH_MAX);
-       char           *homedir_e_notes_config = malloc(PATH_MAX);
-       char           *global_config = malloc(PATH_MAX);
-       char           *execstr = malloc(PATH_MAX * 2);
-       FILE           *input;
-       char            buf;
-       XmlReadHandle  *p;
-
-       snprintf(homedir_e, PATH_MAX, "%s/.e", getenv("HOME"));
-       snprintf(homedir_e_notes, PATH_MAX, "%s/.e/notes", getenv("HOME"));
-       snprintf(homedir_e_notes_config, PATH_MAX,
-                "%s/.e/notes/config.xml", getenv("HOME"));
-       snprintf(global_config, PATH_MAX, "%s/config.xml", PACKAGE_DATA_DIR);
-
-       mkdir(homedir_e, 0700);
-       mkdir(homedir_e_notes, 0700);
-
-       snprintf(execstr, PATH_MAX * 2, "%s %s %s", COPY_COMMAND,
-                global_config, homedir_e_notes_config);
-
-       if ((input = fopen(homedir_e_notes_config, "r")) == NULL) {
-               system(execstr);
-       } else {
-               fclose(input);
-       }
+       printf("Welcome: %d\n", p->welcome);
 
-       free(homedir_e);
-       free(homedir_e_notes);
-       free(homedir_e_notes_config);
-       free(global_config);
-       free(execstr);
+       ecore_config_listen("theme", "enotes.theme", theme_listener, 0, NULL);
 
-       return;
+       return (0);
 }
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/config.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- config.h    15 Sep 2004 21:01:22 -0000      1.8
+++ config.h    6 Oct 2004 17:12:34 -0000       1.9
@@ -18,14 +18,13 @@
 #include <string.h>
 #include <limits.h>
 
+#include <Ecore.h>
+#include <Ecore_Config.h>
+
 #include "debug.h"
 #include "../config.h"
 #include "xml.h"
 
-
-#define DEF_CONFIG_LOC "%s/.e/notes/config.xml"
-#define COPY_COMMAND "cp"
-
 typedef struct {
        char           *render_method;
        char           *theme;
@@ -37,22 +36,11 @@
        int             sticky;
 } MainConfig;
 
-#ifndef XMLENTRY_DEF
-#define XMLENTRY_DEF 1
-typedef struct {
-       char           *name;
-       char           *value;
-} XmlEntry;
-#endif
+extern MainConfig *main_config;
 
 MainConfig     *mainconfig_new(void);
 void            mainconfig_free(MainConfig * p);
 
-void            read_global_configuration(MainConfig * p);
-void            read_local_configuration(MainConfig * p);
-void            read_configuration(MainConfig * p, char *fn);
-void            check_local_configuration(void);
-
-void            processopt(XmlEntry * info, MainConfig * p);
+int             read_configuration(MainConfig * p);
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/controlcentre.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- controlcentre.c     24 Sep 2004 13:59:56 -0000      1.16
+++ controlcentre.c     6 Oct 2004 17:12:34 -0000       1.17
@@ -22,6 +22,13 @@
 void
 setup_cc(void)
 {
+       setup_cc_with_pos(-1, -1);
+       return;
+}
+
+void
+setup_cc_with_pos(int x, int y)
+{
        ControlCentre  *cc;
        char           *edjefn = malloc(PATH_MAX);
        char           *fontpath = malloc(PATH_MAX);
@@ -33,6 +40,11 @@
 
        pos = get_cc_pos();
 
+       if (x >= 0 || y >= 0) {
+               pos->x = x;
+               pos->y = y;
+       }
+
        /* Setup the Window */
        if (!strcmp(main_config->render_method, "gl")) {
 #ifdef HAVE_ECORE_EVAS_GL
@@ -302,7 +314,7 @@
 void
 cc_newnote(void *data)
 {
-       new_note(NOTE_CONTENT);
+       new_note();
        return;
 }
 
@@ -315,7 +327,8 @@
 void
 cc_settings(void *data)
 {
-       setup_settings();
+       if (!ecore_exe_run("examine enotes", NULL))
+               msgbox("No Examine", "Please Install Examine for Settings!");
        return;
 }
 
@@ -334,3 +347,31 @@
        ecore_evas_iconified_set((Ecore_Evas *) data, 1);
        return;
 }
+
+/*  Theme Change  */
+void
+cc_update_theme()
+{
+       int             edje_w, edje_h;
+       char           *edjefn;
+
+       if (controlcentre == NULL)
+               return;
+
+       edjefn = malloc(PATH_MAX);
+       snprintf(edjefn,
+                PATH_MAX, NOTE_EDJE, PACKAGE_DATA_DIR, main_config->theme);
+       edje_object_file_set(controlcentre->edje, edjefn, CC_PART);
+       free(edjefn);
+
+       /* EDJE and ECORE min, max and resizing */
+       edje_object_size_max_get(controlcentre->edje, &edje_w, &edje_h);
+       ecore_evas_size_max_set(controlcentre->win, edje_w, edje_h);
+       edje_object_size_min_get(controlcentre->edje, &edje_w, &edje_h);
+       ecore_evas_size_min_set(controlcentre->win, edje_w, edje_h);
+       ecore_evas_resize(controlcentre->win, (int) edje_w, (int) edje_h);
+       evas_object_resize(controlcentre->edje, edje_w, edje_h);
+       evas_object_resize(controlcentre->dragger, edje_w, edje_h);
+
+       return;
+}
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/controlcentre.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- controlcentre.h     14 Sep 2004 21:03:04 -0000      1.9
+++ controlcentre.h     6 Oct 2004 17:12:34 -0000       1.10
@@ -28,6 +28,7 @@
 
 #include "debug.h"
 #include "config.h"
+#include "note.h"
 #include "../config.h"
 
 
@@ -67,6 +68,7 @@
 
 /* Setting the Control Centre up */
 void            setup_cc(void);
+void            setup_cc_with_pos(int x, int y);
 
 /* Configuration */
 CCPos          *get_cc_pos();
@@ -80,4 +82,7 @@
 void            cc_settings(void *data);
 void            cc_minimize(void *data);
 
+/*  Theme Change  */
+void            cc_update_theme();
+
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/ipc.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ipc.h       24 Sep 2004 13:59:56 -0000      1.6
+++ ipc.h       6 Oct 2004 17:12:34 -0000       1.7
@@ -27,7 +27,8 @@
 #include "controlcentre.h"
 
 #define IPC_NAME "enotes"
-#define IPC_PORT 2323
+//#define IPC_PORT 2323
+#define IPC_PORT 1234
 
 typedef enum {                 /* More to come. :-) */
        NOTE,
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/main.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- main.c      24 Sep 2004 16:19:47 -0000      1.17
+++ main.c      6 Oct 2004 17:12:34 -0000       1.18
@@ -13,6 +13,8 @@
 
 #include "main.h"
 
+MainConfig     *main_config;
+
 /* The Main Function */
 
 /**
@@ -31,25 +33,23 @@
        ecore_ipc_init();
        dml("IPC Initiated Successfully", 1);
        /* autoload (if on) will increment this if there are notes
-          if not we may need to create a blank one */
+        * if not we may need to create a blank one */
        note_count = 0;
 
-       /* Read the Usage and Configurations */
-       main_config = mainconfig_new();
-       spec_conf = read_usage_for_configuration_fn(argc, argv);
-       if (spec_conf != NULL) {
-               read_configuration(main_config, spec_conf);
-               free(spec_conf);
-       } else {
-               read_global_configuration(main_config);
-               check_local_configuration();
-               read_local_configuration(main_config);
+       if ((ecore_config_init("enotes")) == ECORE_CONFIG_ERR_FAIL) {
+               ecore_ipc_shutdown();
+               return (-1);
        }
-       read_usage_configuration(main_config, argc, argv);
+       ecore_app_args_set(argc, (const char **) argv);
 
-       if (dispusage == 1) {
+       /* Read the Usage and Configurations */
+       main_config = mainconfig_new();
+       if (read_configuration(main_config) == -1) {
+               ecore_config_shutdown();
+               ecore_ipc_shutdown();
+               ecore_shutdown();
                mainconfig_free(main_config);
-               return (0);
+               return (-1);
        }
 
        dml("Successfully Read Configurations and Usage", 1);
@@ -57,17 +57,17 @@
        if (find_server() == 0) {
                dml("Server wasn't found.. Creating one", 1);
                /* Setup Server */
-               setup_server();
+//              setup_server();
 
                /* Initialise the E-Libs */
                ecore_init();
                ecore_x_init(NULL);
                ecore_app_args_set(argc, (const char **) argv);
-               if (!ecore_evas_init()) {       /* Initialises Evas.. I hope. :) */
+               if (!ecore_evas_init()) {
                        mainconfig_free(main_config);
                        return -1;
                }
-               ewl_init(&argc, argv);  /* Initialises Edje.. I hope. :) */
+               ewl_init(&argc, argv);
                edje_init();
 
                dml("Efl Successfully Initiated", 1);
@@ -119,7 +119,9 @@
        ecore_ipc_shutdown();
        dml("IPC Shutdown", 1);
 
-       /* Free the Configuration */
+       /* Save and Free the Configuration */
+       ecore_config_save();
+       dml("Configuration Saved", 1);
        mainconfig_free(main_config);
        dml("Configuration Structure Free'd", 1);
 
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/main.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- main.h      15 Sep 2004 21:01:23 -0000      1.8
+++ main.h      6 Oct 2004 17:12:34 -0000       1.9
@@ -21,12 +21,12 @@
 #include <Ecore.h>
 #include <Ecore_Evas.h>
 #include <Ecore_Ipc.h>
+#include <Ecore_Config.h>
 #include <Edje.h>
 
 #include "config.h"
 #include "note.h"
 #include "storage.h"
-#include "usage.h"
 #include "debug.h"
 #include "welcome.h"
 
@@ -39,6 +39,6 @@
 
 /* External Variables */
 extern int      dispusage;
-MainConfig     *main_config;
+extern MainConfig *main_config;
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/note.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- note.c      24 Sep 2004 13:59:56 -0000      1.37
+++ note.c      6 Oct 2004 17:12:34 -0000       1.38
@@ -165,8 +165,9 @@
                p->win = ecore_evas_software_x11_new(NULL, 0, x, y, width,
                                                     height);
 
+       ecore_evas_borderless_set(p->win, 1);
+       ecore_evas_shaped_set(p->win, 1);
        ecore_evas_title_set(p->win, "An E-Note");
-       ecore_evas_name_class_set(p->win, "Enotes", "Enotes");
 
        if (main_config->ontop == 1)
                if (!strcmp(main_config->render_method, "gl")) {
@@ -184,8 +185,6 @@
        else
                ecore_evas_sticky_set(p->win, 0);
 
-       ecore_evas_borderless_set(p->win, 1);
-       ecore_evas_shaped_set(p->win, 1);
        ecore_evas_show(p->win);
 
 
@@ -215,6 +214,17 @@
        esmart_draggies_button_set(p->dragger, 1);
        evas_object_show(p->dragger);
 
+       p->eventer = evas_object_rectangle_add(p->win);
+       evas_object_color_set(p->eventer, 0, 0, 0, 0);
+       evas_object_resize(p->eventer, width, height);
+       evas_object_move(p->eventer, 0.0, 0.0);
+       evas_object_layer_set(p->eventer, 9999);
+       evas_object_repeat_events_set(p->eventer, 1);
+       evas_object_show(p->eventer);
+
+       evas_object_event_callback_add(p->eventer, EVAS_CALLBACK_MOUSE_DOWN,
+                                      (void *) cb_menu_rightclick, p);
+
        /* Setup the Edje */
        p->edje = edje_object_add(p->evas);
        snprintf(edjefn,
@@ -263,52 +273,7 @@
        ewl_container_child_append((Ewl_Container *) p->emb, p->pane);
 
        if (edje_object_data_get(p->edje, EDJE_INFO_SCROLLBARS) != NULL) {
-               ewl_theme_data_str_set(p->pane,
-                                      "/vscrollbar/button_increment/file",
-                                      edjefn);
-               ewl_theme_data_str_set(p->pane,
-                                      "/vscrollbar/button_decrement/file",
-                                      edjefn);
-               ewl_theme_data_str_set(p->pane, "/vscrollbar/vseeker/file",
-                                      edjefn);
-               ewl_theme_data_str_set(p->pane,
-                                      "/vscrollbar/vseeker/button/file",
-                                      edjefn);
-               ewl_theme_data_str_set(p->pane,
-                                      "/hscrollbar/button_increment/file",
-                                      edjefn);
-               ewl_theme_data_str_set(p->pane,
-                                      "/hscrollbar/button_decrement/file",
-                                      edjefn);
-               ewl_theme_data_str_set(p->pane, "/hscrollbar/hseeker/file",
-                                      edjefn);
-               ewl_theme_data_str_set(p->pane,
-                                      "/hscrollbar/hseeker/button/file",
-                                      edjefn);
-
-               ewl_theme_data_str_set(p->pane,
-                                      "/vscrollbar/button_increment/group",
-                                      EDJE_VSCROLLBAR_BTN_INCR);
-               ewl_theme_data_str_set(p->pane,
-                                      "/vscrollbar/button_decrement/group",
-                                      EDJE_VSCROLLBAR_BTN_DECR);
-               ewl_theme_data_str_set(p->pane, "/vscrollbar/vseeker/group",
-                                      EDJE_VSCROLLBAR_SEEKER);
-               ewl_theme_data_str_set(p->pane,
-                                      "/vscrollbar/vseeker/button/group",
-                                      EDJE_SCROLLBAR_BUTTON);
-               ewl_theme_data_str_set(p->pane,
-                                      "/hscrollbar/button_increment/group",
-                                      EDJE_HSCROLLBAR_BTN_INCR);
-               ewl_theme_data_str_set(p->pane,
-                                      "/hscrollbar/button_decrement/group",
-                                      EDJE_HSCROLLBAR_BTN_DECR);
-               ewl_theme_data_str_set(p->pane, "/hscrollbar/hseeker/group",
-                                      EDJE_HSCROLLBAR_SEEKER);
-               ewl_theme_data_str_set(p->pane,
-                                      "/hscrollbar/hseeker/button/group",
-                                      EDJE_SCROLLBAR_BUTTON);
-
+               configure_scrollbars(p->pane, edjefn);
        }
 
        ewl_widget_show(p->pane);
@@ -373,6 +338,64 @@
        return;
 }
 
+void
+configure_scrollbars(Ewl_Widget * pane, char *edjefn)
+{
+       ewl_theme_data_str_set(pane,
+                              "/vscrollbar/button_increment/file", edjefn);
+       ewl_theme_data_str_set(pane,
+                              "/vscrollbar/button_decrement/file", edjefn);
+       ewl_theme_data_str_set(pane, "/vscrollbar/vseeker/file", edjefn);
+       ewl_theme_data_str_set(pane, "/vscrollbar/vseeker/button/file", edjefn);
+       ewl_theme_data_str_set(pane,
+                              "/hscrollbar/button_increment/file", edjefn);
+       ewl_theme_data_str_set(pane,
+                              "/hscrollbar/button_decrement/file", edjefn);
+       ewl_theme_data_str_set(pane, "/hscrollbar/hseeker/file", edjefn);
+       ewl_theme_data_str_set(pane, "/hscrollbar/hseeker/button/file", edjefn);
+
+       ewl_theme_data_str_set(pane,
+                              "/vscrollbar/button_increment/group",
+                              EDJE_VSCROLLBAR_BTN_INCR);
+       ewl_theme_data_str_set(pane,
+                              "/vscrollbar/button_decrement/group",
+                              EDJE_VSCROLLBAR_BTN_DECR);
+       ewl_theme_data_str_set(pane, "/vscrollbar/vseeker/group",
+                              EDJE_VSCROLLBAR_SEEKER);
+       ewl_theme_data_str_set(pane,
+                              "/vscrollbar/vseeker/button/group",
+                              EDJE_SCROLLBAR_BUTTON);
+       ewl_theme_data_str_set(pane,
+                              "/hscrollbar/button_increment/group",
+                              EDJE_HSCROLLBAR_BTN_INCR);
+       ewl_theme_data_str_set(pane,
+                              "/hscrollbar/button_decrement/group",
+                              EDJE_HSCROLLBAR_BTN_DECR);
+       ewl_theme_data_str_set(pane, "/hscrollbar/hseeker/group",
+                              EDJE_HSCROLLBAR_SEEKER);
+       ewl_theme_data_str_set(pane,
+                              "/hscrollbar/hseeker/button/group",
+                              EDJE_SCROLLBAR_BUTTON);
+       return;
+}
+
+/* MENU Callbacks */
+
+void
+cb_menu_rightclick(Note * p, Evas * e, Evas_Object * obj, void *ev_info)
+{
+       Menu           *menu = menu_create();
+
+       menu_item_add(p->menu, "New Note", (void *) cb_ewl_new_note, NULL);
+       menu_show(menu);
+       return;
+}
+
+void
+cb_ewl_new_note(void *data)
+{
+}
+
 /* ECORE Callbacks */
 
 /**
@@ -541,6 +564,70 @@
 
 /* External Interaction */
 
+int
+get_note_count()
+{
+       int             a;
+       Evas_List      *p;
+
+       p = get_cycle_begin();
+       if (p == NULL)
+               return (0);
+       else
+               a = 1;
+       while ((p = get_cycle_next_note(p)) != NULL)
+               a++;
+
+       return (a);
+}
+
+void
+notes_update_themes(void)
+{
+       int             edje_w, edje_h;
+       Evas_List      *working;
+       Note           *note;
+       int             count = get_note_count();
+
+       char           *edjefn = malloc(PATH_MAX);
+
+       snprintf(edjefn,
+                PATH_MAX, NOTE_EDJE, PACKAGE_DATA_DIR, main_config->theme);
+
+       working = get_cycle_begin();
+       if (working != NULL) {
+               while (working != NULL) {
+                       note = (Note *) evas_list_data(working);
+                       if (note != NULL) {
+                               edje_object_file_set(note->edje, edjefn,
+                                                    NOTE_PART);
+                               edje_object_size_max_get(note->edje, &edje_w,
+                                                        &edje_h);
+                               ecore_evas_size_max_set(note->win, edje_w,
+                                                       edje_h);
+                               edje_object_size_min_get(note->edje, &edje_w,
+                                                        &edje_h);
+                               ecore_evas_size_min_set(note->win, edje_w,
+                                                       edje_h);
+                               edje_object_part_swallow(note->edje,
+                                                        EDJE_CONTAINER,
+                                                        note->eo);
+                               if (edje_object_data_get
+                                   (note->edje,
+                                    EDJE_INFO_SCROLLBARS) != NULL) {
+                                       /* FIXME: What the fuck is happening when
+                                        * we enable this?: */
+//                                      configure_scrollbars(note->pane,edjefn);
+                               }
+                       }
+                       working = get_cycle_next_note(working);
+               }
+       }
+
+       free(edjefn);
+       return;
+}
+
 /**
  * @param title: The title to search for.
  * @return: Returns the Evas_List of the note requested by "title".
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/note.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- note.h      24 Sep 2004 13:59:56 -0000      1.16
+++ note.h      6 Oct 2004 17:12:34 -0000       1.17
@@ -25,6 +25,7 @@
 #include "controlcentre.h"
 #include "saveload.h"
 #include "ipc.h"
+#include "menu.h"
 #include "../config.h"
 
 
@@ -66,6 +67,7 @@
        Evas           *evas;
        Evas_Object    *edje;
        Evas_Object    *dragger;
+       Evas_Object    *eventer;
 
        Evas_Object    *eo;
        Ewl_Widget     *emb;
@@ -73,12 +75,18 @@
        Ewl_Widget     *pane;
 
        Ewl_Row        *saveload_row;
+       Menu           *menu;
 
        /* Comparison Strings and Timer */
        Ecore_Timer    *timcomp;
        char           *txt_title;
 } _note;
 
+typedef struct {
+       int             x, y, w, h;
+       char           *content;
+} NoteInfo;
+
 Evas_List      *gbl_notes;
 
 /* High Level */
@@ -93,6 +101,12 @@
 /* GUI Setup */
 void            setup_note(Evas_List ** note, int x, int y, int width,
                           int height, char *content);
+void            configure_scrollbars(Ewl_Widget * pane, char *edjefn);
+
+/* Menu Callbacks */
+void            cb_menu_rightclick(Note * p, Evas * e, Evas_Object * obj,
+                                  void *ev_info);
+void            cb_ewl_new_note(void *data);
 
 /* Ecore Callbacks */
 void            note_ecore_close(Ecore_Evas * ee);
@@ -109,9 +123,12 @@
 int             note_edje_close_timer(void *p);
 int             timer_val_compare(void *data);
 void            note_move_embed(Ewl_Widget * w, void *ev_data, void *user_data);
+void            notes_update_themes(void);
 
 
 /* External Interaction */
+int             get_note_count();
+
 Evas_List      *get_note_by_title(char *title);
 Evas_List      *get_note_by_content(char *content);
 
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/welcome.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- welcome.c   27 Aug 2004 20:40:37 -0000      1.1
+++ welcome.c   6 Oct 2004 17:12:34 -0000       1.2
@@ -112,10 +112,11 @@
                            (void *) close_credits_cb, (void *) NULL);
 
        credits->credits = ewl_text_new("");
+       ewl_object_padding_set((Ewl_Object *) credits->credits, 5, 5, 5, 5);
        ewl_text_font_set((Ewl_Text *) credits->credits, "vera", 12);
        ewl_text_color_set((Ewl_Text *) credits->credits, 0, 0, 0, 255);
        ewl_text_text_set((Ewl_Text *) credits->credits,
-                         "Credits:\n\nDeveloper: Thomas [Fletch]er\nArtwork: Corey 
Donohoe (Atmos)\n");
+                         "Credits:\n\nDeveloper: Thomas [Fletch]er\nArtwork: Corey 
Donohoe (Atmos)\nArtwork: Andrew Elcock (HandyAndE)\n");
        ewl_container_child_append((Ewl_Container *) credits->win,
                                   credits->credits);
        ewl_widget_show(credits->credits);




-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to