|
From: <kr_...@us...> - 2003-03-30 18:49:12
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv19641/port/src/cbits/Win32
Modified Files:
Frame.c Util.c Window.c
Log Message:
The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter.
Index: Frame.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Frame.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Frame.c 29 Mar 2003 08:12:19 -0000 1.3
--- Frame.c 30 Mar 2003 18:49:07 -0000 1.4
***************
*** 188,189 ****
--- 188,242 ----
return result;
};
+
+ char *osGetProcessTitle()
+ {
+ FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
+ return pFrameData->lpszAppName;
+ }
+
+ void osSetProcessTitle(char *szAppName)
+ {
+ HWND hWnd;
+ char *s, *title;
+ int nTextLen;
+ FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
+
+ pFrameData->lpszAppName = strdup(szAppName);
+
+ hWnd = pFrameData->hClientWnd;
+ if (pFrameData->DocumentInterface == 2)
+ hWnd = (HWND) SendMessage(hWnd, WM_MDIGETACTIVE, 0, 0);
+
+ s = NULL;
+ if (hWnd)
+ {
+ nTextLen = GetWindowTextLength(hWnd);
+ s = malloc(nTextLen+1);
+ if (s) GetWindowText(hWnd, s, nTextLen);
+ }
+
+ if (pFrameData->lpszAppName && *pFrameData->lpszAppName)
+ {
+ if (s && *s)
+ {
+ title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6);
+
+ if (title)
+ {
+ strcpy(title, pFrameData->lpszAppName);
+ strcat(title, " - [");
+ strcat(title, s);
+ strcat(title, "]");
+ SetWindowText(ghWndFrame, title);
+ }
+
+ rfree(title);
+ }
+ else
+ SetWindowText(ghWndFrame, pFrameData->lpszAppName);
+ }
+ else
+ SetWindowText(ghWndFrame, s);
+
+ free(s);
+ }
Index: Util.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Util.c 29 Mar 2003 08:12:19 -0000 1.10
--- Util.c 30 Mar 2003 18:49:07 -0000 1.11
***************
*** 50,54 ****
*/
! void osInit(char *szAppName, int DocumentInterface)
{
if (!ghModule)
--- 50,54 ----
*/
! void osInit(int DocumentInterface)
{
if (!ghModule)
***************
*** 130,134 ****
{
ghWndFrame = CreateWindow ( "HSDIFRAME",
! szAppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,
--- 130,134 ----
{
ghWndFrame = CreateWindow ( "HSDIFRAME",
! NULL,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,
***************
*** 143,147 ****
{
ghWndFrame = CreateWindow ( "HMDIFRAME",
! szAppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,
--- 143,147 ----
{
ghWndFrame = CreateWindow ( "HMDIFRAME",
! NULL,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,
***************
*** 200,201 ****
--- 200,202 ----
DestroyWindow(ghWndFrame);
}
+
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Window.c 29 Mar 2003 08:12:19 -0000 1.17
--- Window.c 30 Mar 2003 18:49:07 -0000 1.18
***************
*** 716,722 ****
char *s = (char *) lParam;
! printf("WM_SETTEXT %p %d\n", s, *s);
!
! if (pFrameData->lpszAppName)
{
if (s && *s)
--- 716,720 ----
char *s = (char *) lParam;
! if (pFrameData->lpszAppName && *pFrameData->lpszAppName)
{
if (s && *s)
***************
*** 724,737 ****
char *title;
int nTextLen;
!
! s = (char *) lParam;
nTextLen = strlen(s);
title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6);
! strcpy(title, pFrameData->lpszAppName);
! strcat(title, " - [");
! strcat(title, s);
! strcat(title, "]");
! SetWindowText(ghWndFrame, title);
}
else
--- 722,739 ----
char *title;
int nTextLen;
!
nTextLen = strlen(s);
title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6);
! if (title)
! {
! strcpy(title, pFrameData->lpszAppName);
! strcat(title, " - [");
! strcat(title, s);
! strcat(title, "]");
! SetWindowText(ghWndFrame, title);
! }
!
! free(title);
}
else
***************
*** 774,789 ****
case WM_SETTEXT:
{
! char *title, *s;
! int nTextLen;
! s = (char *) lParam;
! nTextLen = strlen(s);
! title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6);
! strcpy(title, pFrameData->lpszAppName);
! strcat(title, " - [");
! strcat(title, s);
! strcat(title, "]");
! SetWindowText(ghWndFrame, title);
}
break;
--- 776,807 ----
case WM_SETTEXT:
{
! char *s = (char *) lParam;
!
! if (pFrameData->lpszAppName && *pFrameData->lpszAppName)
! {
! if (s && *s)
! {
! char *title;
! int nTextLen;
! nTextLen = strlen(s);
! title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6);
! if (title)
! {
! strcpy(title, pFrameData->lpszAppName);
! strcat(title, " - [");
! strcat(title, s);
! strcat(title, "]");
! SetWindowText(ghWndFrame, title);
! }
!
! free(title);
! }
! else
! SetWindowText(ghWndFrame, pFrameData->lpszAppName);
! }
! else
! SetWindowText(ghWndFrame, s);
}
break;
***************
*** 801,804 ****
--- 819,824 ----
strcat(title, "]");
SetWindowText(ghWndFrame, title);
+
+ free(title);
if (hWnd == (HWND) lParam)
|