📄 mwdvetest.c
字号:
/*
*
* TEST program for the new DVE implementations
*
* Copyright (C) 2004, Gabriele Brugnoni
* <gabrielebrugnoni@dveprojects.com>
* DVE Prog. El. - Varese, Italy
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "windows.h"
#include "wintern.h"
#include "dveres.h"
HINSTANCE hInst;
static HFONT hFntCyber12 = NULL;
static HFONT hFntCyber14 = NULL;
BOOL CALLBACK defDemoDlg ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
switch ( message )
{
case WM_INITDIALOG:
{
#ifdef DEBUGBASEUNIT
char s[256];
RECT rc, rcb;
TEXTMETRIC tm;
HFONT hfnt = (HFONT) SendMessage ( hWnd, WM_GETFONT, 0, 0 );
HDC hdc = GetDC ( hWnd );
rcb.left = rcb.top = 0;
rcb.right = 4, rcb.bottom = 8;
SelectObject ( hdc, hfnt );
GetTextMetrics ( hdc, &tm );
GetClientRect(hWnd, &rc);
MapDialogRect ( hWnd, &rcb );
sprintf ( s, "AW=%d (%d), Ht=%d (%d), %d x %d",
tm.tmAveCharWidth, rcb.right, tm.tmHeight, rcb.bottom,
rc.right, rc.bottom );
SetWindowText ( hWnd, s );
ReleaseDC ( hWnd, hdc );
#endif
}
break;
case WM_CTLCOLORSTATIC:
{
if( GetDlgCtrlID((HWND)lParam) == IDC_CTLCOLOR )
{
HBRUSH hbr = (HBRUSH)DefWindowProc ( hWnd, message, wParam, lParam );
SetTextColor ( (HDC)wParam, RGB(255,0,0) );
SetBkColor ( (HDC)wParam, GetSysColor(COLOR_3DFACE) );
return (BOOL) hbr;
}
}
return DefWindowProc ( hWnd, message, wParam, lParam );
case WM_COMMAND:
switch ( LOWORD(wParam) )
{
case IDOK:
EndDialog ( hWnd, TRUE );
break;
case IDCANCEL:
EndDialog ( hWnd, FALSE );
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
BOOL CALLBACK dlgDemoStatic ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
// Vedere: GdConvertEncoding
if( message == WM_INITDIALOG ) {
if( hFntCyber12 == NULL )
hFntCyber12 = CreateFont ( -12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0, "Cyberbit" );
SendDlgItemMessage(hWnd, IDC_ARABICDEMO, WM_SETFONT,
(WPARAM)hFntCyber12, 0 );
SetWindowText(GetDlgItem(hWnd, IDC_ARABICDEMO),
"Arabic \xd8\xaa\xd8\xab\xd8\xac\xd8\xad demo:\n"
"\xd8\xaa\xd8\xab\xd8\xac\xd8\xad \xd8\xaa\xd8\xab\xd8\xac\xd8\xad\xd8\xae \xd8\xaa\xd8\xab\xd8\xac\xd8\xad\xd8\xaf\n"
"\xd8\xaa\xd8\xab\xd8\xac\xd8\xad 12345\n"
);
SendDlgItemMessage(hWnd, IDC_STATICFONT1, WM_SETFONT,
(WPARAM)GetStockObject(SYSTEM_FONT), 0 );
}
return defDemoDlg ( hWnd, message, wParam, lParam );
}
BOOL CALLBACK dlgDemoInternational ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
/* References:
Cyberbit: http://www.math.nus.edu.sg/aslaksen/cs/cjk.html
ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/Cyberbit.ZIP
Text: http://www.columbia.edu/~fdc/pace/
*/
if( message == WM_INITDIALOG ) {
//char *arabic_utf8 = "اةتثجحخدذرزسشصضطظعغ اةتثجحخدذرزسشصضطظعغ اةتثجحخدذرزسشصضطظعغ اةتثجحخدذرزسشصضطظعغ";
if( hFntCyber12 == NULL )
hFntCyber12 = CreateFont ( -12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0, "Cyberbit" );
SendDlgItemMessage(hWnd, IDC_STATICFONT1, WM_SETFONT,
(WPARAM)hFntCyber12, 0 );
SetWindowText(GetDlgItem(hWnd, IDC_STATICFONT1),
"Arabic:\n"
" أنا قادر على أكل الزجاج و هذا لا يؤلمني. \n"
"Mixed Latin + Arabic:\n"
"Arabic: أنا قادر على أكل الزجاج و هذا لا يؤلمن\n"
"Mixed Arabic + Latin:\n"
" أنا قادر على أكل الزجاج و هذا لا يؤلمني. (arabic)\n"
"\n'Peace' in some languages:\n"
"Arabic: سلام (salām)\n"
"Darja: عسلامة (esslama)\n"
"Greek: Ειρήνη (iríni)\n"
"Kurdish: Hasîtî, Һашити (hasiti), ھاسیتی (hasītī)"
);
}
return defDemoDlg ( hWnd, message, wParam, lParam );
}
BOOL CALLBACK dlgDemoMultiline ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
/* References:
Cyberbit: http://www.math.nus.edu.sg/aslaksen/cs/cjk.html
ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/Cyberbit.ZIP
Text: http://www.columbia.edu/~fdc/pace/
*/
if( message == WM_INITDIALOG ) {
//char *arabic_utf8 = "اةتثجحخدذرزسشصضطظعغ اةتثجحخدذرزسشصضطظعغ اةتثجحخدذرزسشصضطظعغ اةتثجحخدذرزسشصضطظعغ";
if( hFntCyber14 == NULL )
hFntCyber14 = CreateFont ( -14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0, "Cyberbit" );
SendDlgItemMessage(hWnd, IDC_EDIT1, WM_SETFONT,
(WPARAM)hFntCyber14, 0 );
SetWindowLong(GetDlgItem(hWnd, IDC_EDIT1), GWL_STYLE, GetWindowLong(GetDlgItem(hWnd, IDC_EDIT1), GWL_STYLE) & ~ES_AUTOHSCROLL);
SetWindowText(GetDlgItem(hWnd, IDC_EDIT1),
"Arabic:\n"
" أنا قادر على أكل الزجاج و هذا لا يؤلمني. \n"
"Mixed Latin + Arabic:\n"
"Arabic: أنا قادر على أكل الزجاج و هذا لا يؤلمن\n"
"Mixed Arabic + Latin:\n"
" أنا قادر على أكل الزجاج و هذا لا يؤلمني. (arabic)\n"
"\n'Peace' in some languages:\n"
"Arabic: سلام (salām)\n"
"Darja: عسلامة (esslama)\n"
"Greek: Ειρήνη (iríni)\n"
"Kurdish: Hasîtî, Һашити (hasiti), ھاسیتی (hasītī)"
);
}
return defDemoDlg ( hWnd, message, wParam, lParam );
}
BOOL CALLBACK dlgDemoStrings ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
if( message == WM_INITDIALOG )
{
char s[256];
int i;
for ( i=0; i < 4; i++ )
{
if( !LoadString(hInst, IDS_STRING1+i, s, sizeof(s)) )
strcpy ( s, "NOT FOUND!!" );
SendDlgItemMessage(hWnd, IDC_STRING1+i, WM_SETTEXT,
0, (LPARAM)s );
}
}
return defDemoDlg ( hWnd, message, wParam, lParam );
}
BOOL CALLBACK dlgDemoEdit ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
switch ( message )
{
case WM_INITDIALOG:
if( hFntCyber14 == NULL )
hFntCyber14 = CreateFont ( -14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0, "Cyberbit" );
SendDlgItemMessage(hWnd, IDC_EDIT1, WM_SETFONT, (WPARAM)hFntCyber14, 0 );
SendDlgItemMessage(hWnd, IDC_EDIT4, WM_SETFONT, (WPARAM)hFntCyber14, 0 );
break;
case WM_COMMAND:
switch ( LOWORD(wParam) )
{
case IDC_BUTT_COPY:
{
char s[256];
GetDlgItemText ( hWnd, IDC_EDIT1, s, sizeof(s) );
SetDlgItemText ( hWnd, IDC_EDIT4, s );
return TRUE;
}
}
break;
}
return defDemoDlg ( hWnd, message, wParam, lParam );
}
BOOL CALLBACK dlgDemoList ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
switch ( message )
{
case WM_INITDIALOG:
{
int tabs[] = {31-7, 81-7};
SendDlgItemMessage ( hWnd, IDC_LIST_TABS, LB_SETTABSTOPS,
sizeof(tabs)/sizeof(tabs[0]), (LPARAM)tabs );
SendDlgItemMessage ( hWnd, IDC_LIST_TABS, LB_SETHORIZONTALEXTENT, 500, 0 );
SendDlgItemMessage ( hWnd, IDC_LIST_TABS, LB_ADDSTRING, 0, (LPARAM) "[1]\tThis is tabbed\tYes" );
SendDlgItemMessage ( hWnd, IDC_LIST_TABS, LB_ADDSTRING, 0, (LPARAM) "This exits from tab space\tOK" );
SendDlgItemMessage ( hWnd, IDC_LIST_OD, LB_ADDSTRING, 0, (LPARAM)"String 1" );
SendDlgItemMessage ( hWnd, IDC_LIST_OD, LB_ADDSTRING, 0, (LPARAM)"String 2" );
SendDlgItemMessage ( hWnd, IDC_LIST_OD, LB_ADDSTRING, 0, (LPARAM)"String 3" );
SendDlgItemMessage ( hWnd, IDC_LIST_ODV, LB_ADDSTRING, 0, (LPARAM)"String 1" );
SendDlgItemMessage ( hWnd, IDC_LIST_ODV, LB_ADDSTRING, 0, (LPARAM)"String 2" );
SendDlgItemMessage ( hWnd, IDC_LIST_ODV, LB_ADDSTRING, 0, (LPARAM)"String 3" );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -