/* * RePositionViewWnd - reposition the size of the window (for when a * different icon is selected) */ void RePositionViewWnd( img_node *node ) { WPI_RECT location; int h_adj; int v_adj; WPI_RECTDIM left; WPI_RECTDIM top; WPI_RECTDIM right; WPI_RECTDIM bottom; HWND frame; frame = _wpi_getframe( node->viewhwnd ); _wpi_getwindowrect( frame, &location ); h_adj = 2 * _wpi_getsystemmetrics( SM_CXDLGFRAME ) + 2 * BORDER_WIDTH; v_adj = 2 * _wpi_getsystemmetrics( SM_CYDLGFRAME ) + #ifndef __NT__ _wpi_getsystemmetrics( SM_CYCAPTION ) + 2 * BORDER_WIDTH - 1; #else _wpi_getsystemmetrics( SM_CYSMCAPTION ) + 2 * BORDER_WIDTH - 1; #endif _wpi_getrectvalues( location, &left, &top, &right, &bottom ); #ifdef __OS2_PM__ SetWindowPos( frame, NULL, left, bottom, h_adj + node->width, v_adj + node->height, SWP_SIZE | SWP_MOVE | SWP_NOZORDER | SWP_HIDEWINDOW ); #else SetWindowPos( node->viewhwnd, NULL, left, top, h_adj + node->width, v_adj + node->height, SWP_SIZE | SWP_MOVE | SWP_NOZORDER | SWP_HIDEWINDOW ); #endif hViewWindow = node->viewhwnd; ShowWindow( frame, showState ); SetFocus( HMainWindow ); InvalidateRect( hViewWindow, NULL, TRUE ); } /* RePositionViewWnd */
/* * ViewWindowProc - window procedure for the view window */ WPI_MRESULT CALLBACK ViewWindowProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam ) { static HMENU sysmenu; static HWND hframe; HMENU hmenu; WPI_RECT rcview; WPI_RECTDIM left; WPI_RECTDIM top; WPI_RECTDIM right; WPI_RECTDIM bottom; switch ( msg ) { case WM_CREATE: hframe = _wpi_getframe( hwnd ); sysmenu = _wpi_getcurrentsysmenu( hframe ); _wpi_deletemenu( sysmenu, SC_RESTORE, FALSE ); _wpi_deletemenu( sysmenu, SC_SIZE, FALSE ); _wpi_deletemenu( sysmenu, SC_MINIMIZE, FALSE ); _wpi_deletemenu( sysmenu, SC_MAXIMIZE, FALSE ); _wpi_deletemenu( sysmenu, SC_TASKLIST, FALSE ); #ifdef __OS2_PM__ _wpi_deletemenu( sysmenu, SC_HIDE, FALSE ); #endif _wpi_deletesysmenupos( sysmenu, 1 ); _wpi_deletesysmenupos( sysmenu, 2 ); break; case WM_PAINT: redrawViewWnd( hwnd ); return( 0 ); case WM_MOVE: _wpi_getwindowrect( _wpi_getframe( hwnd ), &rcview ); _wpi_getrectvalues( rcview, &left, &top, &right, &bottom ); ImgedConfigInfo.view_xpos = (short)left; ImgedConfigInfo.view_ypos = (short)top; break; case WM_CLOSE: hmenu = GetMenu( _wpi_getframe( HMainWindow ) ); if( fOneViewWindow ) { CheckViewItem( hmenu ); } else { PrintHintTextByID( WIE_USEOPTIONSTOHIDEALL, NULL ); } break; case WM_DESTROY: hViewWindow = NULL; break; default: return( DefWindowProc( hwnd, msg, wparam, lparam ) ); } return( 0 ); } /* ViewWindowProc */
/* * ResetViewWindow - when a new MDI child is activated, reset the position * of the view window * - first check if only 1 view window is being shown, or all of them */ void ResetViewWindow( HWND hwnd ) { WPI_RECT currentloc; WPI_RECT newloc; WPI_RECTDIM left; WPI_RECTDIM top; WPI_RECTDIM right; WPI_RECTDIM bottom; HWND hframe; HWND currentframe; hframe = _wpi_getframe( hwnd ); if( hViewWindow != NULL ) { currentframe = _wpi_getframe( hViewWindow ); } else { currentframe = NULL; } if( fOneViewWindow ) { _wpi_getwindowrect( hframe, &newloc ); if( hViewWindow != NULL ) { _wpi_getwindowrect( currentframe, ¤tloc ); ShowWindow( currentframe, SW_HIDE ); } else { currentloc = newloc; } _wpi_getrectvalues( currentloc, &left, &top, &right, &bottom ); SetWindowPos( hframe, NULL, left, top, _wpi_getwidthrect( newloc ), _wpi_getheightrect( newloc ), SWP_MOVE | SWP_SIZE | SWP_NOZORDER | SWP_HIDEWINDOW ); hViewWindow = hwnd; ShowWindow( hframe, showState ); } else { hViewWindow = hwnd; ShowWindow( hframe, showState ); _wpi_bringwindowtotop( hframe ); } #ifndef __OS2_PM__ RedrawWindow( hwnd, NULL, NULL, RDW_UPDATENOW ); #endif } /* ResetViewWindow */
void GUIResizeBackground( gui_window *wnd, bool force_msg ) { WPI_RECT status; int t_height, s_height; GUI_RECTDIM left, top, right, bottom; gui_coord size; if( wnd->root == NULLHANDLE ) { if( wnd->hwnd != NULLHANDLE ) { _wpi_getclientrect( wnd->hwnd, &wnd->hwnd_client ); } return; } t_height = 0; s_height = 0; if( ( wnd->toolbar != NULL ) && ( wnd->toolbar->info.is_fixed ) ) { t_height = _wpi_getheightrect( wnd->toolbar->fixedrect ); } if( wnd->status != NULLHANDLE ) { _wpi_getwindowrect( wnd->status, &status ); s_height = _wpi_getheightrect( status ); } _wpi_getclientrect( wnd->root_frame, &wnd->root_client ); _wpi_getrectvalues( wnd->root_client, &left, &top, &right, &bottom ); bottom -= top; right -= left; top = left = 0; #ifdef __OS2_PM__ top += s_height; bottom -= t_height; #else top += t_height; bottom -= s_height; #endif /* if the root client is a separate window resize it too */ _wpi_movewindow( wnd->hwnd, left, top, right - left, bottom - top, TRUE ); _wpi_getclientrect( wnd->hwnd, &wnd->hwnd_client ); if( force_msg && ( wnd->flags & SENT_INIT ) ) { size.x = right - left; size.y = bottom - top; GUIScreenToScaleR( &size ); GUIEVENTWND( wnd, GUI_RESIZE, &size ); } }
static void ResizeStatus( gui_window *wnd ) { WPI_RECT status; GUI_RECTDIM left, top, right, bottom; if( GUIHasStatus( wnd ) ) { _wpi_getwindowrect( wnd->status, &status ); _wpi_mapwindowpoints( HWND_DESKTOP, wnd->root, (WPI_LPPOINT)&status, 2 ); _wpi_getrectvalues( status, &left, &top, &right, &bottom ); /* maintain height and left position of status window -- tie the rest to the client are of the parent */ SetStatusRect( wnd->root, &status, left, bottom - top ); _wpi_getrectvalues( status, &left, &top, &right, &bottom ); _wpi_movewindow( wnd->status, left, top, right - left, bottom - top, TRUE ); } }
/* * GetPosProc - get the position of all the child windows */ BOOL CALLBACK GetPosProc( HWND hwnd, LONG lparam ) { WPI_RECT windowrect; WPI_POINT topleft; // this ends up being bottom left for PM WPI_RECTDIM left; WPI_RECTDIM top; lparam = lparam; #ifdef __OS2_PM__ if( windowIndex >= imageMax ) { return( 0 ); } #endif if( _wpi_getowner( hwnd ) != NULL ) { return( 1 ); } if( _wpi_isiconic( hwnd ) ) { windowCoords[windowIndex].x = -1; windowCoords[windowIndex].y = -1; windowIndex++; return( 1 ); } _wpi_getwindowrect( hwnd, &windowrect ); _wpi_getrectvalues( windowrect, &left, &top, NULL, NULL ); topleft.x = left; topleft.y = top; _wpi_screentoclient( ClientWindow, &topleft ); if( topleft.x < 0 ) { topleft.x = 0; } #ifndef __OS2_PM__ if( topleft.y < 0 ) { topleft.y = 0; } #endif windowCoords[windowIndex] = topleft; windowIndex++; return( 1 ); } /* GetPosProc */
/* * HitRestoreButton - check if a specified point hit the restore button */ bool HitRestoreButton( HWND hwnd, WPI_PARAM2 lparam ) { WPI_RECT r; WPI_POINT pt; int left; int top; int right; int bottom; _wpi_getwindowrect( hwnd, &r ); _wpi_getrectvalues( r, &left, &top, &right, &bottom ); top += _wpi_getsystemmetrics( SM_CYCAPTION ) + _wpi_getsystemmetrics( SM_CYFRAME ); bottom = top + CLOSE_BITMAP_Y; right -= _wpi_getsystemmetrics( SM_CXFRAME ); left = right - CLOSE_BITMAP_X; _wpi_setrectvalues( &r, left, top, right, bottom ); WPI_MAKEPOINT(lparam, lparam, pt); return( _wpi_ptinrect( &r, pt ) ); } /* HitRestoreButton */
/* * newChildPositions - handle re-location of a child window */ static void newChildPositions( void ) { mdi_data *curr; RECT r; RECT orig; if( childrenMaximized ) { return; } curr = mdiHead; memset( &minChildRect, 0, sizeof( RECT ) ); while( curr != NULL ) { _wpi_getwindowrect( curr->hwnd, &r ); orig = minChildRect; UnionRect( &minChildRect, &orig, &r ); haveMinChildRect = TRUE; curr = curr->next; } tryContainerScrollBars(); } /* newChildPositions */
/* * tryContainerScrollBars - try to add container scroll bars */ static void tryContainerScrollBars( void ) { WPI_RECT r; if( !haveMinChildRect || childrenMaximized ) { return; } _wpi_getwindowrect( mdiInfo.container, &r ); if( minChildRect.top < r.top || minChildRect.bottom > r.bottom ) { _wpi_setscrollrange( mdiInfo.container, SB_VERT, minChildRect.top, minChildRect.bottom, FALSE ); } else { _wpi_setscrollrange( mdiInfo.container, SB_VERT, 1, 1, FALSE ); } if( minChildRect.left < r.left || minChildRect.right > r.right ) { _wpi_setscrollrange( mdiInfo.container, SB_HORZ, minChildRect.left, minChildRect.right, FALSE ); } else { _wpi_setscrollrange( mdiInfo.container, SB_HORZ, 1, 1, FALSE ); } } /* tryContainerScrollBars */
/* * MDIContainerResized - resize MDI windows when container resized, if we're * maximized */ void MDIContainerResized( void ) { mdi_data *md; WPI_RECT r; WPI_RECTDIM left; WPI_RECTDIM top; WPI_RECTDIM right; WPI_RECTDIM bottom; if( MDIIsMaximized() ) { _wpi_getwindowrect( mdiInfo.container, &r ); _wpi_getrectvalues( r, &left, &top, &right, &bottom ); md = mdiHead; while( md != NULL ) { if( _wpi_isiconic( md->hwnd ) ) { _wpi_movewindow( md->hwnd, 0, 0, right - left + 1, bottom - top + 1, TRUE ); } md = md->next; } } } /* MDIContainerResized */
static bool guiToolBarProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam ) { gui_window *wnd; toolbarinfo *tbar; HMENU hmenu; gui_ctl_id id; wnd = GetToolWnd( hwnd ); if( wnd == NULL ) { return( false ); } tbar = wnd->tbinfo; if( tbar == NULL ) { return( false ); } switch( msg ) { case WM_CREATE : hwnd = _wpi_getframe( hwnd ); hmenu = _wpi_getsystemmenu( hwnd ); if( hmenu != NULLHANDLE ) { if( _wpi_appendmenu( hmenu, MF_SEPARATOR, 0, 0, NULLHANDLE, NULL ) ) { _wpi_appendmenu( hmenu, MF_ENABLED|MF_SYSMENU, 0, GUIHint[GUI_MENU_FIX_TOOLBAR].id, NULLHANDLE, GUIHint[GUI_MENU_FIX_TOOLBAR].label ); } } break; #ifdef __OS2_PM__ case WM_CHAR : case WM_TRANSLATEACCEL : #else case WM_SYSKEYDOWN : case WM_SYSKEYUP : case WM_KEYUP : case WM_KEYDOWN : #endif return( GUIProcesskey( hwnd, msg, wparam, lparam ) != 0 ); case WM_MENUSELECT : GUIProcessMenuSelect( wnd, hwnd, msg, wparam, lparam ); return( true ); case WM_SYSCOMMAND : id = _wpi_getid( wparam ); switch( id ) { case GUI_FIX_TOOLBAR : GUIChangeToolBar( wnd ); } break; #ifndef __OS2_PM__ case WM_NCLBUTTONDBLCLK : #endif case WM_RBUTTONDBLCLK : case WM_LBUTTONDBLCLK : /* flip the current state of the toolbar - * if we are fixed then start to float or vice versa */ if( !HasToolAtPoint( tbar->hdl, wparam, lparam ) ) { #ifdef __OS2_PM__ // Hack: For some reason we will get here with bogus coords, // we need to ignore the event. Should really find out where // the message is coming from. if( (ULONG)wparam != 0x0FFFFFFF ) GUIChangeToolBar( wnd ); #else GUIChangeToolBar( wnd ); #endif return( true ); } break; case WM_MOVE: case WM_SIZE: // Whenever we are moved or sized as a floating toolbar, we remember our position // so that we can restore it when dbl. clicked if( tbar->info.style == TOOLBAR_FLOAT_STYLE ) { hwnd = _wpi_getframe( hwnd ); _wpi_getwindowrect( hwnd, &tbar->floatrect ); } break; case WM_GETMINMAXINFO: { #ifdef __WINDOWS_386__ WPI_MINMAXINFO __far *minmax= (WPI_MINMAXINFO __far *)MK_FP32( (void *)lparam ); #else WPI_MINMAXINFO *minmax = (WPI_MINMAXINFO *)lparam; #endif _wpi_setmintracksize( minmax, ( tbar->info.border_size.x + _wpi_getsystemmetrics( SM_CXFRAME ) ) * 2 + tbar->info.button_size.x, ( tbar->info.border_size.y + _wpi_getsystemmetrics( SM_CYFRAME ) ) * 2 + tbar->info.button_size.y + _wpi_getsystemmetrics( SM_CYCAPTION ) ); } break; case WM_CLOSE : GUICloseToolBar( wnd ); return( true ); break; } return( false ); }
/* * ImgEdFrameProc - handle messages for the image editor application */ WPI_MRESULT CALLBACK ImgEdFrameProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam ) { static BOOL window_destroyed = FALSE; static HMENU hmenu; ctl_id cmdid; img_node *node; WPI_RECT rcmain; #ifndef __OS2_PM__ about_info ai; #endif WPI_RECTDIM left, top; if( !window_destroyed ) { enableMainItems( hmenu ); } switch( msg ) { case UM_EXIT: _wpi_sendmessage( hwnd, WM_COMMAND, IMGED_CLOSEALL, 0L ); /* fall through */ case UM_EXIT_NO_SAVE: if( _wpi_getfirstchild( _wpi_getclient( ClientWindow ) ) != NULL ) { break; } #ifndef __OS2_PM__ _wpi_destroywindow( _wpi_getframe( hwnd ) ); #else _wpi_sendmessage( hwnd, WM_CLOSE, 0, 0 ); #endif break; case UM_SAVE_ALL: SaveAllImages(); break; case WM_CREATE: hmenu = _wpi_getmenu( _wpi_getframe( hwnd ) ); #ifndef __OS2_PM__ createClientWindow( hwnd ); #endif if( !InitStatusLine( hwnd ) ) { return( -1 ); } InitFunctionBar( hwnd ); InitIconInfo(); InitializeCursors(); /* * Set values from profile information ... */ if( ImgedConfigInfo.brush_size <= 5 && ImgedConfigInfo.brush_size >= 2 ) { checkBrushItem( hmenu, IMGED_2x2 - 2 + ImgedConfigInfo.brush_size ); } if( ImgedConfigInfo.grid_on ) { CheckGridItem( hmenu ); } if( ImgedConfigInfo.square_grid ) { CheckSquareGrid( hmenu ); } if( ImgedConfigInfo.show_state & SET_SHOW_VIEW ) { CheckViewItem( hmenu ); } _wpi_enablemenuitem( hmenu, IMGED_CRESET, FALSE, FALSE ); _wpi_enablemenuitem( hmenu, IMGED_RCOLOR, FALSE, FALSE ); #ifndef __OS2_PM__ // not necessary for PM InitMenus( hmenu ); #endif SetHintText( IEAppTitle ); return( 0 ); #ifdef __NT__ case WM_DROPFILES: OpenImage( (HANDLE)wparam ); break; #endif case WM_MOVE: _wpi_getwindowrect( hwnd, &rcmain ); if( !ImgedConfigInfo.ismaximized ) { ImgedConfigInfo.last_xpos = ImgedConfigInfo.x_pos; ImgedConfigInfo.last_ypos = ImgedConfigInfo.y_pos; _wpi_getrectvalues( rcmain, &left, &top, NULL, NULL ); ImgedConfigInfo.x_pos = (short)left; ImgedConfigInfo.y_pos = (short)top; } return( 0 ); case WM_SIZE: ResizeFunctionBar( lparam ); ResizeStatusBar( lparam ); #ifndef __OS2_PM__ if( ClientWindow != NULL ) { setClientSize( hwnd ); } #else resizeClientArea( lparam ); #endif if( !_imgwpi_issizeminimized( wparam ) && !_imgwpi_issizemaximized( wparam ) ) { _wpi_getwindowrect( hwnd, &rcmain ); ImgedConfigInfo.width = (short)_wpi_getwidthrect( rcmain ); ImgedConfigInfo.height = (short)_wpi_getheightrect( rcmain ); ImgedConfigInfo.ismaximized = FALSE; } else { ImgedConfigInfo.x_pos = ImgedConfigInfo.last_xpos; ImgedConfigInfo.y_pos = ImgedConfigInfo.last_ypos; ImgedConfigInfo.ismaximized = _imgwpi_issizemaximized( wparam ); } return( FALSE ); case WM_MENUSELECT: #ifndef __OS2_PM__ if( GET_WM_MENUSELECT_FLAGS( wparam, lparam ) & MF_SEPARATOR ) { break; } if( GET_WM_MENUSELECT_FLAGS( wparam, lparam ) & MF_SYSMENU ) { PrintHintTextByID( WIE_SYSMENUOPERATIONS, NULL ); break; } #endif ShowHintText( LOWORD( wparam ) ); break; case WM_COMMAND: cmdid = LOWORD( wparam ); if( !IEIsMenuIDValid( hmenu, cmdid ) ) { break; } switch( cmdid ) { case IMGED_NEW: if( !ImgedIsDDE ) { if( !NewImage( UNDEF_IMG, NULL ) ) { PrintHintTextByID( WIE_NEIMAGENOTCREATED, NULL ); } } break; case IMGED_CLOSE: node = GetCurrentNode(); if( node != NULL ) { _wpi_sendmessage( node->hwnd, WM_CLOSE, 0, 0L ); } break; case IMGED_CLOSEALL: CloseAllImages(); break; case IMGED_HELP: IEHelpRoutine(); break; case IMGED_HELP_SEARCH: IEHelpSearchRoutine(); break; case IMGED_HELP_ON_HELP: IEHelpOnHelpRoutine(); break; case IMGED_ABOUT: #ifndef __OS2_PM__ ai.owner = hwnd; ai.inst = Instance; ai.name = IEAllocRCString( WIE_ABOUTTEXT ); ai.version = IEAllocRCString( WIE_ABOUTVERSION ); ai.title = IEAllocRCString( WIE_ABOUTTITLE ); DoAbout( &ai ); if( ai.name != NULL ) { IEFreeRCString( ai.name ); } if( ai.version != NULL ) { IEFreeRCString( ai.version ); } if( ai.title != NULL ) { IEFreeRCString( ai.title ); } #endif break; #ifndef __OS2_PM__ case IMGED_DDE_UPDATE_PRJ: IEUpdateDDEEditSession(); break; #endif case IMGED_SAVE_AS: SaveFile( SB_SAVE_AS ); break; case IMGED_SAVE: SaveFile( SB_SAVE ); break; case IMGED_OPEN: if( !ImgedIsDDE ) { OpenImage( NULL ); } break; case IMGED_CLEAR: ClearImage(); break; case IMGED_NEWIMG: AddNewIcon(); break; case IMGED_SELIMG: SelectIconImg(); break; case IMGED_DELIMG: DeleteIconImg(); break; case IMGED_UNDO: UndoOp(); break; case IMGED_REDO: RedoOp(); break; case IMGED_REST: RestoreImage(); break; case IMGED_SNAP: #ifndef __OS2_PM__ SnapPicture(); #endif break; case IMGED_RIGHT: case IMGED_LEFT: case IMGED_UP: case IMGED_DOWN: ShiftImage( cmdid ); break; case IMGED_FLIPHORZ: case IMGED_FLIPVERT: FlipImage( cmdid ); break; case IMGED_ROTATECC: case IMGED_ROTATECL: RotateImage( cmdid ); break; case IMGED_PASTE: PlaceAndPaste(); break; case IMGED_COPY: IECopyImage(); break; case IMGED_CUT: CutImage(); break; case IMGED_COLOR: CheckPaletteItem( hmenu ); break; case IMGED_VIEW: CheckViewItem( hmenu ); break; case IMGED_TOOLBAR: CheckToolbarItem( hmenu ); break; case IMGED_SQUARE: CheckSquareGrid( hmenu ); break; case IMGED_SIZE: ChangeImageSize(); break; case IMGED_GRID: CheckGridItem( hmenu ); break; case IMGED_MAXIMIZE: MaximizeCurrentChild(); break; case IMGED_SETTINGS: SelectOptions(); break; case IMGED_2x2: case IMGED_3x3: case IMGED_4x4: case IMGED_5x5: checkBrushItem( hmenu, cmdid ); break; case IMGED_CEDIT: #ifndef __OS2_PM__ EditColors(); #endif break; case IMGED_CRESET: #ifndef __OS2_PM__ RestoreColors(); #endif break; case IMGED_CSCREEN: ChooseBkColor(); break; case IMGED_SCOLOR: #ifndef __OS2_PM__ SaveColorPalette(); #endif break; case IMGED_LCOLOR: #ifndef __OS2_PM__ if( LoadColorPalette() ) { _wpi_enablemenuitem( hmenu, IMGED_RCOLOR, TRUE, FALSE ); } #endif break; case IMGED_RCOLOR: RestoreColorPalette(); break; case IMGED_FREEHAND: case IMGED_LINE: case IMGED_RECTO: case IMGED_RECTF: case IMGED_CIRCLEO: case IMGED_CIRCLEF: case IMGED_FILL: case IMGED_BRUSH: case IMGED_CLIP: case IMGED_HOTSPOT: SetToolType( cmdid ); PushToolButton( cmdid ); break; case IMGED_ARRANGE: #ifndef __OS2_PM__ SendMessage( ClientWindow, WM_MDIICONARRANGE, 0, 0L ); #endif break; case IMGED_TILE: #ifndef __OS2_PM__ SendMessage( ClientWindow, WM_MDITILE, MDITILE_VERTICAL, 0L ); #endif break; case IMGED_CASCADE: #ifndef __OS2_PM__ SendMessage( ClientWindow, WM_MDICASCADE, MDITILE_SKIPDISABLED, 0L ); #endif break; case IMGED_EXIT: _wpi_sendmessage( hwnd, WM_COMMAND, IMGED_CLOSEALL, 0L ); if( _wpi_getfirstchild( _wpi_getclient( ClientWindow ) ) != NULL ) { break; } #ifndef __OS2_PM__ _wpi_destroywindow( _wpi_getframe( hwnd ) ); #else _wpi_sendmessage( hwnd, WM_CLOSE, 0, 0 ); #endif break; default: #if 1 return( _imgwpi_defframeproc( hwnd, ClientWindow, msg, wparam, lparam ) ); #else return( 0 ); #endif } return( 0 ); #ifndef __OS2_PM__ case WM_COMPACTING: RelieveUndos(); return 0; #endif case WM_QUERYENDSESSION: if( _wpi_isiconic( _wpi_getframe( hwnd ) ) ) { if( ImgedConfigInfo.ismaximized ) { _wpi_maximizewindow( _wpi_getframe( hwnd ) ); } else { _wpi_showwindow( _wpi_getframe( hwnd ), SW_SHOWNORMAL ); } } _wpi_sendmessage( hwnd, WM_COMMAND, IMGED_CLOSEALL, 0L ); if( _wpi_getfirstchild( _wpi_getclient( ClientWindow ) ) != NULL ) { return( 0 ); } return( (WPI_MRESULT)1 ); case WM_CLOSE: // wParam is non-zero if the DDE connection died if( !wparam && !ImgEdEnableMenuInput ) { // this prevents the user from closing the editor during // DDE initialization return( 0 ); } _wpi_sendmessage( hwnd, WM_COMMAND, IMGED_CLOSEALL, 0L ); #ifdef __OS2_PM__ return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); #else if( _wpi_getfirstchild( _wpi_getclient( ClientWindow ) ) != NULL ) { return( 0 ); } window_destroyed = TRUE; _wpi_destroywindow( _wpi_getframe( hwnd ) ); return( 0 ); #endif case WM_DESTROY: #ifndef __OS2_PM__ WWinHelp( HMainWindow, "resimg.hlp", HELP_QUIT, 0 ); #endif FiniStatusLine(); CleanupClipboard(); CleanupCursors(); CloseToolBar(); CloseFunctionBar(); _wpi_deletefont( SmallFont ); _wpi_postquitmessage( 0 ); return( 0 ); default: break; } return( _imgwpi_defframeproc( hwnd, ClientWindow, msg, wparam, lparam ) ); } /* ImgEdFrameProc */
/* * doMaximize - handle maximizing an edit window */ static void doMaximize( HWND hwnd ) { DWORD style; mdi_data *md; WPI_RECT r; bool iconic; WPI_RECTDIM left; WPI_RECTDIM top; WPI_RECTDIM right; WPI_RECTDIM bottom; setMaximizedMenuConfig( hwnd ); md = MDI_DATA_FROM_HWND( hwnd ); if( mdiInfo.start_max_restore != NULL ) { mdiInfo.start_max_restore( hwnd ); } iconic = _wpi_isiconic( hwnd ); if( iconic ) { _wpi_getrestoredrect( hwnd, &md->orig_size ); } else { _wpi_getwindowrect( hwnd, &md->orig_size ); } md->orig_state = md->curr_state; md->curr_state = STATE_MAX; if( mdiInfo.set_style != NULL ) { (mdiInfo.set_style)( hwnd, TRUE ); } else { style = _wpi_getwindowlong( hwnd, GWL_STYLE ); style &= ~mdiInfo.reg_style; style |= mdiInfo.max_style; _wpi_setwindowlong( hwnd, GWL_STYLE, style ); } _wpi_setscrollrange( hwnd, SB_VERT, 1, 1, TRUE ); _wpi_setscrollrange( hwnd, SB_HORZ, 1, 1, TRUE ); _wpi_getwindowrect( mdiInfo.container, &r ); _wpi_getrectvalues( r, &left, &top, &right, &bottom ); if( !iconic ) { _wpi_offsetrect( mdiInfo.hinstance, &md->orig_size, -left, -top ); } _wpi_setrectvalues( &r, 0, 0, right-left+1, bottom-top+1 ); if( iconic ) { _wpi_setrestoredrect( hwnd, &r ); } else { _wpi_getrectvalues( r, &left, &top, &right, &bottom ); _wpi_movewindow( hwnd, left, top, right, bottom, TRUE ); } if( mdiInfo.end_max_restore != NULL ) { mdiInfo.end_max_restore( hwnd ); } _wpi_invalidaterect( hwnd, NULL, FALSE ); } /* doMaximize */
/* * ColorPalWinProc - handle messages for the color palette */ WPI_MRESULT CALLBACK ColorPalWinProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 mp1, WPI_PARAM2 mp2 ) { HMENU sysmenu; WPI_RECT rcpal; WPI_RECTDIM left; WPI_RECTDIM right; WPI_RECTDIM top; WPI_RECTDIM bottom; static HMENU menu; static HWND hframe; switch( msg ) { case WM_CREATE: hframe = _wpi_getframe( hwnd ); sysmenu = _wpi_getcurrentsysmenu( hframe ); _wpi_deletemenu( sysmenu, SC_RESTORE, FALSE ); _wpi_deletemenu( sysmenu, SC_SIZE, FALSE ); _wpi_deletemenu( sysmenu, SC_MINIMIZE, FALSE ); _wpi_deletemenu( sysmenu, SC_MAXIMIZE, FALSE ); _wpi_deletemenu( sysmenu, SC_TASKLIST, FALSE ); #ifdef __OS2_PM__ _wpi_deletemenu( sysmenu, SC_HIDE, FALSE ); #endif _wpi_deletesysmenupos( sysmenu, 1 ); _wpi_deletesysmenupos( sysmenu, 2 ); hbrush = _wpi_createsolidbrush( LTGRAY ); menu = GetMenu( _wpi_getframe( HMainWindow ) ); break; case WM_PAINT: _wpi_deleteobject( hbrush ); SetBkColor( (HDC)mp1, GetSysColor( COLOR_BTNFACE ) ); SetTextColor( (HDC)mp1, GetSysColor( COLOR_BTNTEXT ) ); hbrush = _wpi_createsolidbrush( GetSysColor( COLOR_BTNFACE ) ); paintPalette( hwnd ); break; #ifndef __OS2_PM__ #ifdef __NT__ case WM_SYSCOLORCHANGE: case WM_CTLCOLORSTATIC: case WM_CTLCOLORBTN: _wpi_deleteobject( hbrush ); hbrush = _wpi_createsolidbrush( GetSysColor( COLOR_BTNFACE ) ); SetBkColor( (HDC)mp1, GetSysColor( COLOR_BTNFACE ) ); SetTextColor( (HDC)mp1, GetSysColor( COLOR_BTNTEXT ) ); return( (WPI_MRESULT)hbrush ); #else case WM_CTLCOLOR: if( HIWORD( mp2 ) == CTLCOLOR_STATIC || HIWORD( mp2 ) == CTLCOLOR_BTN ) { SetBkColor( (HDC)LOWORD( mp1 ), LTGRAY ); SetTextColor( (HDC)LOWORD( mp1 ), BLACK ); return( (WPI_MRESULT)hbrush ); } break; #endif #endif case WM_MOVE: _wpi_getwindowrect( _wpi_getframe( hwnd ), &rcpal ); _wpi_getrectvalues( rcpal, &left, &top, &right, &bottom ); ImgedConfigInfo.pal_xpos = (short)left; ImgedConfigInfo.pal_ypos = (short)top; break; case WM_CLOSE: CheckPaletteItem( menu ); break; case WM_DESTROY: _wpi_deleteobject( hbrush ); break; default: return( DefWindowProc( hwnd, msg, mp1, mp2 ) ); } return( 0 ); } /* ColorPalWinProc */