changeset 1880:6949c73e30fd

Fixes for building on OS/2 and removed some strdup()s in the test program which are no longer needed.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 09 Aug 2013 23:28:17 +0000
parents 8a205b80617e
children 653ccb517aa1
files dwtest.c os2/dw.c os2/dw.def os2/dw.lnk
diffstat 4 files changed, 25 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/dwtest.c	Fri Aug 09 22:40:54 2013 +0000
+++ b/dwtest.c	Fri Aug 09 23:28:17 2013 +0000
@@ -1254,13 +1254,13 @@
     dw_container_insert(container, containerinfo, 3);
 
     containerinfo = dw_container_alloc(container, 1);
-    dw_filesystem_set_file(container, containerinfo, 0, strdup("Yikes"), foldericon);
+    dw_filesystem_set_file(container, containerinfo, 0, "Yikes", foldericon);
     size = 324;
     dw_filesystem_set_item(container, containerinfo, 0, 0, &foldericon);
     dw_filesystem_set_item(container, containerinfo, 1, 0, &size);
     dw_filesystem_set_item(container, containerinfo, 2, 0, &time);
     dw_filesystem_set_item(container, containerinfo, 3, 0, &date);
-    dw_container_set_row_title(containerinfo, 0, strdup("Extra"));
+    dw_container_set_row_title(containerinfo, 0, "Extra");
 
     dw_container_insert(container, containerinfo, 1);
     dw_container_optimize(container);
--- a/os2/dw.c	Fri Aug 09 22:40:54 2013 +0000
+++ b/os2/dw.c	Fri Aug 09 23:28:17 2013 +0000
@@ -3162,8 +3162,9 @@
                {
                case CN_ENTER:
                   {
-                     int (API_FUNC containerselectfunc)(HWND, char *, void *) = (int (API_FUNC)(HWND, char *, void *))tmp->signalfunction;
+                     int (API_FUNC containerselectfunc)(HWND, char *, void *, void *) = (int (API_FUNC)(HWND, char *, void *, void *))tmp->signalfunction;
                      char *text = NULL;
+                     void *data = NULL;
 
                      if(mp2)
                      {
@@ -3171,12 +3172,15 @@
 
                         pre = ((PNOTIFYRECORDENTER)mp2)->pRecord;
                         if(pre)
-                           text = (char *)pre->pszIcon;
+                        {
+                            text = (char *)pre->pszIcon;
+                            data = (void *)pre->pszText;
+                        }
                      }
 
                      if(tmp->window == notifyhwnd)
                      {
-                        result = containerselectfunc(tmp->window, text, tmp->data);
+                        result = containerselectfunc(tmp->window, text, tmp->data, data);
                         tmp = NULL;
                      }
                   }
@@ -3255,14 +3259,16 @@
                         {
                            if(tmp->window == pre->hwndCnr)
                            {
+                              /* PCNRITEM for Tree PRECORDCORE for Container */
                               PCNRITEM pci = (PCNRITEM)pre->pRecord;
+                              PRECORDCORE prc = pre->pRecord;
 
                               if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED))
                               {
                                  int (API_FUNC treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (API_FUNC)(HWND, HTREEITEM, char *, void *, void *))tmp->signalfunction;
 
                                  if(dw_window_get_data(tmp->window, "_dw_container"))
-                                    result = treeselectfunc(tmp->window, 0, (char *)pci->rc.pszIcon, tmp->data, 0);
+                                    result = treeselectfunc(tmp->window, 0, (char *)prc->pszIcon, tmp->data, (void *)prc->pszText);
                                  else
                                  {
                                     if(lasthcnr == tmp->window && lastitem == (HWND)pci)
@@ -10030,7 +10036,7 @@
       temp = temp->preccNextRecord;
 
    newtitle = title ? strdup(title) : NULL;
-   temp->pszName = temp->pszIcon = (PSZ)title;
+   temp->pszName = temp->pszIcon = (PSZ)newtitle;
 }
 
 /*
@@ -10051,7 +10057,7 @@
       {
          char *oldtitle = (char *)pCore->pszIcon;
          char *newtitle = title ? strdup(title) : NULL;
-         pCore->pszName = pCore->pszIcon = (PSZ)title;
+         pCore->pszName = pCore->pszIcon = (PSZ)newtitle;
 
          WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED));
          
@@ -10437,7 +10443,7 @@
  *       handle: Handle to the window (widget).
  *       data:  Data usually returned by dw_container_query().
  */
-void API dw_container_delete_row(HWND handle, void *data)
+void API dw_container_delete_row_by_data(HWND handle, void *data)
 {
    PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    int textcomp = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_textcomp"));
--- a/os2/dw.def	Fri Aug 09 22:40:54 2013 +0000
+++ b/os2/dw.def	Fri Aug 09 23:28:17 2013 +0000
@@ -163,6 +163,11 @@
   dw_filesystem_get_column_type          @245
   dw_filesystem_set_column_title         @246
 
+  dw_container_set_row_data              @600
+  dw_container_change_row_data           @601
+  dw_container_delete_row_by_data        @602
+  dw_container_cursor_by_data            @603
+
   dw_screen_width                        @250
   dw_screen_height                       @251
 
--- a/os2/dw.lnk	Fri Aug 09 22:40:54 2013 +0000
+++ b/os2/dw.lnk	Fri Aug 09 23:28:17 2013 +0000
@@ -158,6 +158,11 @@
 export dw_filesystem_get_column_type.245
 export dw_filesystem_set_column_title.246
 
+export dw_container_set_row_data.600
+export dw_container_change_row_data.601
+export dw_container_delete_row_by_data.602
+export dw_container_cursor_by_data.603
+
 export dw_screen_width.250
 export dw_screen_height.251