Mercurial > dwib
changeset 348:a9a519fbb261
Fix an issue with creating notebook page node, it was missing "Children."
Add "const" to the exported API string parameters, as we did in DW itself.
author | Brian Smith <brian@dbsoft.org> |
---|---|
date | Tue, 05 Jan 2021 19:20:55 -0600 |
parents | 0c571d849d5b |
children | 355a2195c8cf |
files | dwib.c dwib.h dwib_lib.c |
diffstat | 3 files changed, 20 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/dwib.c Wed Dec 16 03:41:44 2020 -0600 +++ b/dwib.c Tue Jan 05 19:20:55 2021 -0600 @@ -6144,12 +6144,9 @@ if(strcmp((char *)currentNode->name, "Notebook") == 0) { thisNode = xmlNewNode(NULL, (xmlChar *)Classes[which]); - - if(!_dwib_find_child(currentNode, "Children")) - { - /* Create a sub-node for holding children */ - xmlNewTextChild(currentNode, NULL, (xmlChar *)"Children", (xmlChar *)""); - } + /* Create a sub-node for holding children */ + xmlNewTextChild(thisNode, NULL, (xmlChar *)"Children", (xmlChar *)""); + dw_window_set_data(hwndProperties, "type", DW_INT_TO_POINTER(which)); properties_notebook_page(thisNode); }
--- a/dwib.h Wed Dec 16 03:41:44 2020 -0600 +++ b/dwib.h Tue Jan 05 19:20:55 2021 -0600 @@ -10,14 +10,14 @@ typedef void *DWIB; -HWND API dwib_load(DWIB handle, char *name); -int API dwib_load_at_index(DWIB handle, char *name, char *dataname, HWND window, HWND box, int index); +HWND API dwib_load(DWIB handle, const char *name); +int API dwib_load_at_index(DWIB handle, const char *name, const char *dataname, HWND window, HWND box, int index); void API dwib_show(HWND window); -DWIB API dwib_open_from_data(char *buffer, int size); -DWIB API dwib_open(char *filename); +DWIB API dwib_open_from_data(const char *buffer, int size); +DWIB API dwib_open(const char *filename); void API dwib_close(DWIB handle); -int API dwib_image_root_set(char *path); -int API dwib_locale_set(char *loc); -HWND API dwib_window_get_handle(HWND handle, char *dataname); +int API dwib_image_root_set(const char *path); +int API dwib_locale_set(const char *loc); +HWND API dwib_window_get_handle(HWND handle, const char *dataname); #endif
--- a/dwib_lib.c Wed Dec 16 03:41:44 2020 -0600 +++ b/dwib_lib.c Tue Jan 05 19:20:55 2021 -0600 @@ -1491,7 +1491,7 @@ return ret; } -int _dwib_check_dataname(xmlNodePtr node, xmlDocPtr doc, char *dataname) +int _dwib_check_dataname(xmlNodePtr node, xmlDocPtr doc, const char *dataname) { char *thisval = NULL; xmlNodePtr this; @@ -1507,7 +1507,7 @@ } /* Internal function fo parsing the children of packable widgets... boxes, notebook pages, etc */ -int _dwib_children_search(xmlNodePtr node, xmlDocPtr doc, HWND window, char *dataname, HWND box, int index) +int _dwib_children_search(xmlNodePtr node, xmlDocPtr doc, HWND window, const char *dataname, HWND box, int index) { xmlNodePtr p = _dwib_find_child(node, "Children"); int retval = DW_ERROR_GENERAL; @@ -1603,7 +1603,7 @@ * Returns: * A handle to a top-level window or NULL on failure. */ -HWND API dwib_load(DWIB handle, char *name) +HWND API dwib_load(DWIB handle, const char *name) { xmlDocPtr doc = handle; xmlNodePtr p, rootNode = xmlDocGetRootElement(doc); @@ -1656,7 +1656,7 @@ * Returns: * DW_ERROR_GENERAL on error or DW_ERROR_NONE on success. */ -int API dwib_load_at_index(DWIB handle, char *name, char *dataname, HWND window, HWND box, int index) +int API dwib_load_at_index(DWIB handle, const char *name, const char *dataname, HWND window, HWND box, int index) { xmlDocPtr doc = handle; xmlNodePtr p, rootNode = xmlDocGetRootElement(doc); @@ -1727,7 +1727,7 @@ * Returns: * A handle to an XML tree or NULL on failure. */ -DWIB API dwib_open_from_data(char *buffer, int size) +DWIB API dwib_open_from_data(const char *buffer, int size) { return xmlParseMemory(buffer, size); } @@ -1739,7 +1739,7 @@ * Returns: * A handle to an XML tree or NULL on failure. */ -DWIB API dwib_open(char *filename) +DWIB API dwib_open(const char *filename) { return xmlParseFile(filename); } @@ -1763,7 +1763,7 @@ * Returns: * DW_ERROR_NONE if found was found and selected, or DW_ERROR_GENERAL. */ -int API dwib_image_root_set(char *path) +int API dwib_image_root_set(const char *path) { char *oldroot = _dwib_image_root; struct dwstat st; @@ -1790,12 +1790,12 @@ * Returns: * DW_ERROR_NONE if locale was found and selected, or DW_ERROR_GENERAL. */ -int API dwib_locale_set(char *loc) +int API dwib_locale_set(const char *loc) { char *oldlocale = _dwib_locale, *encode; /* Should we check that the locale is valid? */ - _dwib_locale = loc ? strdup(loc) : loc; + _dwib_locale = loc ? strdup(loc) : NULL; /* Trim off encoding string... * Often the LANG environment variable will be @@ -1821,7 +1821,7 @@ * Returns: * A handle to a widget or NULL on failure. */ -HWND API dwib_window_get_handle(HWND handle, char *dataname) +HWND API dwib_window_get_handle(HWND handle, const char *dataname) { return (HWND)dw_window_get_data(handle,dataname); }