bool WdeDisplayOptions( void ) { HWND dialog_owner; DLGPROC dlgproc; HINSTANCE app_inst; INT_PTR modified; WdeSetStatusText( NULL, " ", false ); WdeSetStatusByID( WDE_DISPLAYOPTIONS, 0 ); dialog_owner = WdeGetMainWindowHandle(); app_inst = WdeGetAppInstance(); dlgproc = MakeProcInstance_DLG( WdeOptionsDlgProc, app_inst ); modified = JDialogBoxParam( app_inst, "WdeOptions", dialog_owner, dlgproc, (LPARAM)NULL ); FreeProcInstance_DLG( dlgproc ); if( modified == -1 ) { WdeWriteTrail( "WdeDisplayOptions: Dialog not created!" ); return( FALSE ); } WdeSetStatusReadyText(); return( TRUE ); }
bool WdeHandleTestModeMenu( WdeResInfo *info ) { HWND main_window; bool ret; if( info == NULL ) { return( FALSE ); } main_window = WdeGetMainWindowHandle(); if( WdeTestMode ) { WdeTestMode = FALSE; if( WdeTestDialogHandle != NULL ) { DestroyWindow( WdeTestDialogHandle ); } WdeSetTestModeMenu( FALSE ); WdeSetStatusReadyText(); WdeShowResourceWindows( SW_SHOWNA ); if( WdeTestResource != NULL ) { //InitState( WdeTestResource->forms_win ); //SendMessage( WdeTestResource->res_win, WM_MDIRESTORE, 0, 0 ); WdeTestResource = NULL; } ret = TRUE; } else { WdeSetStatusText( NULL, "", FALSE ); WdeSetStatusByID( WDE_TESTMODE, -1 ); ret = WdeTestCurrentObject(); if( ret ) { WdeShowResourceWindows( SW_HIDE ); WdeSetTestModeMenu( TRUE ); WdeTestMode = TRUE; WdeTestResource = info; } else { WdeSetStatusReadyText(); } } return( ret ); }
Bool WdeCreateStatusLine( HWND main, HINSTANCE inst ) { RECT rect; LOGFONT lf; TEXTMETRIC tm; HFONT old_font; HDC dc; status_block_desc sbd; char *status_font; char *cp; int point_size; Bool use_default; memset( &lf, 0, sizeof( LOGFONT ) ); dc = GetDC( main ); lf.lfWeight = FW_BOLD; use_default = TRUE; status_font = WdeAllocRCString( WDE_STATUSFONT ); if( status_font != NULL ) { cp = (char *)_mbschr( (unsigned char *)status_font, '.' ); if( cp != NULL ) { *cp = '\0'; strcpy( lf.lfFaceName, status_font ); cp++; point_size = atoi( cp ); use_default = FALSE; } WdeFreeRCString( status_font ); } if( use_default ) { strcpy( lf.lfFaceName, STATUS_FONTNAME ); point_size = STATUS_POINTSIZE; } lf.lfHeight = -MulDiv( point_size, GetDeviceCaps( dc, LOGPIXELSY ), 72 ); WdeStatusFont = CreateFontIndirect( &lf ); old_font = SelectObject( dc, WdeStatusFont ); GetTextMetrics( dc, &tm ); SelectObject( dc, old_font ); ReleaseDC( main, dc ); GetClientRect( main, &rect ); WdeStatusDepth = tm.tmHeight + STATUS_LINE_PAD + VERT_BORDER * 2; rect.top = rect.bottom - WdeStatusDepth; if( !StatusWndInit( inst, WdeStatusHookProc, 0, (HCURSOR)NULL ) ) { return( FALSE ); } WdeStatusBar = StatusWndStart(); sbd.separator_width = STATUS_LINE_PAD; sbd.width = STATUS1_WIDTH; sbd.width_is_percent = FALSE; sbd.width_is_pixels = TRUE; StatusWndSetSeparators( WdeStatusBar, 1, &sbd ); WdeStatusWindow = StatusWndCreate( WdeStatusBar, main, &rect, inst, NULL ); if( WdeStatusWindow == NULL ) { WdeDisplayErrorMsg( WDE_NOCREATESTATUS ); return( FALSE ); } /* set the text in the status window */ WdeSetStatusReadyText(); GetWindowRect( WdeStatusWindow, &rect ); WdeStatusDepth = rect.bottom - rect.top; return( TRUE ); }
bool WdeCreateControlsToolBar( void ) { RECT t, r, screen; HWND parent; int id; char *text; if( WdeControls != NULL ) { return ( true ); } WdeSetStatusText( NULL, "", false ); WdeSetStatusByID( WDE_CREATINGTOOLBOX, 0 ); parent = WdeGetMainWindowHandle(); WdeGetCntlTBarPosOption( &t ); if( t.left == t.right && t.top == t.bottom ) { GetWindowRect( parent, &r ); #ifdef __NT__ if( GetModuleHandle( "COMCTL32.DLL" ) == NULL ) { #endif t.left = r.right - CONTROLS_DEFX; t.top = r.top + CONTROLS_INSET; t.right = r.right; t.bottom = t.top + CONTROLS_DEFY; #ifdef __NT__ } else { t.left = r.right - CONTROLS_DEFXCC; t.top = r.top + CONTROLS_INSET; t.right = r.right; t.bottom = t.top + CONTROLS_DEFYCC; } #endif } GetWindowRect( GetDesktopWindow(), &screen ); if( !IntersectRect( &r, &screen, &t ) ) { r.right = t.right - t.left; r.bottom = t.bottom - t.top; r.left = 0; if( screen.right > r.right ) r.left = ( screen.right - r.right ) / 2; r.top = 0; if( screen.bottom - screen.top - r.bottom > 0 ) r.top = ( screen.bottom - screen.top - r.bottom ) / 2; r.right += r.left; r.bottom += r.top; t = r; } WdeControlsInfo->dinfo.area = t; WdeControls = WdeCreateToolBar( WdeControlsInfo, parent ); if( WdeControls == NULL ) { return( false ); } text = WdeAllocRCString( WDE_TOOLBOXCAPTION ); SendMessage( WdeControls->win, WM_SETTEXT, 0, (LPARAM)(LPCSTR)text ); if( text != NULL ) { WdeFreeRCString( text ); } text = WdeAllocRCString( WDE_HIDETOOLBOX ); ModifyMenu ( WdeGetInitialMenuHandle(), IDM_SHOW_TOOLS, MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text ); ModifyMenu ( WdeGetResMenuHandle(), IDM_SHOW_TOOLS, MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text ); if( text != NULL ) { WdeFreeRCString( text ); } if( WdeGetNumRes() ) { id = WdeGetMenuFromOBJID( GetBaseObjType() ); if( id != -1 ) { WdeSetToolBarItemState( WdeControls, id, BUTTON_DOWN ); } WdeSetStickyMode( WdeStickyMode ); } WdeSetStatusReadyText(); return( true ); }