Bool WCreateEditWindow( HINSTANCE inst, WMenuEditInfo *einfo ) { int x, y, width, height; char *title; HMENU hmenu; HMENU menu; Bool is_rc; RECT rect; if( einfo == NULL ) { return( FALSE ); } x = CW_USEDEFAULT; y = CW_USEDEFAULT; width = appWidth; height = appHeight; if( einfo->info->stand_alone ) { WGetScreenPosOption( &rect ); if( !IsRectEmpty( &rect ) ) { x = rect.left; y = rect.top; width = max( appWidth, rect.right - rect.left ); height = max( appHeight, rect.bottom - rect.top ); } } is_rc = FALSE; title = WCreateEditTitle( einfo ); if( title == NULL ) { title = WAllocRCString( W_MENUAPPTITLE ); is_rc = TRUE; } menu = (HMENU)NULL; if( einfo->info->stand_alone ) { menu = LoadMenu( inst, WMainSOMenuName ); } einfo->win = CreateWindow( WMainClass, title, WS_OVERLAPPEDWINDOW, x, y, width, height, einfo->info->parent, menu, inst, einfo ); if( title != NULL ) { if( is_rc ) { WFreeRCString( title ); } else { WMemFree( title ); } } if( einfo->win == (HWND)NULL ) { return( FALSE ); } if( !WCreateRibbon( einfo ) ) { return( FALSE ); } einfo->wsb = WCreateStatusLine( einfo->win, inst ); if( einfo->wsb == NULL ) { return( FALSE ); } einfo->insert_subitems = FALSE; einfo->insert_before = FALSE; einfo->first_preview_id = FIRST_PREVIEW_ID; hmenu = GetMenu( einfo->win ); if( hmenu != (HMENU)NULL ) { EnableMenuItem( hmenu, IDM_MENU_CUT, MF_GRAYED ); EnableMenuItem( hmenu, IDM_MENU_COPY, MF_GRAYED ); } CheckMenuItem( hmenu, IDM_MENU_INSERTSUBITEMS, MF_UNCHECKED ); CheckMenuItem( hmenu, IDM_MENU_INSERTAFTER, MF_CHECKED ); if( !WCreateMenuEditWindow( einfo, inst ) ) { return( FALSE ); } if( WGetOption( WOptScreenMax ) ) { ShowWindow( einfo->win, SW_SHOWMAXIMIZED ); } else { ShowWindow( einfo->win, SW_SHOWNORMAL ); } UpdateWindow( einfo->win ); WResizeWindows( einfo ); SetFocus( einfo->edit_dlg ); return( TRUE ); }
bool WCreateEditWindow( HINSTANCE inst, WAccelEditInfo *einfo ) { int x, y, width, height; char *title; HMENU hmenu; HMENU menu; bool is_rc; RECT rect; if( einfo == NULL ) { return( FALSE ); } x = CW_USEDEFAULT; y = CW_USEDEFAULT; width = appWidth; height = appHeight; if( einfo->info->stand_alone ) { WGetScreenPosOption( &rect ); if( !IsRectEmpty( &rect ) ) { x = rect.left; y = rect.top; width = appWidth; if( width < rect.right - rect.left ) width = rect.right - rect.left; height = appHeight; if( height < rect.bottom - rect.top ) { height = rect.bottom - rect.top; } } } is_rc = FALSE; title = WCreateEditTitle( einfo ); if( title == NULL ) { title = AllocRCString( W_ACCELAPPTITLE ); is_rc = TRUE; } menu = (HMENU)NULL; if( einfo->info->stand_alone ) { menu = LoadMenu( inst, WMainSOMenuName ); } einfo->win = CreateWindow( WMainClass, title, WS_OVERLAPPEDWINDOW, x, y, width, height, einfo->info->parent, menu, inst, einfo ); if( title != NULL ) { if( is_rc ) { FreeRCString( title ); } else { WRMemFree( title ); } } if( einfo->win == (HWND)NULL ) { return( FALSE ); } if( !WCreateRibbon( einfo ) ) { return( FALSE ); } einfo->wsb = WCreateStatusLine( einfo->win, inst ); if( einfo->wsb == NULL ) { return( FALSE ); } if( !WCreateAccelEditWindow( einfo, inst ) ) { return( FALSE ); } hmenu = GetMenu( einfo->win ); if( hmenu != (HMENU)NULL ) { EnableMenuItem( hmenu, IDM_ACC_CUT, MF_GRAYED ); EnableMenuItem( hmenu, IDM_ACC_COPY, MF_GRAYED ); } if( WGetOption( WOptScreenMax ) ) { ShowWindow( einfo->win, SW_SHOWMAXIMIZED ); } else { ShowWindow( einfo->win, SW_SHOWNORMAL ); } UpdateWindow( einfo->win ); WResizeWindows( einfo ); SetFocus( einfo->edit_dlg ); return( TRUE ); }