commands/fed/src/screenmngr.cpp
changeset 78 b3ffff030d5c
parent 0 7f656887cf89
child 79 dae66483be2b
equal deleted inserted replaced
77:8df58d8c99e8 78:b3ffff030d5c
    26 		User::Leave(KErrNotSupported);
    26 		User::Leave(KErrNotSupported);
    27 
    27 
    28 	if(aWindow == iScreenWnd)
    28 	if(aWindow == iScreenWnd)
    29 		return;
    29 		return;
    30 
    30 
    31 	//We need to leave one char on each side for the border around the console window, so the width/height is actually less by 2
    31 	// We need to leave one char on each side for the border around the console window, so the width/height is actually less by 2
       
    32 	// (*if* we're running as a pure CConsoleBase app under tshell. Doesn't apply when built as an fshell app, as KConsoleWidthCorrection is zero in that case).
    32 	iMainWnd.iX = iCmdWnd.iX = aWindow.iX;
    33 	iMainWnd.iX = iCmdWnd.iX = aWindow.iX;
    33 	iMainWnd.iWidth = iCmdWnd.iWidth = aWindow.iWidth + KConsoleWidthCorrection;
    34 	iMainWnd.iWidth = iCmdWnd.iWidth = aWindow.iWidth + KConsoleWidthCorrection;
    34 	iMainWnd.iY = aWindow.iY;
    35 	iMainWnd.iY = aWindow.iY;
    35 
    36 
    36 	//Based on proportions of windows on the old screen calculate proportions on the new screen
    37 	//Based on proportions of windows on the old screen calculate proportions on the new screen
    37 	TInt newcmdh = 1;
    38 	iCmdWnd.iWidth = aWindow.iWidth;
    38 	if(iScreenWnd.iHeight)
       
    39 		{
       
    40 		newcmdh = ((iCmdWnd.iHeight*KRM) * (aWindow.iHeight*KRM)) / iScreenWnd.iHeight*KRM*KRM;
       
    41 		if(newcmdh >= aWindow.iHeight)
       
    42 			newcmdh = aWindow.iHeight/2;
       
    43 		}
       
    44 	iCmdWnd.iHeight = newcmdh > 0 ? newcmdh : 1;
       
    45 	iMainWnd.iHeight = aWindow.iHeight - iCmdWnd.iHeight + KConsoleWidthCorrection;
    39 	iMainWnd.iHeight = aWindow.iHeight - iCmdWnd.iHeight + KConsoleWidthCorrection;
    46 	iCmdWnd.iY = aWindow.iY + iMainWnd.iHeight;
    40 	iCmdWnd.iY = aWindow.iY + iMainWnd.iHeight;
    47 	iScreenWnd = aWindow;
    41 	iScreenWnd = aWindow;
    48 
    42 
    49 	if(iCurrentView)
    43 	if(iCurrentView)
    50 		iCurrentView->ResizeL(iMainWnd);
    44 		iCurrentView->ResizeL(iMainWnd);
       
    45 	}
       
    46 
       
    47 const TWindow& CScreenManager::GetCommandWindow()
       
    48 	{
       
    49 	return iCmdWnd;
    51 	}
    50 	}
    52 
    51 
    53 const TWindow& CScreenManager::ResizeCommandWindowL(TInt aHeight)
    52 const TWindow& CScreenManager::ResizeCommandWindowL(TInt aHeight)
    54 	{
    53 	{
    55 	if(aHeight == iCmdWnd.iHeight)
    54 	if(aHeight == iCmdWnd.iHeight)