Enlightenment CVS committal Author : fletch3k Project : misc Module : enotes
Dir : misc/enotes/src Modified Files: config.c controlcentre.c debug.c debug.h ipc.c main.c msgbox.c msgbox.h note.c saveload.c settings.c storage.c usage.c usage.h xml.c Log Message: All new comments and more use of the msgbox code. We now have a feature list I have yet to write up. =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/config.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- config.c 17 Feb 2004 12:14:17 -0000 1.6 +++ config.c 11 Mar 2004 17:28:58 -0000 1.7 @@ -13,6 +13,11 @@ #include "config.h" +/** + * @return: Returns an allocated MainConfig variable with some default values + * set. + * @brief: Allocate and initialize a new MainConfig variable. + */ MainConfig * mainconfig_new(void) { @@ -31,6 +36,10 @@ return (p); } +/** + * @param p: The MainConfig variable to free. + * @brief: Free's an allocated MainConfig variable. + */ void mainconfig_free(MainConfig * p) { @@ -45,6 +54,10 @@ 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) { @@ -56,6 +69,10 @@ return; } +/** + * @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) { @@ -67,6 +84,12 @@ return; } +/** + * @param p: The MainConfig variable to store the read settings into. + * @param fn: The location of the configuration file to read. + * @brief: Reads the configuration file pointed to by fn, and stores the + * settings into p. + */ void read_configuration(MainConfig * p, char *fn) { @@ -84,6 +107,12 @@ return; } +/** + * @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) { @@ -108,6 +137,11 @@ return; } +/** + * @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) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/controlcentre.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- controlcentre.c 18 Feb 2004 20:27:04 -0000 1.6 +++ controlcentre.c 11 Mar 2004 17:28:58 -0000 1.7 @@ -15,6 +15,10 @@ extern MainConfig *main_config; + +/** + * @brief: Sets up the control centre window and its contents and callbacks. + */ void setup_cc(void) { @@ -91,6 +95,12 @@ return; } +/** + * @param ee: The Ecore_Evas the event occurred on. + * @brief: Ecore callback for the resising of the window. This function + * resises the edje and esmart dragger according to the new + * window size. + */ void cc_resize(Ecore_Evas * ee) { @@ -104,6 +114,13 @@ return; } +/** + * @param ee: The Ecore_Evas that has been closed by the wm. + * @brief: Ecore + 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) { @@ -111,6 +128,12 @@ 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) { @@ -118,6 +141,12 @@ 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) { @@ -125,6 +154,12 @@ 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) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/debug.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- debug.c 19 Feb 2004 18:12:56 -0000 1.4 +++ debug.c 11 Mar 2004 17:28:58 -0000 1.5 @@ -151,17 +151,50 @@ }; +/** + * @param msg: The error/warning message to display. + * @param level: The level at which the error message should be displayed. + * 0 = No Debugging Messages, 1 = Core Stages + * 2 = Event/Callback and Core Stages, + * 3 = Error Message, 4 = Warning Message, + * 5 = Notice Message + * @brief: Display a warning/error message to the console. + * @note: Levels 3, 4 and 5 aren't arbituary to the debugging level because + * they are part of the application, not its workings. + */ void debug_msg_lvl(char *msg, int level) { if (main_config == NULL) return; - if (main_config->debug >= level) + if (level == 3) { + msgbox("Error!", msg); + if (main_config->debug != 0) + printf(DEBUG_ERROR_MSG, msg); + return; + } else if (level == 4) { + msgbox("Warning!", msg); + if (main_config->debug != 0) + printf(DEBUG_WARNING_MSG, msg); + return; + } else if (level == 5) { + msgbox("Notice!", msg); + if (main_config->debug != 0) + printf(DEBUG_NOTICE_MSG, msg); + return; + } + + if (main_config->debug >= level) { printf(DEBUG_MSG, msg); + } return; } +/** + * @param msg: The error/warning message to display. + * @brief: Display a debugging message to the console. + */ void debug_msg(char *msg) { @@ -173,6 +206,12 @@ return; } +/** + * @param msg: The function being entered. + * @brief: Reports that a function has been entered. + * For heavy debugging purposes, not normally + * used. + */ void debug_func_in(char *function) { @@ -195,6 +234,11 @@ printf("E-Notes: DEBUGGING ERROR. Asked to debug missing function.\n"); } +/** + * @param msg: The function that is being exited. + * @brief: Reports that a function has completed its job + * and it exiting. For heavy debugging only. + */ void debug_func_out(char *function) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/debug.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- debug.h 6 Feb 2004 07:36:30 -0000 1.2 +++ debug.h 11 Mar 2004 17:28:58 -0000 1.3 @@ -22,6 +22,9 @@ #define DEBUG_MSG "E-Notes: %s.\n" +#define DEBUG_ERROR_MSG "E-Notes: ERROR - %s.\n" +#define DEBUG_WARNING_MSG "E-Notes: WARNING - %s.\n" +#define DEBUG_NOTICE_MSG "E-Notes: NOTICE - %s.\n" #define DEBUG_FUNC_IN "E-Notes [%d]: Entered Function %s.\n" #define DEBUG_FUNC_OUT "E-Notes [%d]: Exited Function %s.\n" @@ -31,6 +34,10 @@ #define debug_msg(foo) dm(foo) #define debug_msg_lvl(foo,lvl) dml(foo,lvl) +#define error_msg(foo) debug_msg_lvl(foo,3) +#define warning_msg(foo) debug_msg_lvl(foo,4) +#define notice_msg(foo) debug_msg_lvl(foo,5) + typedef struct { char *name; int level; =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/ipc.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ipc.c 7 Feb 2004 22:01:56 -0000 1.3 +++ ipc.c 11 Mar 2004 17:28:58 -0000 1.4 @@ -15,6 +15,13 @@ Ecore_Ipc_Server *mysvr; +/** + * @return: Integer stating whether a server is running. + * -1 = wtf happened there? + * 0 = No server found. + * 1 = Theres already a running server. + * @brief: Checks whether an enotes ipc server is running. + */ int find_server(void) { @@ -31,6 +38,10 @@ return (-1); } +/** + * @brief: Sets up the enotes server and gets it listening + * for IPC signals. + */ void setup_server(void) { @@ -48,6 +59,11 @@ return; } +/** + * @param msg: The message to be sent. + * @brief: Sends the contents of msg over IPC + * to the running enotes server. + */ void send_to_server(char *msg) { @@ -65,6 +81,15 @@ return; } +/** + * @param data: Not used, supplied by the ecore callback, can be + * set when the callback is set if required. + * @param type: Not used, supplied by the ecore callback. + * @param event: Event information including the message itself. + * @brief: Callback for signal recieve. Gets the message + * from "event", unwraps it with the parsing function + * so it can be used for whatever purpose is required. + */ int ipc_svr_data_recv(void *data, int type, void *event) { @@ -78,17 +103,24 @@ char *content; if ((e = (Ecore_Ipc_Event_Client_Data *) event)) { - p = parse_message(e->data); + p = parse_message(e->data); /* e->data is freed by the elibs + * thus p->data (being part of e->data) + * should be freed too, so leave it! */ if (p != NULL) { if (p->cmd == NOTE) { - note = (NoteStor *) - get_notestor_from_value((char *) p-> - data); - content = fix_newlines(note->content); - new_note_with_values(note->width, note->height, - note->title, content); - free(content); - free_note_stor(note); + if (p->data != NULL) { + note = (NoteStor *) + get_notestor_from_value((char *) + p-> + data); + content = fix_newlines(note->content); + new_note_with_values(note->width, + note->height, + note->title, + content); + free(content); + free_note_stor(note); + } } else if (p->cmd == CLOSE) { ecore_main_loop_quit(); } @@ -97,7 +129,14 @@ return (1); } - +/** + * @param msg: Message to parse. + * @return: Returns the RecvMsg variable containing the individual + * options and information. + * @brief: Unwraps the msg into individual values. Into two pieces really, + * the command ("NOTE", "CLOSE" or whatever) and the information + * supplied. + */ RecvMsg * parse_message(char *msg) { @@ -106,25 +145,33 @@ char *ts; char *one; char *two; + int noinfo = 0; tst = strdup(msg); ts = tst; if (strsep(&tst, DEF_VALUE_SEPERATION) != NULL) { if (strsep(&tst, DEF_VALUE_SEPERATION) == NULL) { free(ts); - free(p); - return (NULL); + noinfo = 1; } } else { free(ts); free(p); + error_msg + ("An incorrect IPC signal was recieved and flushed (no command)"); return (NULL); } one = strdup(strsep(&msg, DEF_VALUE_SEPERATION)); - two = strdup(msg); - p->data = (void *) two; + if (noinfo == 0) { + two = strdup(msg); + p->data = (void *) two; + } else { + two = NULL; + p->data = NULL; + } + /* Set the command */ if (!strcmp(one, "NOTE")) { p->cmd = NOTE; } else if (!strcmp(one, "CLOSE")) { @@ -132,6 +179,8 @@ } else { free(one); free(p); + error_msg + ("An incorrect IPC signal was recieved and flushed (incorrect command)"); return (NULL); } @@ -139,6 +188,12 @@ return (p); } +/** + * @param data: Not used, but can be set during the setting of the callback. + * @return: Returns 0 to end the timer. Its a timer because if theres an event + * when the main loop is ended there can be trouble. + * @brief: Closes enotes. + */ int ipc_close_enotes(void *data) { @@ -146,6 +201,14 @@ return (0); } +/** + * @param b: The original string to "fix". + * @return: The "fixed" string. + * @brief: This function takes b, and replaces all of the "\n" substrings + * (not newline, a "\" and then an "n") with a newline character (\n). + * The compiler never sees the "\n" when supplied via IPC so its never + * converted into a newline, so we do it ourselves. + */ char * fix_newlines(char *b) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/main.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- main.c 17 Feb 2004 12:07:28 -0000 1.7 +++ main.c 11 Mar 2004 17:28:58 -0000 1.8 @@ -14,6 +14,13 @@ #include "main.h" /* The Main Function */ + +/** + * @param argc: Number of command line arguments supplied. + * @param argv: Char* array containing the command line arguments supplied. + * @return: To the system, normally 0. + * @brief: The first function once enotes is called. + */ int main(int argc, char *argv[]) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/msgbox.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- msgbox.c 6 Feb 2004 07:36:30 -0000 1.2 +++ msgbox.c 11 Mar 2004 17:28:58 -0000 1.3 @@ -14,8 +14,30 @@ #include "msgbox.h" /* Making a Message Box */ + +/** + * @param title: The titlebar content of the window. + * @param content: The content string to display in the window. + * @brief: Opens up a message box. + */ void -msgbox(char *title, char *content, int x, int y, int width, int height) +msgbox(char *title, char *content) +{ + msgbox_manual(title, content, 0, 0, 300, 50); + return; +} + +/** + * @param title: The titlebar content of the window. + * @param content: The content string to display in the window. + * @param x: X co-ordinate to place the window at. + * @param y: Y co-ordinate to place the window at. + * @param width: Width of window. + * @param height: Height of the window. + * @brief: Opens up a message box. + */ +void +msgbox_manual(char *title, char *content, int x, int y, int width, int height) { MsgBox msgbox; MsgBox *mb = &msgbox; @@ -37,7 +59,7 @@ ewl_widget_set_appearance(mb->emb, "window"); ewl_widget_show(mb->emb); - mb->eo = ewl_embed_set_evas((Ewl_Embed *) mb->emb, mb->evas, + mb->eo = ewl_embed_set_evas((Ewl_Embed *) mb->emb, mb->evas, (void *) ecore_evas_software_x11_window_get(mb-> win)); evas_object_name_set(mb->eo, "eo"); @@ -53,12 +75,11 @@ mb->msg = ewl_text_new(content); ewl_container_append_child((Ewl_Container *) mb->vbox, mb->msg); + ewl_object_set_fill_policy((Ewl_Object *) mb->msg, EWL_FLAG_FILL_FILL); ewl_widget_show(mb->msg); mb->hbox = ewl_hbox_new(); ewl_container_append_child((Ewl_Container *) mb->vbox, mb->hbox); - ewl_object_set_fill_policy((Ewl_Object *) mb->hbox, - EWL_FLAG_FILL_HFILL); ewl_widget_show(mb->hbox); mb->okbtn = ewl_button_new("Ok."); @@ -79,6 +100,12 @@ /* Callbacks */ + +/** + * @param ee: The Ecore_Evas which has been resized. + * @brief: Ecore callback for window resize, resizes the ewl embed object + * to compensate. + */ void msgbox_resize(Ecore_Evas * ee) { @@ -90,6 +117,10 @@ return; } +/** + * @param ee: The Ecore_Evas window which the wm has requested be closed. + * @brief: Closes the msgbox window ee. + */ void msgbox_close(Ecore_Evas * ee) { @@ -97,6 +128,13 @@ return; } +/** + * @param widget: The Ewl_Widget of the ok button which was clicked. + * @param ev_data: Event data, not used. + * @param data: The msgbox Ecore_Evas supplied when the callback was set. + * @brief: Ewl callback on the ok button being clicked. + * Closes the Ecore_Evas window (data) via msgbox_close. + */ void msgbox_okbtn_clicked(Ewl_Widget * widget, void *ev_data, void *data) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/msgbox.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- msgbox.h 6 Feb 2004 07:36:30 -0000 1.2 +++ msgbox.h 11 Mar 2004 17:28:58 -0000 1.3 @@ -35,8 +35,9 @@ extern MainConfig *main_config; /* Making a Message Box */ -void msgbox(char *title, char *content, int x, int y, int width, - int height); +void msgbox(char *title, char *content); +void msgbox_manual(char *title, char *content, int x, int y, + int width, int height); /* Callbacks */ void msgbox_okbtn_clicked(Ewl_Widget * widget, void *ev_data, =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/note.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- note.c 19 Feb 2004 18:12:57 -0000 1.11 +++ note.c 11 Mar 2004 17:28:58 -0000 1.12 @@ -18,6 +18,10 @@ Evas_List *gbl_notes = NULL; /* High Level */ + +/** + * @brief: Opens a new note. + */ void new_note(void) { @@ -30,6 +34,13 @@ return; } +/** + * @param width: Width of the new note. + * @param height: Height of the new note. + * @param title: Title text to begin with. + * @param content: Content text to begin with. + * @brief: Opens a new note. + */ void new_note_with_values(int width, int height, char *title, char *content) { @@ -43,6 +54,11 @@ } /* Lists and Allocation */ + +/** + * @return: Evas_List pointer to the new note created in the list. + * @brief: Initialise the Note and add it to the list. + */ Evas_List * append_note(void) { @@ -55,6 +71,10 @@ return (evas_list_find_list(gbl_notes, note)); } +/** + * @param note: The pointer to an Evas_List containing the note. + * @brief: Closes and frees a note. + */ void remove_note(Evas_List * note) { @@ -77,7 +97,6 @@ */ if (saveload != NULL) { -// ewl_widget_destroy (p->saveload_row); dml("Removing note entry from saveload list", 2); ewl_tree_destroy_row((Ewl_Tree *) saveload->tree, p->saveload_row); @@ -87,6 +106,15 @@ } /* GUI Setup */ + +/** + * @param note: The note to setup (pointer to a pointer). + * @param width: Width of the new notes window. + * @param height: Height of the new notes window. + * @param title: Title to begin with. + * @param content: Content to begin with. + * @brief: Sets up the note objects, window, callbacks, etc... + */ void setup_note(Evas_List ** note, int width, int height, char *title, char *content) { @@ -166,7 +194,7 @@ ewl_object_set_fill_policy((Ewl_Object *) p->emb, EWL_FLAG_FILL_FILL); ewl_widget_show(p->emb); p->eo = ewl_embed_set_evas(EWL_EMBED(p->emb), - ecore_evas_get(p->win), + ecore_evas_get(p->win), (void *) ecore_evas_software_x11_window_get(p->win)); evas_object_layer_set(p->eo, 2); edje_object_part_swallow(p->edje, EDJE_EWL_CONTAINER, p->eo); @@ -221,6 +249,13 @@ } /* ECORE Callbacks */ + +/** + * @param ee: The Ecore_Evas which has been resized. + * @brief: Ecore callback on a window resizing. + * Resizes the objects inside the window to + * compensate to the new size. + */ void note_ecore_resize(Ecore_Evas * ee) { @@ -236,6 +271,11 @@ return; } +/** + * @param ee: Ecore_Evas which has been requested to close. + * @brief: Ecore callback which dictates that the wm wants the note closing. + * Closes the note. + */ void note_ecore_close(Ecore_Evas * ee) { @@ -256,6 +296,15 @@ } /* EDJE Callbacks */ + +/** + * @param note: Evas_List of the note which is to be closed. + * @param o: Evas_Object of the object clicked (not used). + * @param emission: The signal string (not used). + * @param source: The source of the signal (not used). + * @brief: Edje callback to close. Closes the note via a timer + * to save trouble with signals, etc... when it all gets freed. + */ void note_edje_close(Evas_List * note, Evas_Object * o, const char *emission, const char *source) @@ -266,6 +315,13 @@ return; } +/** + * @param note: Evas_List of the note which is to be minimised. + * @param o: Evas_Object of the object clicked (not used). + * @param emission: The signal string (not used). + * @param source: The source of the signal (not used). + * @brief: Edje callback to minimise. Minimises the window. + */ void note_edje_minimise(Evas_List * note, Evas_Object * o, const char *emission, const char *source) @@ -281,6 +337,11 @@ } /* Misc */ + +/** + * @return: Returns the string containing the date (needs free'ing) + * @brief: Grabs and formats the time into a string. + */ char * get_date_string(void) { @@ -295,6 +356,14 @@ return (retval); } +/** + * @param p: Evas_List pointing to the note to be closed. + * @return: Integer dictating whether the timer ends. + * @brief: This timer is called from the edje callback to close + * the window to save problems with signals when the objects + * are freed. It close the note and ends its own timer by + * returning 0. + */ int note_edje_close_timer(void *p) { @@ -302,6 +371,13 @@ return (0); } +/** + * @param data: The Note of the note which is being checked. + * @return: Integer dictating whether the timer ends. + * @brief: Compares the values of the title to the stored values (keep getting + * updated) to decide whether to change the value inside of saveload if + * required. This is a timer. + */ int timer_val_compare(void *data) { @@ -325,6 +401,12 @@ } /* External Interaction */ + +/** + * @param title: The title to search for. + * @return: Returns the Evas_List of the note requested by "title". + * @brief: Searches for and returns the note with the title being "title" + */ Evas_List * get_note_by_title(char *title) { @@ -342,6 +424,11 @@ return (NULL); } +/** + * @param content: The content to search for. + * @return: Returns the Evas_List of the note requested by "content". + * @brief: Searches for and returns the note with the content being "content" + */ Evas_List * get_note_by_content(char *content) { @@ -360,6 +447,11 @@ } +/** + * @param note: The note to grab the title from. + * @return: Returns the title of the supplied note. + * @brief: Returns the title text of the supplied note. + */ char * get_title_by_note(Evas_List * note) { @@ -368,6 +460,11 @@ return (ewl_entry_get_text((Ewl_Entry *) p->title)); } +/** + * @param note: The note to grab the content from. + * @return: Returns the content of the supplied note. + * @brief: Returns the content text of the supplied note. + */ char * get_content_by_note(Evas_List * note) { @@ -377,18 +474,32 @@ } +/** + * @return: Returns the beginning node of the note list cycle. + * @brief: Begin the note list cycle. + */ Evas_List * get_cycle_begin(void) { return (gbl_notes); } +/** + * @param note: The note to move forward from. + * @return: Returns the node to the next note in the cycle. + * @brief: Move to the next note in the cycle. + */ Evas_List * get_cycle_next_note(Evas_List * note) { return (evas_list_next(note)); } +/** + * @param note: The note to move backwards from. + * @return: Returns the node to the previous note in the cycle. + * @brief: Move to the previous note in the cycle. + */ Evas_List * get_cycle_previous_note(Evas_List * note) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/saveload.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- saveload.c 19 Feb 2004 18:12:57 -0000 1.7 +++ saveload.c 11 Mar 2004 17:28:58 -0000 1.8 @@ -23,6 +23,10 @@ /** SAVE/LOAD WINDOW **/ +/** + * @brief: This checks whether the saveload window is already opened + * and if not, will open it. + */ void setup_saveload(void) { @@ -32,11 +36,14 @@ setup_saveload_win(); fill_saveload_tree(); } else { - dml("Won't Open Another Saveload Window", 2); + error_msg("Won't Open Another Saveload Window"); } return; } +/** + * @brief: Sets up the objects, widgets, callbacks and window for the saveload. + */ void setup_saveload_win(void) { @@ -65,6 +72,7 @@ saveload->eo = ewl_embed_set_evas((Ewl_Embed *) saveload->emb, saveload->evas, + (void *) ecore_evas_software_x11_window_get(saveload-> win)); evas_object_name_set(saveload->eo, "eo"); @@ -131,6 +139,14 @@ return; } +/** + * @param c: The container widget to append the button to. + * @param b: Pointer to a pointer of the widget to make the button in. + * @param label: The label to apply to the button. + * @brief: Creates and appends the button into the container (c) with + * the lable of label. The widget used to make the button is + * b (a pointer to a pointer). + */ void saveload_setup_button(Ewl_Widget * c, Ewl_Widget ** b, char *label) { @@ -140,6 +156,10 @@ return; } +/** + * @param: Reads through all of the notes and in a cycle appends new + * rows to the tree. + */ void fill_saveload_tree(void) { @@ -159,6 +179,15 @@ return; } +/** + * @param tree: The tree widget to append the new row too. + * @param caption: The text to apply to the new row (note title). + * @param p: The evas_list which contains the Note structure of the note + * the new row refers to for accessibility. + * @brief: This will setup a row into the tree (tree) with the text (caption) + * but will store the row pointer in the note it refers to (p). This + * allows for more efficient sync'ing and updating. + */ void setup_saveload_opt(Ewl_Widget * tree, char *caption, Evas_List * p) { @@ -175,6 +204,11 @@ } /* Callbacks */ + +/** + * @param ee: The Ecore_Evas resized so we can get the new size to resize to. + * @brief: Saveload window resize callback, resizes the ewl embed accordingly. + */ void ecore_saveload_resize(Ecore_Evas * ee) { @@ -188,6 +222,12 @@ return; } +/** + * @param ee: The Ecore_Evas to free, and of course its contents. + * @brief: Callback for wm requesting to close the window. So we do so by + * free'ing the window and structure used, elibs free the rest. + * Set some NULL's so it works when they pull it back up again. + */ void ecore_saveload_close(Ecore_Evas * ee) { @@ -199,6 +239,14 @@ return; } +/** + * @param widget: The widget clicked (we don't use this). + * @param ev_data: Event data, we don't use this either. + * @param p: Thats our data, its the tree we're going to empty and refill. + * @brief: Callback for the refresh button being clicked. This is the + * complete refreshing, so we clear all contents of the tree and + * rebuild it from scratch. :) + */ void ewl_saveload_revert(Ewl_Widget * widget, void *ev_data, Ewl_Widget * p) { @@ -210,6 +258,14 @@ return; } +/** + * @param o: The widget clicked. We don't use this. + * @param ev_data: The event data, we don't use this either. + * @param ee: Our predefined Ecore_Evas (window) which has been closed, + * so we can supply it to the ecore close callback. :-) + * @brief: Ewl close button clicked callback. So we call the ecore close + * callback which does the work. :) + */ void ewl_saveload_close(Ewl_Widget * o, void *ev_data, Ecore_Evas * ee) { @@ -217,6 +273,13 @@ return; } +/** + * @param o: Ewl widget which was clicked. We don't use this. + * @param ev_data: The event data. We don't use this either. + * @param null: A NULL pointer to please the compiler. We don't use this. + * @brief: When a row from the tree is clicked, we set the saveload_selected + * string so when we wanna do soemthing, we know what to do it to. + */ void ewl_saveload_listitem_click(Ewl_Widget * o, void *ev_data, void *null) { @@ -229,6 +292,13 @@ return; } +/** + * @param o: Widget which was clicked. We don't use this. + * @param ev_data: Event data, we don't use this. + * @param null: A NULL pointer to please the compiler. We don't use this. + * @brief: The load button callback, we call the function which does the + * work (setup_load) so we get a nice load window up. :-) + */ void ewl_saveload_load(Ewl_Widget * o, void *ev_data, void *null) { @@ -236,6 +306,16 @@ return; } +/** + * @param o: The widget which was clicked. We don't use this. + * @param ev_data: The event data, we don't use this. + * @param null: A NULL pointer to keep the compiler happy. We don't use this. + * @brief: The save button is clicked, so we're going to search through the + * note structures (from the lists) and find the title which + * corrosponds with that in the saveload_selected character array + * and save it using the storage/xml backend to an xml file for + * future loading. A mouthful. :-) + */ void ewl_saveload_save(Ewl_Widget * o, void *ev_data, void *null) { @@ -269,6 +349,9 @@ /** LOAD WINDOW **/ +/** + * @brief: Checks whether the load window is open and if not, opens it. + */ void setup_load(void) { @@ -278,11 +361,15 @@ setup_load_win(); fill_load_tree(); } else { - dml("Won't Open Another Load Note Window", 2); + error_msg("Won't Open Another Load Note Window"); } return; } +/** + * @brief: Sets up the widgets, objects, callbacks and window for the + * loading window. + */ void setup_load_win(void) { @@ -308,6 +395,7 @@ ewl_widget_show(load->emb); load->eo = ewl_embed_set_evas((Ewl_Embed *) load->emb, load->evas, + (void *) ecore_evas_software_x11_window_get(load-> win)); evas_object_name_set(load->eo, "eo"); @@ -376,6 +464,10 @@ return; } +/** + * @param: Reads through all of the saved notes in the xml storage file + * and in a cycle appends new rows to the tree. + */ void fill_load_tree(void) { @@ -396,6 +488,12 @@ return; } +/** + * @param tree: The tree widget to append the new row too. + * @param caption: The text to apply to the new row (note title). + * @brief: This will setup a row into the load tree (tree) with + * the text (caption). + */ void setup_load_opt(Ewl_Widget * tree, char *caption) { @@ -409,6 +507,10 @@ return; } +/** + * @param ee: The Ecore_Evas resized so we can get the new size to resize to. + * @brief: Saveload window resize callback, resizes the ewl embed accordingly. + */ void ecore_load_resize(Ecore_Evas * ee) { @@ -422,6 +524,12 @@ return; } +/** + * @param ee: The Ecore_Evas to free, and of course its contents. + * @brief: Callback for wm requesting to close the window. So we do so by + * free'ing the window and structure used, elibs free the rest. + * Set some NULL's so it works when they pull it back up again. + */ void ecore_load_close(Ecore_Evas * ee) { @@ -433,6 +541,14 @@ return; } +/** + * @param widget: The widget clicked (we don't use this). + * @param ev_data: Event data, we don't use this either. + * @param p: Thats our data, its the tree we're going to empty and refill. + * @brief: Callback for the refresh button being clicked. This is the + * complete refreshing, so we clear all contents of the tree and + * rebuild it from scratch. :) + */ void ewl_load_revert(Ewl_Widget * widget, void *ev_data, Ewl_Widget * p) { @@ -442,6 +558,14 @@ return; } +/** + * @param o: The widget clicked. We don't use this. + * @param ev_data: The event data, we don't use this either. + * @param ee: Our predefined Ecore_Evas (window) which has been closed, + * so we can supply it to the ecore close callback. :-) + * @brief: Ewl close button clicked callback. So we call the ecore close + * callback which does the work. :) + */ void ewl_load_close(Ewl_Widget * o, void *ev_data, Ecore_Evas * ee) { @@ -449,6 +573,14 @@ return; } +/** + * @param o: Widget which was clicked. We don't use this. + * @param ev_data: Event data, we don't use this. + * @param null: A NULL pointer to please the compiler. We don't use this. + * @brief: The load button callback, this cycles through the xml file + * to find the selected note, gathers the rest of the information + * and opens the note. + */ void ewl_load_load(Ewl_Widget * o, void *ev_data, void *null) { @@ -473,6 +605,13 @@ return; } +/** + * @param o: Ewl widget which was clicked. We don't use this. + * @param ev_data: The event data. We don't use this either. + * @param null: A NULL pointer to please the compiler. We don't use this. + * @brief: When a row from the tree is clicked, we set the load_selected + * string so when we wanna do soemthing, we know what to do it to. + */ void ewl_load_listitem_click(Ewl_Widget * o, void *ev_data, void *null) { @@ -485,6 +624,12 @@ return; } +/** + * @param o: Ewl widget which was clicked. We don't use this. + * @param ev_data: The event data. We don't use this either. + * @param null: A NULL pointer to please the compiler. We don't use this. + * @brief: Removes the selected note entry from the xml file. + */ void ewl_load_delete(Ewl_Widget * o, void *ev_data, void *null) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/settings.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- settings.c 17 Feb 2004 12:07:28 -0000 1.5 +++ settings.c 11 Mar 2004 17:28:58 -0000 1.6 @@ -17,6 +17,11 @@ /* High Level */ + +/** + * @brief: Sets up the settings window. It checks whether its open first + * to make sure we don't get any duplicates. + */ void setup_settings(void) { @@ -32,8 +37,11 @@ } -/* Setting up the Window */ - +/** + * @param s: The Settings typedef structure to put the pointers into. + * @brief: Sets up the settings window, widgets, callbacks, etc.. and stores + * the pointers into the typedef structure s. + */ void setup_settings_win(Settings * s) { @@ -57,7 +65,7 @@ ewl_widget_set_appearance(s->emb, "window"); ewl_widget_show(s->emb); - s->eo = ewl_embed_set_evas((Ewl_Embed *) s->emb, s->evas, + s->eo = ewl_embed_set_evas((Ewl_Embed *) s->emb, s->evas, (void *) ecore_evas_software_x11_window_get(s->win)); evas_object_name_set(s->eo, "eo"); evas_object_layer_set(s->eo, 0); @@ -107,6 +115,12 @@ return; } +/** + * @brief: Fills the tree with all of the setup options. This basically + * calls the function setup_settings_opt over and over and stores + * the pointers returned from that function into the settings + * structure. + */ void fill_tree(void) { @@ -136,6 +150,14 @@ return; } +/** + * @param c: The container widget to store the button into. + * @param b: The button pointer to use (pointer to a pointer). + * @param label: The label to apply to the button. + * @brief: This function sets up a button, it points it to b (pointer + * to a pointer) and appends it to the container (b), the button + * has the label contained in label. + */ void settings_setup_button(Ewl_Widget * c, Ewl_Widget ** b, char *label) { @@ -146,7 +168,13 @@ } -/* Setting up the Options */ +/** + * @param tree: The tree to append it to. + * @param caption: The caption to be put into the text widget. + * @param value: The beginning value. + * @brief: Sets up a row in the tree, it uses the structure Settings_Opt + * which contains a text and entry widget. + */ Settings_Opt setup_settings_opt(Ewl_Widget * tree, char *caption, char *value) { @@ -168,6 +196,13 @@ return (oa); } +/** + * @param tree: The tree to append it to. + * @param caption: The caption to set the text widget value to. + * @param value: The beginning value (integer). + * @brief: Creates a row in the tree for an option which will take + * an integer value. + */ Settings_Opt setup_settings_opt_int(Ewl_Widget * tree, char *caption, int value) { @@ -181,6 +216,11 @@ /* Callbacks */ + +/** + * @param ee: The Ecore_Evas which was resized. + * @brief: Window resize callback, resizes the ewl embed to compensate. + */ void ecore_settings_resize(Ecore_Evas * ee) { @@ -194,6 +234,12 @@ return; } +/** + * @param ee: The Ecore_Evas which wants to be closed. + * @brief: Callback for the wm wanting the settings window to be closed. + * We free the ecore_evas and free + NULL the structure. This + * concequently makes the elibs free the rest up. + */ void ecore_settings_close(Ecore_Evas * ee) { @@ -204,6 +250,13 @@ return; } +/** + * @param widget: The widget which was clicked (we don't use this). + * @param ev_data: The event data. We don't use this either. + * @param p: The widget supplied during the callback definition, its the tree. + * @brief: The "revert" button was clicked, so we reset the values (thoroughly + * empty and refill the tree from scratch). + */ void ewl_settings_revert(Ewl_Widget * widget, void *ev_data, Ewl_Widget * p) { @@ -214,6 +267,13 @@ return; } +/** + * @param o: The widget which was clicked (we don't use this). + * @param ev_data: The event data. We don't use this either. + * @param ee: The Ecore_Evas we supply to the ecore callback. + * @brief: The ewl close button was clicked, we we'll ask the ecore + * callback to do the work. + */ void ewl_settings_close(Ewl_Widget * o, void *ev_data, Ecore_Evas * ee) { @@ -221,6 +281,14 @@ return; } +/** + * @param o: The widget which was clicked (we don't use this). + * @param ev_data: The event data. We don't use this either. + * @param data: A NULL pointer to keep the compiler happy. We + * don't use this. + * @brief: The save button is clicked, so we save the configuration + * by calling save_settings. + */ void ewl_settings_save(Ewl_Widget * o, void *ev_data, void *data) { @@ -231,6 +299,13 @@ /* XML */ + +/** + * @brief: This function saves the settings. More specifically, it opens + * up the xml file from scratch and appends all of the options according + * to the values contained within the window using the storage and xml + * backends. + */ void save_settings(void) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/storage.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- storage.c 17 Feb 2004 12:07:29 -0000 1.5 +++ storage.c 11 Mar 2004 17:28:58 -0000 1.6 @@ -14,6 +14,11 @@ #include "storage.h" /* Freeing */ + +/** + * @param p: The notestor to free. + * @brief: Free's a notestor typedef structure. + */ void free_note_stor(NoteStor * p) { @@ -28,6 +33,10 @@ return; } +/** + * @return: The NoteStor allocated. + * @brief: Allocates a new NoteStor variable. + */ NoteStor * alloc_note_stor() { @@ -39,6 +48,11 @@ } /* One Shot Functions. :-) */ + +/** + * @param p: The NoteStor containing the required information. + * @brief: Appends a new autosave note according to whats in p. + */ void append_autosave_note_stor(NoteStor * p) { @@ -95,6 +109,11 @@ return; } +/** + * @param p: The information required (about the note we're saving). + * @brief: Appends a new note to the note storage according to the + * information stored in p. + */ void append_note_stor(NoteStor * p) { @@ -151,6 +170,11 @@ return; } +/** + * @param p: The NoteStor containing the information required. + * @brief: Removes the NoteStor corrosponding to the information + * inside p. + */ void remove_note_stor(NoteStor * p) { @@ -214,6 +238,11 @@ /* Cycle Functions */ + +/** + * @return: The XmlReadHandle for the beginning of the storage cycle. + * @brief: Returns a handle for the beginning of the storage cycle (reading). + */ XmlReadHandle * stor_cycle_begin(void) { @@ -226,6 +255,11 @@ return (retval); } +/** + * @return: The XmlReadHandle for the beginning of the autosave storage cycle. + * @brief: Begins the storage cycle for the autosave storage and returns a read + * handle. + */ XmlReadHandle * stor_cycle_begin_autosave(void) { @@ -238,6 +272,10 @@ return (retval); } +/** + * @param p: The read handle which is to be ended and free'd. + * @brief: Ends and free's a storage cycle. + */ void stor_cycle_end(XmlReadHandle * p) { @@ -246,6 +284,10 @@ } +/** + * @param p: The cycle handle to move forward in. + * @brief: Move forward in the cycle (next note). + */ void stor_cycle_next(XmlReadHandle * p) { @@ -253,6 +295,10 @@ return; } +/** + * @param p: The cycle handle to move backwards in. + * @brief: Moves backwards in the cycle (previous note). + */ void stor_cycle_prev(XmlReadHandle * p) { @@ -261,6 +307,13 @@ } +/** + * @param p: The handle to get the current notestor from. + * @return: The notestor requested, allocated and with values. + * Needs free'ing. + * @brief: Obtains the NoteStor information from the current stage + * in the supplied handle. + */ NoteStor * stor_cycle_get_notestor(XmlReadHandle * p) { @@ -274,6 +327,10 @@ } /* Autosave Functions */ + +/** + * @brief: Automatically loads all of the "autosave" notes. + */ void autoload(void) { @@ -296,6 +353,9 @@ return; } +/** + * @brief: Automatically saves all open notes into the autosave storage. + */ void autosave(void) { @@ -329,6 +389,12 @@ } /* Internal Functions */ + +/** + * @return: The storage file location string. + * @brief: Builds up a string containing the location of the storage + * xml file. + */ char * make_storage_fn(void) { @@ -338,6 +404,11 @@ return (p); } +/** + * @return: The storage file location string (autosave). + * @brief: Builds up a string containing the location of the autosave + * storage xml file. + */ char * make_autosave_fn(void) { @@ -347,6 +418,11 @@ return (p); } +/** + * @param e: The value to parse and build a notestor from. + * @return: The built NoteStor structure (needs free'ing). + * @brief: Parses e and builds a NoteStor structure, then returns it. + */ NoteStor * get_notestor_from_value(char *e) { @@ -382,6 +458,12 @@ return (p); } +/** + * @param p: The NoteStor to parse and build a value from. + * @return: The built string value. + * @brief: Parses the NoteStor and builds a long string out of it. + * Reverse of the above function. + */ char * get_value_from_notestor(NoteStor * p) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/usage.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- usage.c 17 Feb 2004 12:07:29 -0000 1.6 +++ usage.c 11 Mar 2004 17:28:58 -0000 1.7 @@ -17,6 +17,14 @@ int dispusage; /* Reading the Usage */ + +/** + * @param argc: The number of arguments supplied to the program. + * @param argv: The arguments supplied to the program. + * @brief: Reads the usage for the configuration filename. This + * is done first to see if we wanna load a different + * configuration before we get gritty with the usages. + */ char * read_usage_for_configuration_fn(int argc, char *argv[]) { @@ -30,6 +38,14 @@ return (NULL); } +/** + * @param p: The MainConfig variable to set the specified options + * to. + * @param argc: The number of arguments supplied to the program. + * @param argv: The arguments supplied to the program. + * @brief: Reads the usage and stores the configuration options + * into p. + */ void read_usage_configuration(MainConfig * p, int argc, char *argv[]) { @@ -94,6 +110,10 @@ /* Printing the Usage */ + +/** + * @brief: Prints the usage to the terminal. + */ void print_usage(void) { =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/usage.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- usage.h 17 Feb 2004 12:07:29 -0000 1.5 +++ usage.h 11 Mar 2004 17:28:58 -0000 1.6 @@ -29,23 +29,25 @@ E-Notes\n\ By Thomas Fletcher\n\n\ Command Line Arguments:\n\ -\n\ -POSIX GNU TYPE DESCRITION\n\ --? --help N/A Display the Usage.\n\ --v --version N/A Display the Version.\n\ -\n\ --R --remote STR Send a remote message to\n\ - a running E-Notes.\n\ -\n\ --c --config-file STR Configuration File.\n\ -\n\ --r --render-method STR Render Method\n\ --t --theme STR Theme\n\ --C --control-centre INT Enable/Disable the Control\n\ - Centre.\n\ --A --auto-save INT Enable the autosaving and\n\ - loading of notes.\n\ --i --intro INT Display the Intro.\n\ +\n\n\ +POSIX | GNU | TYPE | DESCRITION\n\ +----------------------------------------------------------------\n\ +-? | --help | N/A | Display the Usage.\n\ +-v | --version | N/A | Display the Version.\n\ + | | |\n\ +-R | --remote | STR | Send a remote message to\n\ + | | | a running E-Notes.\n\ + | | |\n\ +-c | --config-file | STR | Configuration File.\n\ +-d | --debug | INT | Set the debugging level [0-2].\n\ + | | |\n\ +-r | --render-method | STR | Render Method\n\ +-t | --theme | STR | Theme\n\ +-C | --control-centre| INT | Enable/Disable the Control\n\ + | | | Centre.\n\ +-A | --auto-save | INT | Enable the autosaving and\n\ + | | | loading of notes.\n\ +-i | --intro | INT | Display the Intro.\n\ \ \n" =================================================================== RCS file: /cvsroot/enlightenment/misc/enotes/src/xml.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- xml.c 7 Feb 2004 16:18:40 -0000 1.3 +++ xml.c 11 Mar 2004 17:28:58 -0000 1.4 @@ -14,6 +14,12 @@ #include "xml.h" /* Freeing */ + +/** + * @param p: The XmlEntry to free. + * @brief: Free's an XmlEntry structure (and its contents + * in some cases). + */ void free_xmlentry(XmlEntry * p) { @@ -26,6 +32,12 @@ } /* Reading */ + +/** + * @param fn: The filename of the xml file to open for reading. + * @return: The XmlReadHandle to be used for viewing and ending the file. + * @brief: Opens an xml file for reading, returns a handle. + */ XmlReadHandle * xml_read(char *fn) { @@ -56,6 +68,10 @@ return (p); } +/** + * @param h: The handle to end and free. + * @brief: Closes the xml file and free'd the handle supplied (h). + */ void xml_read_end(XmlReadHandle * h) { @@ -66,6 +82,10 @@ } +/** + * @param h: The handle to the cycle which wants to be taken forwards. + * @brief: Moves the xml cycle forwards onto the next entry. + */ void xml_read_next_entry(XmlReadHandle * h) { @@ -73,6 +93,10 @@ return; } +/** + * @param h: The handle to the cycle which wants to be taken backwards. + * @brief: Moves the xml cycle backwards onto the previous entry. + */ void xml_read_prev_entry(XmlReadHandle * h) { @@ -81,6 +105,11 @@ } +/** + * @return: The XmlEntry containing the current entry according to h. + * @param h: The handle of the cycle we want to get the information from. + * @brief: Pulls out the current xml entry. + */ XmlEntry * xml_read_entry_get_entry(XmlReadHandle * h) { @@ -93,6 +122,12 @@ } /* Writing */ + +/** + * @return: The write handle for the cycle. + * @param fn: The filename and location of the xml file to write to. + * @brief: Opens an xml file for writing. + */ XmlWriteHandle * xml_write(char *fn) { @@ -119,6 +154,10 @@ return (p); } +/** + * @param h: The write handle to free. + * @brief: Closes the xml file and free's the handle. + */ void xml_write_end(XmlWriteHandle * h) { @@ -131,6 +170,13 @@ } +/** + * @param h: The write handle to add an entry too. + * @param name: The xml tag name you want to append to the handle file. + * @param value: The value to put inside these tags. + * @brief: Appends an xml entry into the opened xml file pointed + * to by h. + */ void xml_write_append_entry(XmlWriteHandle * h, char *name, char *value) { ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs