You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bi...@apache.org on 2003/09/03 05:45:11 UTC
cvs commit: jakarta-commons-sandbox/daemon/src/native/nt/procrun/bin procrunw.exe tomcatw.exe
billbarker 2003/09/02 20:45:11
Modified: daemon/src/native/nt/procrun procgui.c
daemon/src/native/nt/procrun/bin procrunw.exe tomcatw.exe
Log:
Implementing the Clipboard-Copy functionality for the new ListView Console.
Also cleaned up the Console parsing a bit (so at least it doesn't eat lines). It could still use more cleanup.
Fix for Bug #18220
Reported By: Marc Lehmann marc.lehmann@infineon.com
Revision Changes Path
1.25 +67 -31 jakarta-commons-sandbox/daemon/src/native/nt/procrun/procgui.c
Index: procgui.c
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procgui.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- procgui.c 8 Aug 2003 13:09:34 -0000 1.24
+++ procgui.c 3 Sep 2003 03:45:09 -0000 1.25
@@ -183,16 +183,17 @@
{
int row = 0x7FFFFFFF;
LV_ITEM lvi;
+ int off = 0;
if (isdigit(*str)) {
char t[32];
- sscanf(str, "%s %s", ac_lv_stat, t);
+ sscanf(str, "%s %s %s", ac_lv_stat, t, ac_lv_class);
strcat(ac_lv_stat, " ");
strcat(ac_lv_stat, t);
strcpy(ac_lv_class, str + strlen(ac_lv_stat) + strlen(t) + 2);
+ str += strlen(ac_lv_stat) + strlen(t) + strlen(ac_lv_class) + 3;
}
else {
- int off = 0;
if (STRN_COMPARE(str, "INFO:")) {
ac_lv_iicon = 0;
off = STRN_SIZE("INFO:") + 1;
@@ -209,22 +210,22 @@
ac_lv_iicon = 2;
off = STRN_SIZE("SEVERE:") + 1;
}
- memset(&lvi, 0, sizeof(LV_ITEM));
- lvi.mask = LVIF_IMAGE | LVIF_TEXT;
- lvi.iItem = ac_lview_current;
- lvi.iImage = ac_lv_iicon;
- lvi.pszText = ac_lv_stat;
- lvi.cchTextMax = strlen(ac_lv_stat) + 1;
- row = ListView_InsertItem(ac_list_hwnd, &lvi);
- if (row == -1)
- return;
- ListView_SetItemText(ac_list_hwnd, row, 1, ac_lv_class);
- ListView_SetItemText(ac_list_hwnd, row, 2, (char *)(str + off));
- ListView_EnsureVisible(ac_list_hwnd,
+ }
+ memset(&lvi, 0, sizeof(LV_ITEM));
+ lvi.mask = LVIF_IMAGE | LVIF_TEXT;
+ lvi.iItem = ac_lview_current;
+ lvi.iImage = ac_lv_iicon;
+ lvi.pszText = ac_lv_stat;
+ lvi.cchTextMax = strlen(ac_lv_stat) + 1;
+ row = ListView_InsertItem(ac_list_hwnd, &lvi);
+ if (row == -1)
+ return;
+ ListView_SetItemText(ac_list_hwnd, row, 1, ac_lv_class);
+ ListView_SetItemText(ac_list_hwnd, row, 2, (char *)(str + off));
+ ListView_EnsureVisible(ac_list_hwnd,
ListView_GetItemCount(ac_list_hwnd) - 1,
FALSE);
- }
ac_lview_current++;
}
@@ -335,33 +336,67 @@
static int ac_copy_to_clipboard()
{
- HGLOBAL hglbcopy;
+ HGLOBAL hglbcopy = NULL;
DWORD sel, i;
char buf[MAX_PATH + 2], *str;
- int *si;
+ int *si = NULL;
if (!OpenClipboard(NULL))
return -1;
EmptyClipboard();
- sel = SendMessage(ac_list_hwnd, LB_GETSELCOUNT, (WPARAM)0, (LPARAM)0);
- if (sel != LB_ERR && sel > 0) {
- si = (int *)malloc(sel * sizeof(int));
- hglbcopy = GlobalAlloc(GMEM_MOVEABLE,
- (MAX_PATH + 2) * sel);
- str = GlobalLock(hglbcopy);
- str[0] = '\0';
- SendMessage(ac_list_hwnd, LB_GETSELITEMS, (WPARAM)sel, (LPARAM)si);
- for (i = 0; i < sel; i++) {
- SendMessage(ac_list_hwnd, LB_GETTEXT, (WPARAM)si[i], (LPARAM)buf);
- strcat(buf, "\n");
- strcat(str, buf);
+ if (ac_use_lview) {
+ sel = ListView_GetSelectedCount(ac_list_hwnd);
+ if (sel != LB_ERR && sel > 0) {
+ int curr;
+ str = malloc((MAX_PATH+4)*sel);
+ str[0] = '\0';
+ curr = ListView_GetNextItem(ac_list_hwnd, -1, LVNI_SELECTED);
+ for (i = 0; i < sel && curr >= 0; i++) {
+ int j;
+ for(j=0; j < 3; j++) {
+ ListView_GetItemText(ac_list_hwnd, curr, j, buf, MAX_PATH);
+ strcat(buf, j < 2 ? "\t" : "\r\n");
+ strcat(str, buf);
+ }
+ curr = ListView_GetNextItem(ac_list_hwnd, curr, LVNI_SELECTED);
+ }
+ sel = strlen(str);
+ if(sel > 0) {
+ hglbcopy = GlobalAlloc(GMEM_MOVEABLE, sel+1);
+ strcpy(GlobalLock(hglbcopy), str);
+ }
+ free(str);
+
+ }
+ }
+ else {
+ sel = SendMessage(ac_list_hwnd, LB_GETSELCOUNT, (WPARAM)0, (LPARAM)0);
+ if (sel != LB_ERR && sel > 0) {
+ si = (int *)malloc(sel * sizeof(int));
+ str = malloc((MAX_PATH + 2) * sel);
+ str[0] = '\0';
+ SendMessage(ac_list_hwnd, LB_GETSELITEMS, (WPARAM)sel, (LPARAM)si);
+ for (i = 0; i < sel; i++) {
+ SendMessage(ac_list_hwnd, LB_GETTEXT, (WPARAM)si[i], (LPARAM)buf);
+ strcat(buf, "\r\n");
+ strcat(str, buf);
+ }
+ sel = strlen(str);
+ if(sel > 0) {
+ hglbcopy = GlobalAlloc(GMEM_MOVEABLE, sel+1);
+ strcpy(GlobalLock(hglbcopy), str);
+ }
+ free(str);
+ free(si);
}
+ }
+
+ if(hglbcopy != NULL) {
GlobalUnlock(hglbcopy);
SetClipboardData(CF_TEXT, hglbcopy);
-
- free(si);
}
+ CloseClipboard();
return 0;
}
@@ -960,6 +995,7 @@
return FALSE;
}
+
INT_PTR ac_show_properties(HWND owner)
{
1.29 +40 -36 jakarta-commons-sandbox/daemon/src/native/nt/procrun/bin/procrunw.exe
<<Binary file>>
1.24 +40 -36 jakarta-commons-sandbox/daemon/src/native/nt/procrun/bin/tomcatw.exe
<<Binary file>>