INT_PTR CALLBACK WdeOptionsDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { bool ret; /* touch unused vars to get rid of warning */ _wde_touch( lParam ); ret = false; switch( message ) { case WM_SYSCOLORCHANGE: WdeCtl3dColorChange(); break; case WM_INITDIALOG: WdeOptWin = hDlg; WdeSetOptInfo( hDlg, &WdeCurrentState ); ret = true; break; case WM_DESTROY: WdeOptWin = NULL; break; case WM_COMMAND: switch( LOWORD( wParam ) ) { case IDB_HELP: WdeHelpRoutine(); break; case IDOK: WdeGetOptInfo( hDlg ); EndDialog( hDlg, TRUE ); ret = true; break; case IDCANCEL: EndDialog( hDlg, FALSE ); ret = true; break; #if 0 case IDB_OPT_SETDEFS: WdeSetOptInfo( hDlg, &WdeDefaultState ); break; #endif } } return( ret ); }
WINEXPORT LRESULT CALLBACK WdeMainWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { HMENU menu; LRESULT ret; bool pass_to_def; WdeResInfo *res_info; WORD wp; about_info ai; if( WdeCleanupStarted ) { if( message == WM_DESTROY ) { PostQuitMessage( 0 ); } return( DefFrameProc( hWnd, hWinWdeMDIClient, message, wParam, lParam ) ); } pass_to_def = TRUE; ret = FALSE; res_info = WdeGetCurrentRes(); menu = WdeGetMenuHandle(); switch( message ) { case WM_INITMENU: handleInitMenu( menu ); break; case WM_USER: WdeSetStatusByID( -1, WDE_ONLYONEINSTANCE ); break; case WM_MENUSELECT: WdeHandleMenuSelect( wParam, lParam ); break; case WM_MEASUREITEM: WdeHandleMeasureItem( (MEASUREITEMSTRUCT *)lParam ); ret = TRUE; pass_to_def = FALSE; break; case WM_DRAWITEM: WdeHandleDrawItem( (DRAWITEMSTRUCT *)lParam ); ret = TRUE; pass_to_def = FALSE; break; case WM_MOVE: if( IsZoomed( hWnd ) ) { WdeSetOption( WdeOptIsScreenMax, TRUE ); } else if( !IsIconic( hWnd ) ) { WdeUpdateScreenPosOpt(); WdeSetOption( WdeOptIsScreenMax, FALSE ); } break; case WM_SIZE: if( wParam == SIZE_MAXIMIZED ) { WdeSetOption( WdeOptIsScreenMax, TRUE ); } else if( wParam != SIZE_MINIMIZED ) { WdeUpdateScreenPosOpt(); WdeSetOption( WdeOptIsScreenMax, FALSE ); } if( wParam != SIZE_MINIMIZED ) { WdeResizeWindows(); } pass_to_def = FALSE; break; case WM_COMMAND: wp = LOWORD( wParam ); if( !WdeIsMenuIDValid( menu, wp ) ) { break; } switch( wp ) { case IDM_SELECT_MODE: case IDM_DIALOG_TOOL: case IDM_PBUTTON_TOOL: case IDM_CBUTTON_TOOL: case IDM_RBUTTON_TOOL: case IDM_GBUTTON_TOOL: case IDM_FRAME_TOOL: case IDM_TEXT_TOOL: case IDM_ICON_TOOL: case IDM_EDIT_TOOL: case IDM_LISTBOX_TOOL: case IDM_COMBOBOX_TOOL: case IDM_HSCROLL_TOOL: case IDM_VSCROLL_TOOL: case IDM_SIZEBOX_TOOL: case IDM_STATUSBAR_TOOL: case IDM_LISTVIEW_TOOL: case IDM_TREEVIEW_TOOL: case IDM_TABCNTL_TOOL: case IDM_ANIMATE_TOOL: case IDM_UPDOWN_TOOL: case IDM_TRACKBAR_TOOL: case IDM_PROGRESS_TOOL: case IDM_HOTKEY_TOOL: case IDM_HEADER_TOOL: case IDM_CUSTOM1_TOOL: case IDM_CUSTOM2_TOOL: WdeSetBaseObject( wp ); pass_to_def = FALSE; break; case IDM_STICKY_TOOLS: WdeToggleStickyTools(); pass_to_def = FALSE; break; case IDM_FMLEFT: case IDM_FMRIGHT: case IDM_FMTOP: case IDM_FMBOTTOM: case IDM_FMVCENTRE: case IDM_FMHCENTRE: case IDM_ESCAPE: case IDM_DELETEOBJECT: case IDM_SPACE_HORZ: case IDM_SPACE_VERT: ret = WdePassToEdit( message, wParam, lParam ); pass_to_def = FALSE; break; case IDM_SELECT_DIALOG: WdeSelectDialog( res_info ); pass_to_def = FALSE; break; case IDM_OPTIONS: WdeDisplayOptions (); pass_to_def = FALSE; break; case IDM_NEW_RES: WdeCreateNewResource( NULL ); pass_to_def = FALSE; break; case IDM_DDE_CLEAR: WdeClearCurrentResource(); pass_to_def = FALSE; break; case IDM_OPEN_RES: WdeOpenResource( NULL ); pass_to_def = FALSE; break; case IDM_SAVE_RES: WdeSaveResource( res_info, FALSE ); pass_to_def = FALSE; break; case IDM_SAVEAS_RES: WdeSaveResource( res_info, TRUE ); pass_to_def = FALSE; break; case IDM_DDE_UPDATE_PRJ: WdeUpdateDDEEditSession(); break; case IDM_PASTEOBJECT: if( FMPasteValid() ) { ret = WdePassToEdit( message, wParam, lParam ); } pass_to_def = FALSE; break; case IDM_CUTOBJECT: case IDM_COPYOBJECT: ret = WdePassToEdit( message, wParam, lParam ); pass_to_def = FALSE; break; case IDM_SAME_WIDTH: WdeSameSize( R_RIGHT ); pass_to_def = FALSE; break; case IDM_SAME_HEIGHT: WdeSameSize( R_BOTTOM ); pass_to_def = FALSE; break; case IDM_SAME_SIZE: WdeSameSize( R_BOTTOM | R_RIGHT ); pass_to_def = FALSE; break; case IDM_SIZETOTEXT: WdeHandleSizeToText(); pass_to_def = FALSE; break; case IDM_GOTO_INFOBAR: WdeSetFocusToInfo(); pass_to_def = FALSE; break; case IDM_GOTO_OBJECT: WdeHandleGotoCurrentObject(); pass_to_def = FALSE; break; case IDM_DIALOG_RESTORE: WdeRestoreCurrentDialog(); pass_to_def = FALSE; break; case IDM_TAB: case IDM_STAB: WdeHandleTabEvent( wp == IDM_TAB ); pass_to_def = FALSE; break; #if 0 /* this strategy has been rejected in favor of the hide option */ case IDM_REMOVE_DIALOG: WdeRemoveDialog( res_info ); pass_to_def = FALSE; break; #endif case IDM_HIDE_DIALOG: WdeHideCurrentDialog(); pass_to_def = FALSE; break; case IDM_TEST_MODE: WdeHandleTestModeMenu( res_info ); pass_to_def = FALSE; break; case IDM_DIALOG_NEW: if( WdeCreateNewDialog( NULL, res_info->is32bit ) ) { WdeHandleGotoCurrentObject(); } pass_to_def = FALSE; break; case IDM_DIALOG_SAVE: case IDM_DIALOG_SAVEAS: case IDM_DIALOG_SAVEINTO: WdeSaveCurrentDialog( wp ); pass_to_def = FALSE; break; case IDM_SET_ORDER: case IDM_SET_TABS: case IDM_SET_GROUPS: WdeSetDialogMode( wp ); pass_to_def = FALSE; break; case IDM_DEFINEOBJECT: case IDM_GEN_DEFINEOBJECT: if( !WdeDefineCurrentObject( wp ) ) { WdeWriteTrail( "WdeResWndProc: Define failed!" ); } pass_to_def = FALSE; break; case IDM_MDI_CASCADE: case IDM_MDI_TILEV: case IDM_MDI_TILEH: case IDM_MDI_ARRANGE: WdeHandleMDIArrangeEvents( wp ); pass_to_def = FALSE; break; case IDM_EXIT: /* clean up before we exit */ PostMessage( hWinWdeMain, WM_CLOSE, 0, 0 ); break; case IDM_SELCUST1: case IDM_SELCUST2: if( !WdeSetCurrentCustControl( wp - IDM_SELCUST1 ) ) { WdeWriteTrail( "WdeMainWndProc: WdeSetCurrentCustControl failed!" ); WdeSetStatusByID( -1, WDE_SETFAILED ); } pass_to_def = FALSE; break; case IDM_MS_CUSTOM: WdeLoadCustomLib( TRUE, FALSE ); pass_to_def = FALSE; break; #ifndef __NT__ case IDM_BOR_CUSTOM: WdeLoadCustomLib( FALSE, FALSE ); pass_to_def = FALSE; break; #endif case IDM_LOADLIB: WdeLoadCustomLib( FALSE, TRUE ); pass_to_def = FALSE; break; case IDM_WRITE_SYMBOLS: WdeResourceHashTableAction( res_info, WRITE_HASH ); pass_to_def = FALSE; break; case IDM_LOAD_SYMBOLS: WdeResourceHashTableAction( res_info, LOAD_HASH ); pass_to_def = FALSE; break; case IDM_VIEW_SYMBOLS: WdeResourceHashTableAction( res_info, VIEW_HASH ); pass_to_def = FALSE; break; case IDM_SHOW_TOOLS: WdeHandleShowToolsMenu(); pass_to_def = FALSE; break; case IDM_SHOW_RIBBON: WdeShowRibbon(); pass_to_def = FALSE; break; case IDM_HELP: WdeHelpRoutine(); pass_to_def = FALSE; break; case IDM_HELP_SEARCH: WdeHelpSearchRoutine(); pass_to_def = FALSE; break; case IDM_HELP_ON_HELP: WdeHelpOnHelpRoutine(); pass_to_def = FALSE; break; case IDM_ABOUT: ai.owner = hWnd; ai.inst = hInstWde; ai.name = AllocRCString( WDE_ABOUT_NAME ); ai.version = AllocRCString( WDE_ABOUT_VERSION ); ai.first_cr_year = "1984"; ai.title = AllocRCString( WDE_ABOUT_TITLE ); DoAbout( &ai ); FreeRCString( ai.name ); FreeRCString( ai.version ); FreeRCString( ai.title ); pass_to_def = FALSE; break; } break; case WM_DESTROY: WWinHelp( hWinWdeMain, "resdlg.hlp", HELP_QUIT, 0 ); PostQuitMessage( 0 ); break; case WDE_FATAL_EXIT: WdeFatalExit = TRUE; WdeQueryKillApp( TRUE ); PostMessage( hWinWdeMain, WM_CLOSE, 0, 0 ); break; case WM_ENDSESSION: if ( !wParam ) { WdeFatalExit = FALSE; } break; case WM_QUERYENDSESSION: ret = WdeQueryKillApp( FALSE ); if( ret ) { WdeFatalExit = TRUE; pass_to_def = FALSE; } break; case WM_CLOSE: // this prevents the user from closing the editor during // DDE initialization if( !wParam && !EnableMenuInput ) { return( 0 ); } /* clean up before we exit */ WdeCleanupStarted = TRUE; if( wParam ) { // wParam is non-zero if the DDE connection died WdeFatalExit = TRUE; WdeQueryKillApp( TRUE ); wParam = 0; } if( !WdeCleanup( res_info, WdeFatalExit ) ) { WdeCleanupStarted = FALSE; pass_to_def = FALSE; } } if( pass_to_def ) { ret = DefFrameProc( hWnd, hWinWdeMDIClient, message, wParam, lParam ); } return( ret ); }