bool WdeCleanup( WdeResInfo *res_info, bool fatal_exit ) { /* clean up before we exit */ if( WdeGetTestMode() ) { WdeHandleTestModeMenu( res_info ); } // must be done before FMEDIT is shutdown if( FMPasteValid() ) { FMResetClipboard(); } WdeSetOption( WdeOptIsCntlsTBarVisible, WdeControlsToolBarExists() ); if( WdeQueryKillApp( fatal_exit ) ) { WdeFreeResList(); } else { return( FALSE ); } WdeFiniHints(); WdeFreeAllCustLibs(); #ifndef __NT__ WdeFreeCustRESProcs(); #endif WdeShutdownToolBars(); WdeSetOption( WdeOptIsScreenMax, IsZoomed( hWinWdeMain ) ); WdeOptsShutdown(); WdeFreeControlIDs(); WdeSetAppMenuToRes( FALSE ); DestroyMenu( WdeResMenu ); DestroyMenu( WdeDDEMenu ); WdeFiniToolMenu(); WdeShutdownControls(); WdeDestroyRibbon(); WdeShutdownRibbon(); WdeFiniCreateTable(); WdeFiniOrderStuff(); /* get rid of all the child windows of the main application window */ WdeDestroyInfoWindow(); WdeInfoFini(); WdeDestroyStatusLine(); WdeFiniEditClass(); WdeFiniResStrings(); WdeFreeFontList(); WdeCtl3DFini( hInstWde ); WdeFreeFileFilter(); JDialogFini(); return( TRUE ); }
bool WdeIsMenuIDValid( HMENU menu, WORD id ) { UINT st; if( !EnableMenuInput ) { return( FALSE ); } if( WdeGetTestMode() ) { if( id != IDM_TEST_MODE ) { return( FALSE ); } } switch( id ) { case IDM_TAB: case IDM_STAB: case IDM_ESCAPE: case IDM_GOTO_INFOBAR: return( TRUE ); } if( menu == (HMENU)NULL ) { menu = WdeGetMenuHandle(); } handleInitMenu( menu ); st = GetMenuState( menu, id, MF_BYCOMMAND ); if( st == -1 || (st & MF_GRAYED) == MF_GRAYED ) { return( FALSE ); } return( TRUE ); }
static bool wdeControlsHook( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { MINMAXINFO *minmax; WdeToolBar *tbar; OBJ_ID obj_id; WORD id; char *text; OBJPTR obj; WdeOrderMode mode; ctl_id cid; bool ignore_msg; bool ret; ignore_msg = FALSE; if( WdeGetNumRes() && !WdeInCleanup() ) { obj = WdeGetCurrentDialog(); if( obj != NULL && Forward( obj, GET_ORDER_MODE, &mode, NULL ) && mode != WdeSelect ) { ignore_msg = TRUE; } } if( !ignore_msg && WdeGetTestMode() ) { ignore_msg = TRUE; } if( ignore_msg ) { switch( msg ) { case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: case WM_RBUTTONUP: case WM_LBUTTONUP: return( true ); } } if( (tbar = WdeControls) == NULL ) { if( msg == WM_GETMINMAXINFO ) { minmax = (MINMAXINFO *)lParam; minmax->ptMinTrackSize.x = 8; } return( false ); } ret = false; switch( msg ) { case WM_USER: if( WdeGetNumRes() ) { obj_id = GetBaseObjType(); id = WdeGetMenuFromOBJID( obj_id ); if( id == wParam || (wParam == IDM_STICKY_TOOLS && WdeStickyMode) ) { lParam = !lParam; } WdeHandleStickyToolPress( tbar, wParam, lParam ); } break; case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: if( FindToolIDAtPoint( tbar->tbar, wParam, lParam, &cid ) ) { if( cid == IDM_CUSTOM1_TOOL ) { ret = !WdeIsCurrentCustControlSet( 0 ); } else if( cid == IDM_CUSTOM2_TOOL ) { ret = !WdeIsCurrentCustControlSet( 1 ); } } break; case WM_SIZE: if ( wParam != SIZE_MAXIMIZED && wParam != SIZE_MINIMIZED ) { GetWindowRect( hwnd, &tbar->last_pos ); } break; case WM_MOVE: if( !IsZoomed( hwnd ) ) { GetWindowRect( hwnd, &tbar->last_pos ); } break; case WM_GETMINMAXINFO: if( GetModuleHandle( "COMCTL32.DLL" ) == NULL ) { minmax = (MINMAXINFO *)lParam; minmax->ptMinTrackSize.x = 2 * GetSystemMetrics( SM_CXFRAME ) + tbar->info->dinfo.border_size.x + tbar->info->dinfo.button_size.x - 1; minmax->ptMinTrackSize.y = 2 * GetSystemMetrics( SM_CYFRAME ) + GetSystemMetrics(SM_CYCAPTION) + tbar->info->dinfo.border_size.y + tbar->info->dinfo.button_size.y - 1; ret = true; } break; case WM_CLOSE: WdeDestroyControls(); WdeSetOption ( WdeOptIsCntlsTBarVisible, FALSE ); ret = true; break; case WM_DESTROY: WdeControls = NULL; WdeSetCntlTBarPosOption( &tbar->last_pos ); text = WdeAllocRCString( WDE_SHOWTOOLBOX ); ModifyMenu( WdeGetResMenuHandle(), IDM_SHOW_TOOLS, MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text ); ModifyMenu( WdeGetInitialMenuHandle(), IDM_SHOW_TOOLS, MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text ); if( text != NULL ) { WdeFreeRCString( text ); } WdeCloseToolBar( tbar ); break; } return( ret ); }