Huw Davies : oledlg: Copy the appropiate list to the display list.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 20 04:45:56 CDT 2006


Module: wine
Branch: master
Commit: f07bbbd43403a718eae0a13c6dd8df385aef2b95
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f07bbbd43403a718eae0a13c6dd8df385aef2b95

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Oct 18 21:50:04 2006 +0100

oledlg: Copy the appropiate list to the display list.

---

 dlls/oledlg/pastespl.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/dlls/oledlg/pastespl.c b/dlls/oledlg/pastespl.c
index 47145b2..f62e4f4 100644
--- a/dlls/oledlg/pastespl.c
+++ b/dlls/oledlg/pastespl.c
@@ -216,6 +216,35 @@ static DWORD init_linklist(HWND hdlg, OL
     return items_added;
 }
 
+/* copies src_list_id into the display list */
+static void update_display_list(HWND hdlg, UINT src_list_id)
+{
+    LONG count, i, old_pos;
+    WCHAR txt[256];
+    LONG item_data;
+    HWND display_list = GetDlgItem(hdlg, IDC_PS_DISPLAYLIST);
+    HWND list = GetDlgItem(hdlg, src_list_id);
+
+    old_pos = SendMessageW(display_list, LB_GETCURSEL, 0, 0);
+    if(old_pos == -1) old_pos = 0;
+
+    SendMessageW(display_list, WM_SETREDRAW, 0, 0);
+    SendMessageW(display_list, LB_RESETCONTENT, 0, 0);
+    count = SendMessageW(list, LB_GETCOUNT, 0, 0);
+    for(i = 0; i < count; i++)
+    {
+        SendMessageW(list, LB_GETTEXT, i, (LPARAM)txt);
+        item_data = SendMessageW(list, LB_GETITEMDATA, i, 0);
+        SendMessageW(display_list, LB_INSERTSTRING, i, (LPARAM)txt);
+        SendMessageW(display_list, LB_SETITEMDATA, i, item_data);
+    }
+    old_pos = max(old_pos, count);
+    SendMessageW(display_list, LB_SETCURSEL, 0, 0);
+    SendMessageW(display_list, WM_SETREDRAW, 1, 0);
+    if(GetForegroundWindow() == hdlg)
+        SetFocus(display_list);
+}
+
 static void init_lists(HWND hdlg, ps_struct_t *ps_struct)
 {
     DWORD pastes_added = init_pastelist(hdlg, ps_struct->ps);
@@ -252,6 +281,11 @@ static void init_lists(HWND hdlg, ps_str
     }
 
     CheckRadioButton(hdlg, IDC_PS_PASTE, IDC_PS_PASTELINK, check_id);
+
+    if(list_id)
+        update_display_list(hdlg, list_id);
+    else
+        EnableWindow(GetDlgItem(hdlg, IDOK), 0);
 }
 
 static void update_structure(HWND hdlg, ps_struct_t *ps_struct)




More information about the wine-cvs mailing list