renderspu_cocoa_helper.m revision 57cea4256a82a956938190676169ee988afefa0e
/* $Id$ */
/** @file
* VirtualBox OpenGL Cocoa Window System Helper Implementation.
*/
/*
* Copyright (C) 2009-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "renderspu_cocoa_helper.h"
#import <Cocoa/Cocoa.h>
#include "renderspu.h"
/** @page pg_opengl_cocoa OpenGL - Cocoa Window System Helper
*
* How this works:
* In general it is not so easy like on the other platforms, cause Cocoa
* doesn't support any clipping of already painted stuff. In Mac OS X there is
* the concept of translucent canvas's e.g. windows and there it is just
* painted what should be visible to the user. Unfortunately this isn't the
* concept of chromium. Therefor I reroute all OpenGL operation from the guest
* to a frame buffer object (FBO). This is a OpenGL extension, which is
* supported by all OS X versions we support (AFAIC tell). Of course the guest
* doesn't know that and we have to make sure that the OpenGL state always is
* Several functions below (like cocoaBindFramebufferEXT, cocoaGetIntegerv,
* ...) doing this. When a swap or finish is triggered by the guest, the
* content (which is already bound to an texture) is painted on the screen
* within a separate OpenGL context. This allows the usage of the same
* resources (texture ids, buffers ...) but at the same time having an
* different internal OpenGL state. Another advantage is that we can paint a
* thumbnail of the current output in a much more smaller (GPU accelerated
* scale) version on a third context and use glReadPixels to get the actual
* data. glReadPixels is a very slow operation, but as we just use a much more
* smaller image, we can handle it (anyway this is only done 5 times per
* second).
*
* Other things to know:
* - If the guest request double buffering, we have to make sure there are two
* buffers. We use the same FBO with 2 color attachments. Also glDrawBuffer
* the correct buffers. On swap our buffers are swapped and not the
* this is created.
* - If the size of the guest OpenGL window changes, all FBO's, textures, ...
* need to be recreated.
* - We need to track any changes to the parent window
* OverlayWindow, ... are there for.
* - The HGCM service runs on a other thread than the Main GUI. Keeps this
* always in mind (see e.g. performSelectorOnMainThread in renderFBOToView)
* - We make heavy use of late binding. We can not be sure that the GUI (or any
* other third party GUI), overwrite our NSOpenGLContext. So we always ask if
* this is our own one, before use. Really neat concept of Objective-C/Cocoa
* ;)
*/
/* Debug macros */
#define FBO 1 /* Disable this to see how the output is without the FBO in the middle of the processing chain. */
#if 0
# define SHOW_WINDOW_BACKGROUND 1 /* Define this to see the window background even if the window is clipped */
#else
do {} while (0)
#else
do {} while (0)
# define CHECK_GL_ERROR()\
do \
{ \
}while (0);
{
GLenum g = glGetError();
if (g != GL_NO_ERROR)
{
char *errStr;
switch (g)
{
}
}
}
#else
# define CHECK_GL_ERROR()\
do {} while (0)
do \
{ \
glPushMatrix(); \
glPushMatrix(); \
glMatrixMode(GL_COLOR); \
glPushMatrix(); \
glPushMatrix(); \
} \
while(0);
do \
{ \
glPopMatrix(); \
glMatrixMode(GL_COLOR); \
glPopMatrix(); \
glPopMatrix(); \
glPopMatrix(); \
glPopClientAttrib(); \
glPopAttrib(); \
} \
while(0);
static NSOpenGLContext * vboxCtxGetCurrent()
{
if (pCtxInfo)
{
if (pDbgCur)
{
}
}
{
}
return nil;
}
/** Custom OpenGL context class.
*
* This implementation doesn't allow to set a view to the
* context, but save the view for later use. Also it saves a copy of the
* pixel format used to create that context for later use. */
@interface OverlayOpenGLContext: NSOpenGLContext
{
@private
}
@end
@class DockOverlayView;
/** The custom view class.
* This is the main class of the cocoa OpenGL implementation. It
* manages an frame buffer object for the rendering of the guest
* applications. The guest applications render in this frame buffer which
* is bind to an OpenGL texture. To display the guest content, an secondary
* shared OpenGL context of the main OpenGL context is created. The secondary
* context is marked as non opaque & the texture is displayed on an object
* which is composed out of the several visible region rectangles. */
@interface OverlayView: NSView
{
@private
/** The corresponding dock tile view of this OpenGL view & all helper
* members. */
/* For clipping */
/** This is necessary for clipping on the root window */
}
- (id)initWithFrame:(NSRect)frame thread:(RTTHREAD)aThread parentView:(NSView*)pParentView winInfo:(WindowInfo*)pWinInfo;
- (NSOpenGLContext*)glCtx;
- (NSView*)parentView;
- (NSWindow*)overlayWin;
- (void)updateViewportCS;
- (void)reshape;
- (void)createDockTile;
- (void)deleteDockTile;
- (void)makeCurrentFBO;
- (void)swapFBO;
- (void)vboxTryDraw;
- (void)vboxTryDrawUI;
- (void)vboxPresent;
- (void)vboxPresentCS;
- (void)vboxPresentToDockTileCS;
- (void)vboxPresentToViewCS;
- (void)presentComposition:(PVBOXVR_SCR_COMPOSITOR)pCompositor withChangedEntry:(PVBOXVR_SCR_COMPOSITOR_ENTRY)pChangedEntry;
- (void)clearVisibleRegions;
- (NSView*)dockTileScreen;
- (void)reshapeDockTile;
- (void)cleanupData;
@end
/** Helper view.
*
* This view is added as a sub view of the parent view to track
* main window changes. Whenever the main window is changed
* (which happens on fullscreen/seamless entry/exit) the overlay
* window is informed & can add them self as a child window
* again. */
@class OverlayWindow;
@interface OverlayHelperView: NSView
{
@private
}
@end
/** Custom window class.
*
* This is the overlay window which contains our custom NSView.
* Its a direct child of the Qt Main window. It marks its background
* transparent & non opaque to make clipping possible. It also disable mouse
* events and handle frame change events of the parent view. */
@interface OverlayWindow: NSWindow
{
@private
}
@end
@interface DockOverlayView: NSView
{
}
- (void)dealloc;
- (void)cleanup;
- (void)lock;
- (void)unlock;
- (NSImage*)thumbImage;
@end
{
if (self)
{
/* We need a lock cause the thumb image could be accessed from the main
* thread when someone is calling display on the dock tile & from the
* OpenGL thread when the thumbnail is updated. */
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (void)cleanup
{
if (m_ThumbImage != nil)
{
m_ThumbImage = nil;
}
if (m_ThumbBitmap != nil)
{
m_ThumbBitmap = nil;
}
}
- (void)lock
{
}
- (void)unlock
{
}
{
{
/* Create a buffer for our thumbnail image. Its in the size of this view. */
}
}
{
return YES;
}
{
#endif /* SHOW_WINDOW_BACKGROUND */
if (m_ThumbImage != nil)
[m_ThumbImage drawAtPoint:NSMakePoint(0, 0) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
}
{
return m_ThumbBitmap;
}
- (NSImage*)thumbImage
{
return m_ThumbImage;
}
@end
/********************************************************************************
*
* OverlayOpenGLContext class implementation
*
********************************************************************************/
{
if (self)
return self;
}
- (void)dealloc
{
[super dealloc];
}
{
}
{
#if 1 /* def FBO */
#else
}
{
#if 1 /* def FBO */
return m_pView;
#else
return [super view];
}
-(void)clearDrawable
{
[super clearDrawable];
}
{
return m_pPixelFormat;
}
@end
/********************************************************************************
*
* OverlayHelperView class implementation
*
********************************************************************************/
{
return self;
}
-(void)viewDidMoveToWindow
{
}
@end
/********************************************************************************
*
* OverlayWindow class implementation
*
********************************************************************************/
{
if((self = [super initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]))
{
/* Add the helper view as a child of the parent view to get notifications */
/* Make sure this window is transparent */
/* For debugging */
#else
/* Disable mouse events for this window */
/* Set the overlay view as our content view */
/* Add ourself as a child to the parent views window. Note: this has to
* be done last so that everything else is setup in
* parentWindowChanged. */
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
{
/* Reposition this window with the help of the OverlayView. Perform the
* call in the OpenGL thread. */
/*
[m_pOverlayView performSelector:@selector(reshape) onThread:m_Thread withObject:nil waitUntilDone:YES];
*/
}
{
{
/* Ask to get notifications when our parent window frame changes. */
/* Add us self as child window */
/* Reshape the overlay view after a short waiting time to let the main
* window resize itself properly. */
/*
[m_pOverlayView performSelector:@selector(reshape) withObject:nil afterDelay:0.2];
[NSTimer scheduledTimerWithTimeInterval:0.2 target:m_pOverlayView selector:@selector(reshape) userInfo:nil repeats:NO];
*/
}
}
@end
/********************************************************************************
*
* OverlayView class implementation
*
********************************************************************************/
- (id)initWithFrame:(NSRect)frame thread:(RTTHREAD)aThread parentView:(NSView*)pParentView winInfo:(WindowInfo*)pWinInfo
{
/* Make some reasonable defaults */
m_FBOId = 0;
m_cClipRects = 0;
m_Pos = NSZeroPoint;
m_pCompositor = nil;
m_fNeedViewportUpdate = true;
m_fNeedCtxUpdate = true;
return self;
}
- (void)cleanupData
{
if (m_pGLCtx)
{
}
if (m_pSharedGLCtx)
{
}
}
- (void)dealloc
{
[self cleanupData];
[super dealloc];
}
{
}
{
return;
/* ensure the context drawable is cleared to avoid holding a reference to inexistent view */
if (m_pGLCtx)
}
- (NSOpenGLContext*)glCtx
{
return m_pGLCtx;
}
- (NSView*)parentView
{
return m_pParentView;
}
{
}
{
}
- (NSWindow*)overlayWin
{
return m_pOverlayWin;
}
{
[self vboxTryDraw];
}
{
return m_Pos;
}
{
{
DEBUG_MSG(("OVIW(%p): setSize: new size: %dx%d\n", (void*)self, (int)size.width, (int)size.height));
/* have to rebind GL_TEXTURE_RECTANGLE_ARB as m_FBOTexId could be changed in updateFBO call */
m_fNeedViewportUpdate = true;
m_fNeedCtxUpdate = true;
}
}
{
return m_Size;
}
- (void)updateViewportCS
{
NSRect r;
{
/* Update the viewport for our OpenGL view */
/* Setup all matrices */
DEBUG_MSG_1(("OVIW(%p): frame[%i, %i, %i, %i]\n", (void*)self, (int)r.origin.x, (int)r.origin.x, (int)r.size.width, (int)r.size.height));
DEBUG_MSG_1(("OVIW(%p): m_Pos(%i,%i) m_Size(%i,%i)\n", (void*)self, (int)m_Pos.x, (int)m_Pos.y, (int)m_Size.width, (int)m_Size.height));
DEBUG_MSG_1(("OVIW(%p): m_RootShift(%i, %i)\n", (void*)self, (int)m_RootShift.x, (int)m_RootShift.y));
/* Clear background to transparent */
}
}
- (void)reshape
{
/* Getting the right screen coordinates of the parents frame is a little bit
* complicated. */
parentPos = [[m_pParentView window] convertBaseToScreen:[[m_pParentView superview] convertPointToBase:NSMakePoint(parentFrame.origin.x, parentFrame.origin.y + parentFrame.size.height)]];
/* Calculate the new screen coordinates of the overlay window. */
childPos = [[m_pParentView window] convertBaseToScreen:[[m_pParentView superview] convertPointToBase:childPos]];
/* Make a frame out of it. */
/* We have to make sure that the overlay window will not be displayed out
* of the parent window. So intersect both frames & use the result as the new
* frame for the window. */
/* Later we have to correct the texture position in the case the window is
* out of the parents window frame. So save the shift values for later use. */
else
m_RootShift.x = 0;
else
m_RootShift.y = 0;
/*
NSScrollView *pScrollView = [[[m_pParentView window] contentView] enclosingScrollView];
if (pScrollView)
{
NSRect scrollRect = [pScrollView documentVisibleRect];
NSRect scrollRect = [m_pParentView visibleRect];
printf ("sc rect: %d %d %d %d\n", (int) scrollRect.origin.x,(int) scrollRect.origin.y,(int) scrollRect.size.width,(int) scrollRect.size.height);
NSRect b = [[m_pParentView superview] bounds];
printf ("bound rect: %d %d %d %d\n", (int) b.origin.x,(int) b.origin.y,(int) b.size.width,(int) b.size.height);
newFrame.origin.x += scrollRect.origin.x;
newFrame.origin.y += scrollRect.origin.y;
}
*/
/* Set the new frame. */
/* Inform the dock tile view as well */
/* Make sure the context is updated according */
/* [self updateViewport]; */
if (m_pSharedGLCtx)
{
}
}
- (void)createDockTile
{
/* Is there a dock tile preview enabled in the GUI? If so setup a
* additional thumbnail view for the dock tile. */
if (pDockScreen)
{
}
}
- (void)deleteDockTile
{
if (m_DockTileView != nil)
{
}
}
- (void)makeCurrentFBO
{
if (m_pGLCtx)
{
{
/* We change the active view, so flush first */
glFlush();
}
/*
if ([NSOpenGLContext currentContext] != m_pGLCtx)
*/
{
if (m_fNeedCtxUpdate == true)
{
m_fNeedCtxUpdate = false;
}
}
if (!m_FBOId)
{
}
}
}
- (void)vboxTryDraw
{
if ([self lockFocusIfCanDraw])
{
bool fCompositorAquired = false;
if (!m_pSharedGLCtx)
{
if (m_pCompositor)
{
fCompositorAquired = true;
/* Create a shared context out of the main context. Use the same pixel format. */
m_pSharedGLCtx = [[NSOpenGLContext alloc] initWithFormat:[(OverlayOpenGLContext*)m_pGLCtx openGLPixelFormat] shareContext:m_pGLCtx];
/* Set the new context as non opaque */
/* Set this view as the drawable for the new context */
m_fNeedViewportUpdate = true;
fCompositorAquired = false;
}
}
if (m_pSharedGLCtx)
{
if (!fCompositorAquired)
{
/* we do not want to be blocked with the GUI thread here, so only draw her eif we are really able to do that w/o bllocking */
if (RT_SUCCESS(rc))
{
fCompositorAquired = true;
}
else if (rc == VERR_SEM_BUSY)
{
glFlush();
/* issue to the gui thread */
}
else
{
/* this is somewhat we do not expect */
}
}
if (fCompositorAquired)
{
[self vboxPresent];
}
}
else
{
}
[self unlockFocus];
}
}
- (void)vboxTryDrawUI
{
if ([self lockFocusIfCanDraw])
{
if (m_pSharedGLCtx)
{
if (m_pCompositor)
{
[self vboxPresent];
}
}
[self unlockFocus];
}
}
- (void)swapFBO
{
}
- (void)vboxPresent
{
#if 0 //def DEBUG
{
}
}
- (void)vboxPresentCS
{
DEBUG_MSG(("OVIW(%p): rF2V frame: [%i, %i, %i, %i]\n", (void*)self, (int)r.origin.x, (int)r.origin.y, (int)r.size.width, (int)r.size.height));
{
{
m_fNeedViewportUpdate = true;
}
{
m_fNeedViewportUpdate = false;
}
/* Render FBO content to the dock tile when necessary. */
}
}
- (void)vboxPresentToViewCS
{
#if 1 /* Set to 0 to see the docktile instead of the real output */
/* Clear background to transparent */
{
int rc = CrVrScrCompositorEntryRegionsGet(m_pCompositor, pEntry, &cRegions, &paSrcRegions, &paDstRegions);
if (RT_SUCCESS(rc))
{
uint32_t i;
glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, pEntry->Tex.target, pEntry->Tex.hwid, 0);
{
}
}
else
{
Assert(0);
}
}
/*
glFinish();
*/
}
{
// Assert(pOldCtx == m_pGLCtx);
// Assert(pOldView == self);
// Assert(fNeedCtxSwitch);
if (fNeedCtxSwitch)
{
glFlush();
}
if (fNeedCtxSwitch)
{
glFlush();
{
{
}
{
}
}
else
{
}
}
}
- (void)presentComposition:(PVBOXVR_SCR_COMPOSITOR)pCompositor withChangedEntry:(PVBOXVR_SCR_COMPOSITOR_ENTRY)pChangedEntry
{
[self vboxTryDraw];
}
- (void)vboxPresentToDockTileCS
{
GLint i = 0;
{
/* Only update after at least 200 ms, cause glReadPixels is
* heavy performance wise. */
{
#if 0
/* todo: check this for optimization */
glFlush();
/* Do other work processing here, using a double or triple buffer */
/* Clear background to transparent */
{
int rc = CrVrScrCompositorEntryRegionsGet(m_pCompositor, pEntry, &cRegions, &paSrcRegions, &paDstRegions);
if (RT_SUCCESS(rc))
{
uint32_t i;
glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, pEntry->Tex.target, pEntry->Tex.hwid, 0);
{
}
}
else
{
Assert(0);
}
}
glFinish();
/* Here the magic of reading the FBO content in our own buffer
* happens. We have to lock this access, in the case the dock
* is updated currently. */
/* Send a display message to the dock tile in the main thread */
[[[NSApplication sharedApplication] dockTile] performSelectorOnMainThread:@selector(display) withObject:nil waitUntilDone:NO];
}
}
}
- (void)clearVisibleRegions
{
if(m_paClipRects)
{
}
m_cClipRects = 0;
}
{
if (cRects > 0)
{
int i =0;
for (i = 0; i < cRects; ++i)
DEBUG_MSG_1(("OVIW(%p): setVisibleRegions: %d - %d %d %d %d\n", (void*)self, i, paRects[i * 4], paRects[i * 4 + 1], paRects[i * 4 + 2], paRects[i * 4 + 3]));
}
[self vboxTryDraw];
}
- (NSView*)dockTileScreen
{
/* First try the new variant which checks if this window is within the
screen which is previewed in the dock. */
screenContent = [contentView performSelector:@selector(screenContentWithParentView:) withObject:(id)m_pParentView];
/* If it fails, fall back to the old variant (VBox...) */
return screenContent;
}
- (void)reshapeDockTile
{
{
newFrame = NSMakeRect((int)(m_Pos.x * m_FBOThumbScaleX), (int)(dockFrame.size.height - (m_Pos.y + m_Size.height - m_RootShift.y) * m_FBOThumbScaleY), (int)(m_Size.width * m_FBOThumbScaleX), (int)(m_Size.height * m_FBOThumbScaleY));
/*
NSRect newFrame = NSMakeRect ((int)roundf(m_Pos.x * m_FBOThumbScaleX), (int)roundf(dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (int)roundf(m_Size.width * m_FBOThumbScaleX), (int)roundf(m_Size.height * m_FBOThumbScaleY));
NSRect newFrame = NSMakeRect ((m_Pos.x * m_FBOThumbScaleX), (dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (m_Size.width * m_FBOThumbScaleX), (m_Size.height * m_FBOThumbScaleY));
printf ("%f %f %f %f - %f %f\n", newFrame.origin.x, newFrame.origin.y, newFrame.size.width, newFrame.size.height, m_Size.height, m_FBOThumbScaleY);
*/
}
}
@end
/********************************************************************************
*
* OpenGL context management
*
********************************************************************************/
void cocoaGLCtxCreate(NativeNSOpenGLContextRef *ppCtx, GLbitfield fVisParams, NativeNSOpenGLContextRef pSharedCtx)
{
{
};
int i = 4;
if (fVisParams & CR_ALPHA_BIT)
{
DEBUG_MSG(("CR_ALPHA_BIT requested\n"));
attribs[i++] = NSOpenGLPFAAlphaSize;
attribs[i++] = 8;
}
if (fVisParams & CR_DEPTH_BIT)
{
DEBUG_MSG(("CR_DEPTH_BIT requested\n"));
attribs[i++] = NSOpenGLPFADepthSize;
attribs[i++] = 24;
}
if (fVisParams & CR_STENCIL_BIT)
{
DEBUG_MSG(("CR_STENCIL_BIT requested\n"));
attribs[i++] = NSOpenGLPFAStencilSize;
attribs[i++] = 8;
}
if (fVisParams & CR_ACCUM_BIT)
{
DEBUG_MSG(("CR_ACCUM_BIT requested\n"));
attribs[i++] = NSOpenGLPFAAccumSize;
if (fVisParams & CR_ALPHA_BIT)
attribs[i++] = 32;
else
attribs[i++] = 24;
}
if (fVisParams & CR_MULTISAMPLE_BIT)
{
DEBUG_MSG(("CR_MULTISAMPLE_BIT requested\n"));
attribs[i++] = NSOpenGLPFASampleBuffers;
attribs[i++] = 1;
attribs[i++] = NSOpenGLPFASamples;
attribs[i++] = 4;
}
if (fVisParams & CR_DOUBLE_BIT)
{
DEBUG_MSG(("CR_DOUBLE_BIT requested\n"));
attribs[i++] = NSOpenGLPFADoubleBuffer;
}
if (fVisParams & CR_STEREO_BIT)
{
/* We don't support that.
DEBUG_MSG(("CR_STEREO_BIT requested\n"));
attribs[i++] = NSOpenGLPFAStereo;
*/
}
/* Mark the end */
attribs[i++] = 0;
/* Choose a pixel format */
if (pFmt)
{
/* Enable multi threaded OpenGL engine */
/*
CGLContextObj cglCtx = [*ppCtx CGLContextObj];
CGLError err = CGLEnable(cglCtx, kCGLCEMPEngine);
if (err != kCGLNoError)
printf ("Couldn't enable MT OpenGL engine!\n");
*/
}
}
{
/*
[pCtx release];
*/
}
/********************************************************************************
*
* View management
*
********************************************************************************/
void cocoaViewCreate(NativeNSViewRef *ppView, WindowInfo *pWinInfo, NativeNSViewRef pParentView, GLbitfield fVisParams)
{
/* Create our worker view */
OverlayView* pView = [[OverlayView alloc] initWithFrame:NSZeroRect thread:RTThreadSelf() parentView:pParentView winInfo:pWinInfo];
if (pView)
{
/* We need a real window as container for the view */
/* Return the freshly created overlay view */
}
}
{
if (pOView)
{
/* Make sure the window is removed from any previous parent window. */
{
}
/* Set the new parent view */
/* Add the overlay window as a child to the new parent window */
if (pParentView != nil)
{
}
}
}
{
/* Hide the view early */
/*
a = [pWin retainCount];
for (; a > 1; --a)
[pWin performSelector:@selector(release)]
*/
/* We can NOT run synchronously with the main thread since this may lead to a deadlock,
caused by main thread waiting xpcom thread, xpcom thread waiting to main hgcm thread,
and main hgcm thread waiting for us, this is why use waitUntilDone:NO,
which should cause no harm */
/*
[pWin release];
*/
/* We can NOT run synchronously with the main thread since this may lead to a deadlock,
caused by main thread waiting xpcom thread, xpcom thread waiting to main hgcm thread,
and main hgcm thread waiting for us, this is why use waitUntilDone:NO.
We need to avoid concurrency though, so we cleanup some data right away via a cleanupData call */
/* There seems to be a bug in the performSelector method which is called in
* parentWindowChanged above. The object is retained but not released. This
* results in an unbalanced reference count, which is here manually
* decremented. */
/*
a = [pView retainCount];
for (; a > 1; --a)
*/
/*
[pView release];
*/
}
{
}
{
}
{
}
{
}
{
}
void cocoaViewPresentComposition(NativeNSViewRef pView, struct VBOXVR_SCR_COMPOSITOR * pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry)
{
}
{
if (pView)
{
}
else
{
}
}
{
}