📄 wdefutil.c
字号:
Bool ret;
Bool overlapped;
_wde_touch(lParam);
ret = FALSE;
if ( ( message == WM_COMMAND ) &&
( GET_WM_COMMAND_CMD(wParam,lParam) == BN_CLICKED ) ) {
switch ( LOWORD(wParam) ) {
case IDB_WS_CHILD:
if ( IsDlgButtonChecked(hDlg, IDB_WS_CHILD) ) {
CheckDlgButton(hDlg, IDB_WS_POPUP, 0);
}
ret = TRUE;
break;
case IDB_WS_POPUP:
if ( IsDlgButtonChecked(hDlg, IDB_WS_POPUP) ) {
CheckDlgButton(hDlg, IDB_WS_CHILD, 0);
}
ret = TRUE;
break;
case IDB_WS_CAPTION:
if ( IsDlgButtonChecked(hDlg, IDB_WS_CAPTION) ) {
CheckDlgButton(hDlg, IDB_WS_BORDER, 1);
CheckDlgButton(hDlg, IDB_WS_DLGFRAME, 1);
} else {
CheckDlgButton(hDlg, IDB_WS_BORDER, 0);
CheckDlgButton(hDlg, IDB_WS_DLGFRAME, 0);
}
ret = TRUE;
break;
case IDB_WS_DLGFRAME:
case IDB_WS_BORDER:
if ( IsDlgButtonChecked(hDlg, IDB_WS_BORDER) ) {
if ( IsDlgButtonChecked(hDlg, IDB_WS_DLGFRAME) ) {
CheckDlgButton(hDlg, IDB_WS_CAPTION, 1);
} else {
CheckDlgButton(hDlg, IDB_WS_CAPTION, 0);
}
} else {
CheckDlgButton(hDlg, IDB_WS_CAPTION, 0);
}
ret = TRUE;
break;
#if __NT__XX
case IDB_WS_EX_CLIENTEDGE:
if ( IsDlgButtonChecked(hDlg, IDB_WS_EX_CLIENTEDGE) &&
IsDlgButtonChecked(hDlg, IDB_WS_EX_WINDOWEDGE) ) {
CheckDlgButton(hDlg, IDB_WS_EX_OVERLAPPEDWINDOW, 1);
} else {
CheckDlgButton(hDlg, IDB_WS_EX_OVERLAPPEDWINDOW, 0);
}
break;
case IDB_WS_EX_WINDOWEDGE:
check_WINDOWEDGE:
if ( IsDlgButtonChecked(hDlg, IDB_WS_EX_WINDOWEDGE) ) {
if ( IsDlgButtonChecked(hDlg, IDB_WS_EX_CLIENTEDGE) ) {
CheckDlgButton(hDlg, IDB_WS_EX_OVERLAPPEDWINDOW, 1);
} else {
CheckDlgButton(hDlg, IDB_WS_EX_OVERLAPPEDWINDOW, 0);
}
if ( IsDlgButtonChecked(hDlg, IDB_WS_EX_TOOLWINDOW) &&
IsDlgButtonChecked(hDlg, IDB_WS_EX_TOPMOST) ) {
CheckDlgButton(hDlg, IDB_WS_EX_PALETTEWINDOW, 1);
} else {
CheckDlgButton(hDlg, IDB_WS_EX_PALETTEWINDOW, 0);
}
} else {
CheckDlgButton(hDlg, IDB_WS_EX_OVERLAPPEDWINDOW, 0);
CheckDlgButton(hDlg, IDB_WS_EX_PALETTEWINDOW, 0);
}
break;
case IDB_WS_EX_TOOLWINDOW:
case IDB_WS_EX_TOPMOST:
if ( IsDlgButtonChecked(hDlg, IDB_WS_EX_TOOLWINDOW) &&
IsDlgButtonChecked(hDlg, IDB_WS_EX_WINDOWEDGE) &&
IsDlgButtonChecked(hDlg, IDB_WS_EX_TOPMOST) ) {
CheckDlgButton(hDlg, IDB_WS_EX_PALETTEWINDOW, 1);
} else {
CheckDlgButton(hDlg, IDB_WS_EX_PALETTEWINDOW, 0);
}
break;
case IDB_WS_EX_OVERLAPPEDWINDOW:
if ( IsDlgButtonChecked(hDlg, IDB_WS_EX_OVERLAPPEDWINDOW) ) {
CheckDlgButton(hDlg, IDB_WS_EX_CLIENTEDGE, 1);
CheckDlgButton(hDlg, IDB_WS_EX_WINDOWEDGE, 1);
// force it to recheck WINDOWEDGE
goto check_WINDOWEDGE;
} else {
if (!IsDlgButtonChecked(hDlg, IDB_WS_EX_PALETTEWINDOW) ) {
CheckDlgButton(hDlg, IDB_WS_EX_WINDOWEDGE, 0);
}
CheckDlgButton(hDlg, IDB_WS_EX_CLIENTEDGE, 0);
}
break;
case IDB_WS_EX_PALETTEWINDOW:
if ( IsDlgButtonChecked(hDlg, IDB_WS_EX_PALETTEWINDOW) ) {
CheckDlgButton(hDlg, IDB_WS_EX_WINDOWEDGE, 1);
CheckDlgButton(hDlg, IDB_WS_EX_TOOLWINDOW, 1);
CheckDlgButton(hDlg, IDB_WS_EX_TOPMOST, 1);
// force it to recheck WINDOWEDGE
goto check_WINDOWEDGE;
} else {
if (!IsDlgButtonChecked(hDlg, IDB_WS_EX_OVERLAPPEDWINDOW) ) {
CheckDlgButton(hDlg, IDB_WS_EX_WINDOWEDGE, 0);
}
CheckDlgButton(hDlg, IDB_WS_EX_TOOLWINDOW, 0);
CheckDlgButton(hDlg, IDB_WS_EX_TOPMOST, 0);
}
break;
#endif
}
WdeGetWinStyles ( hDlg, &tstyle, mask ) ;
overlapped = IsDlgButtonChecked(hDlg, IDB_WS_OVERLAPPED);
if ( !(tstyle & 0xffff0000) ) {
if ( !overlapped ) {
CheckDlgButton(hDlg, IDB_WS_OVERLAPPED, 1);
ret = TRUE && ret;
}
} else {
if ( overlapped ) {
CheckDlgButton(hDlg, IDB_WS_OVERLAPPED, 0);
ret = TRUE && ret;
}
}
}
return ( ret );
}
Bool WdeProcessSymbolCombo ( HWND hDlg, UINT message,
WPARAM wParam, LPARAM lParam,
WdeHashTable *table, uint_16 id,
Bool use_id )
{
WORD hw;
Bool processed;
_wde_touch(lParam);
_wde_touch(id);
_wde_touch(use_id);
processed = FALSE;
if ( (message == WM_COMMAND) && (LOWORD(wParam) == IDB_SYMBOL) ) {
hw = GET_WM_COMMAND_CMD(wParam,lParam);
if ( ( hw == CBN_EDITCHANGE ) || ( hw == CBN_SELCHANGE ) ) {
WdeDefineObjectLookupComboEntry ( hDlg, hw, table );
processed = TRUE;
}
}
return ( processed );
}
void WdeDefineObjectLookupComboEntry( HWND hDlg, WORD hw,
WdeHashTable *table )
{
char *str;
char *cp;
WdeHashValue value;
Bool found;
LRESULT index;
int count;
if( !table ) {
return;
}
count = SendDlgItemMessage( hDlg, IDB_SYMBOL, CB_GETCOUNT, 0, 0 );
if( !count || (count == CB_ERR) ) {
return;
}
str = NULL;
if ( hw == CBN_EDITCHANGE ) {
str = WdeGetStrFromCombo ( hDlg, IDB_SYMBOL );
} else {
index = SendDlgItemMessage ( hDlg, IDB_SYMBOL, CB_GETCURSEL, 0, 0 );
if( index != CB_ERR ) {
str = WdeGetStrFromComboLBox ( hDlg, IDB_SYMBOL, index );
}
}
if( str == NULL ) {
return;
}
WRStripSymbol( str );
// if the string numeric or empty then return
strtoul( str, &cp, 0 );
if( *cp == '\0' ) {
WdeMemFree( str );
return;
}
if( str[0] != '"' ) {
value = WdeLookupName( table, str, &found );
if( found ) {
WdeSetEditWithSINT32( (int_32) value, 10, hDlg, IDB_ID );
}
}
WdeMemFree( str );
}
/* JPK - added for help id support
* - these next two routines are essentially the same as those for
* the symbol combo box
*/
Bool WdeProcessHelpSymbolCombo ( HWND hDlg, UINT message,
WPARAM wParam, LPARAM lParam,
WdeHashTable *table, uint_32 id,
Bool use_id )
{
WORD hw;
Bool processed;
_wde_touch(lParam);
_wde_touch(id);
_wde_touch(use_id);
processed = FALSE;
if ( (message == WM_COMMAND) && (LOWORD(wParam) == IDB_HELPSYMBOL) ) {
hw = GET_WM_COMMAND_CMD(wParam,lParam);
if ( ( hw == CBN_EDITCHANGE ) || ( hw == CBN_SELCHANGE ) ) {
WdeDefineObjectLookupHelpComboEntry ( hDlg, hw, table );
processed = TRUE;
}
}
return ( processed );
}
void WdeDefineObjectLookupHelpComboEntry( HWND hDlg, WORD hw,
WdeHashTable *table )
{
char *str;
char *cp;
WdeHashValue value;
Bool found;
LRESULT index;
int count;
if( !table ) {
return;
}
count = SendDlgItemMessage( hDlg, IDB_HELPSYMBOL, CB_GETCOUNT, 0, 0 );
if( !count || (count == CB_ERR) ) {
return;
}
str = NULL;
if ( hw == CBN_EDITCHANGE ) {
str = WdeGetStrFromCombo ( hDlg, IDB_HELPSYMBOL );
} else {
index = SendDlgItemMessage ( hDlg, IDB_HELPSYMBOL, CB_GETCURSEL, 0, 0 );
if( index != CB_ERR ) {
str = WdeGetStrFromComboLBox ( hDlg, IDB_HELPSYMBOL, index );
}
}
if( str == NULL ) {
return;
}
WRStripSymbol( str );
// if the string numeric or empty then return
strtoul( str, &cp, 0 );
if( *cp == '\0' ) {
WdeMemFree( str );
return;
}
if( str[0] != '"' ) {
value = WdeLookupName( table, str, &found );
if( found ) {
WdeSetEditWithSINT32( (int_32) value, 10, hDlg, IDB_HELPID );
}
}
WdeMemFree( str );
}
void WdeMapWindowRect ( HWND src, HWND dest, RECT *rect )
{
MapWindowPoints ( src, dest, (POINT *) rect, 2);
}
void WdeEXSetDefineInfo ( WdeDefineObjectInfo *o_info, HWND hDlg )
{
DialogStyle mask;
_wde_touch(o_info);
mask = 0;
#if __NT__XX
// do the extended style stuff
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_CLIENTEDGE), TRUE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_STATICEDGE), TRUE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_NOPARENTNOTIFY), TRUE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_LEFT), TRUE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_RIGHT), TRUE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_LTRREADING), TRUE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_RTLREADING), TRUE);
mask = GETCTL_EXSTYLE( o_info->info.c.info );
if ( mask & WS_EX_CLIENTEDGE ) {
CheckDlgButton ( hDlg, IDB_WS_EX_CLIENTEDGE, 1);
}
if ( mask & WS_EX_STATICEDGE ) {
CheckDlgButton ( hDlg, IDB_WS_EX_STATICEDGE, 1);
}
if ( mask & WS_EX_NOPARENTNOTIFY ) {
CheckDlgButton ( hDlg, IDB_WS_EX_NOPARENTNOTIFY, 1);
}
if ( mask & WS_EX_RIGHT ) {
CheckDlgButton ( hDlg, IDB_WS_EX_RIGHT, 1);
} else{
CheckDlgButton ( hDlg, IDB_WS_EX_LEFT, 1);
}
if ( mask & WS_EX_RTLREADING ) {
CheckDlgButton ( hDlg, IDB_WS_EX_RTLREADING, 1);
} else{
CheckDlgButton ( hDlg, IDB_WS_EX_LTRREADING, 1);
}
#else
// disable the extended styles
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_CLIENTEDGE), FALSE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_STATICEDGE), FALSE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_NOPARENTNOTIFY), FALSE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_LEFT), FALSE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_RIGHT), FALSE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_LTRREADING), FALSE);
EnableWindow ( GetDlgItem(hDlg, IDB_WS_EX_RTLREADING), FALSE);
#endif
}
void WdeEXGetDefineInfo ( WdeDefineObjectInfo *o_info, HWND hDlg )
{
#if __NT__XX
DialogStyle mask;
// set the extended mask
mask = 0;
if ( IsDlgButtonChecked ( hDlg, IDB_WS_EX_STATICEDGE ) ) {
mask |= WS_EX_STATICEDGE;
}
if ( IsDlgButtonChecked ( hDlg, IDB_WS_EX_CLIENTEDGE ) ) {
mask |= WS_EX_CLIENTEDGE;
}
if ( IsDlgButtonChecked ( hDlg, IDB_WS_EX_NOPARENTNOTIFY ) ) {
mask |= WS_EX_NOPARENTNOTIFY;
}
if ( IsDlgButtonChecked ( hDlg, IDB_WS_EX_RIGHT ) ) {
mask |= WS_EX_RIGHT;
}
if ( IsDlgButtonChecked ( hDlg, IDB_WS_EX_RTLREADING ) ) {
mask |= WS_EX_RTLREADING;
}
SETCTL_EXSTYLE( o_info->info.c.info, mask );
#else
_wde_touch(o_info);
_wde_touch(hDlg);
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -