[wpdev-commits] wolfpack console_win.cpp,1.1,1.2
Brought to you by:
rip,
thiagocorrea
|
From: <dar...@us...> - 2003-09-09 01:28:19
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv10316
Modified Files:
console_win.cpp
Log Message:
Trying out new console code.
Index: console_win.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_win.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** console_win.cpp 8 Sep 2003 23:38:49 -0000 1.1
--- console_win.cpp 8 Sep 2003 23:59:59 -0000 1.2
***************
*** 24,27 ****
--- 24,29 ----
// Variables important for this GUI implementation
+ #define CONTROL_LOGWINDOW 0x10
+
HWND logWindow = 0; // Log Window
HWND inputWindow = 0; // Input Textfield
***************
*** 38,42 ****
LPVOID lpMsgBuf;
! if( !FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, 0, GetLastError(), MAKELANGID( LANG_NEUTRAL , SUBLANG_DEFAULT ), (LPTSTR)&lpMsgBuf, 0, 0 ) )
return QString( "Unknown Error" );
--- 40,44 ----
LPVOID lpMsgBuf;
! if( !FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, 0, GetLastError(), MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), (LPTSTR)&lpMsgBuf, 0, 0 ) )
return QString( "Unknown Error" );
***************
*** 58,62 ****
case WM_CREATE:
// Create Richedit Box
! logWindow = CreateWindow( RICHEDIT_CLASS, 0, ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_VSCROLL, 0, 0, 10, 10, hwnd, 0, appInstance, 0 );
if( logWindow == 0 )
--- 60,64 ----
case WM_CREATE:
// Create Richedit Box
! logWindow = CreateWindow( RICHEDIT_CLASS, 0, ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL|ES_AUTOHSCROLL|ES_READONLY|WS_CHILD|WS_VISIBLE|WS_VSCROLL, 0, 0, 10, 10, hwnd, (HMENU)CONTROL_LOGWINDOW, appInstance, 0 );
if( logWindow == 0 )
***************
*** 91,94 ****
--- 93,97 ----
return 0;
+ // Autosize our Window Elements
case WM_SIZE:
if( logWindow && inputWindow && wparam != SIZE_MINIMIZED && wparam != SIZE_MAXHIDE )
***************
*** 115,118 ****
--- 118,156 ----
return 0;
+
+ case WM_ERASEBKGND:
+ return 1;
+
+ case WM_SETFOCUS:
+ SendMessage( inputWindow, WM_SETFOCUS, 0, 0 );
+ return 1;
+
+ case WM_NOTIFY:
+ if( wparam == CONTROL_LOGWINDOW )
+ {
+ NMHDR *notify = (NMHDR*)lparam;
+
+ if( notify->code == EN_LINK )
+ {
+ ENLINK *link = (ENLINK*)notify;
+
+ if( link->msg == WM_LBUTTONDOWN )
+ {
+ char *string = new char[ ( link->chrg.cpMax - link->chrg.cpMin ) + 1 ];
+
+ TEXTRANGE tr;
+ tr.chrg = link->chrg;
+ tr.lpstrText = string;
+
+ SendMessage( logWindow, EM_GETTEXTRANGE, 0, (LPARAM)&tr );
+
+ // String contains the link
+
+ delete [] string;
+
+ // Reset selection to the end
+ }
+ }
+ }
case WM_DESTROY:
***************
*** 175,179 ****
// Create the Window itself
! mainWindow = CreateWindow( WOLFPACK_CLASS, "Wolfpack", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 400, NULL, 0, hInstance, NULL );
if( mainWindow == 0 )
--- 213,217 ----
// Create the Window itself
! mainWindow = CreateWindow( WOLFPACK_CLASS, "Wolfpack", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, 0, hInstance, NULL );
if( mainWindow == 0 )
***************
*** 219,223 ****
{
// process \b properly
-
SendMessage( logWindow, EM_REPLACESEL, FALSE, (LPARAM)sMessage.latin1() );
}
--- 257,260 ----
***************
*** 251,254 ****
--- 288,292 ----
cf.crTextColor = RGB( 0xFF,0xFF,0xFF );
break;
+
};
|