RE: Fw: Splitter window woes.
"Roland" <[email protected]>
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <[email protected]> |
Hi Alen
I've coded almost *exactly* the same application. :-)
If I remember correctly, I copied the source of the CSplitterWnd and
created a CRenderWnd. Then hacked that source to get the 4-pane look
and feel with possible maximizing of the active view (think 3DSMax
UI). I didn't delete the 3 hidden views, they were just resized to (0,
0). Here's my solution for that (modified code from CSplitterWnd -
'm_pRenderViewXX' point to 4 instances of CRenderView (which contains
the backbuffer and does the rendering itself), 'm_pMaximizedView'
points to one of these instances (which is then the maximized one) or
to NULL (aka all 4 views are visible)):
void CRenderWnd::SizeRowAndColumn(int cx, int cy)
{
ASSERT_VALID(this);
// give the hint for the maximum number of HWNDs
AFX_SIZEPARENTPARAMS layout;
layout.hDWP = ::BeginDeferWindowPos(5);
//BLOCK: Reposition all the panes
if(NULL == m_pMaximizedView)
{
int cx1 = cx / 2;
int cx2 = cx - cx1;
int cy1 = cy / 2;
int cy2 = cy - cy1;
_AfxDeferClientPos(&layout, m_pRenderViewNW, 0, 0, cx1,
cy1, FALSE);
_AfxDeferClientPos(&layout, m_pRenderViewNE, cx1, 0, cx2,
cy1, FALSE);
_AfxDeferClientPos(&layout, m_pRenderViewSW, 0, cy1, cx1,
cy2, FALSE);
_AfxDeferClientPos(&layout, m_pRenderViewSE, cx1, cy1, cx2,
cy2, FALSE);
}
else
{
_AfxDeferClientPos(&layout, m_pRenderViewNW, 0, 0, 0,
0, FALSE);
_AfxDeferClientPos(&layout, m_pRenderViewNE, 0, 0, 0,
0, FALSE);
_AfxDeferClientPos(&layout, m_pRenderViewSW, 0, 0, 0,
0, FALSE);
_AfxDeferClientPos(&layout, m_pRenderViewSE, 0, 0, 0,
0, FALSE);
_AfxDeferClientPos(&layout, m_pMaximizedView, 0, 0, cx,
cy, FALSE);
}
// move and resize all the windows at once!
if(layout.hDWP == NULL || !::EndDeferWindowPos(layout.hDWP))
TRACE0("Warning: DeferWindowPos failed - low system
resources.\n");
}
And here's the message handler for 'Toggle Maximized property of the
currently active render view':
void CRenderWnd::MaximizeActiveView(void)
{
m_pMaximizedView = (NULL == m_pMaximizedView) ?
m_pMaximizedView = GetActiveRenderView() : NULL;
ResizeInside();
Invalidate();
}
void CRenderWnd::ResizeInside(void)
{
CRect rect;
GetClientRect(&rect);
rect.NormalizeRect();
SizeRowAndColumn(rect.Width(), rect.Height());
}
I've also modified other parts of the original CSplitterWnd code. Let
me know if you need more cut/paste
hope this helps
roland
-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of
Lachlan Littlemore
Sent: Wednesday, July 21, 2004 4:59 AM
To: [email protected]
Subject: Re: [GD-Windows] Fw: Splitter window woes.
Hey, thanks for the reply. Unfortunately, I'm already destroying
each
window and creating a new one with the desired viewing class, so I
guess I'm
already doing that.
Cheers,
- Lachlan
----- Original Message -----
From: "Alen Ladavac" <[email protected]>
To: <[email protected]>
Sent: Wednesday, July 21, 2004 5:39 PM
Subject: Re: [GD-Windows] Fw: Splitter window woes.
> I don't know which kind of insecticide is right for your bug, but I
can
tell
> you about another interesting bug... OpenGL on Windows has this
specific
> problem, where you can only initialize an OGL context for a window
once.
If
> you want to do it again (because you changed display mode, e.g.),
you need
> to close the window and open a new one. For that kind of bug, you
need a
> nuke: we wrapped a child window within any window that wanted to
have a
> context, and make a context in the child. So anytime we want to
reinitialize
> the context, we just destroy the child and create it again.
>
> As it happens, this kind of nuke also instantly kills all Win32
> peciuliarities regarding how different window classes and flags
interact
> with creation of contexts, both for OpenGL and for D3D. Might want
to try
it
> on yours as well. ;)
>
>
> HTH,
> Alen
>
>
> ----- Original Message -----
> From: "Lachlan Littlemore" <[email protected]>
> To: "GameDev Windows" <[email protected]>
> Sent: Tuesday, July 20, 2004 22:25
> Subject: [GD-Windows] Fw: Splitter window woes.
>
>
> > Hi all,
> >
> > I'm currently working on a level editor tool which uses
multiple
> > viewpoints (subclasses of a BASE_GRAPHICS class) to show
different
> > perspectives on the level. I have a splitter window which has two
panes
> in
> > it. One for the viewpoint(s) and another for the tool-panel
dialog. The
> > user
> > can toggle between having just one viewpoint in the viewpoint
pane, or
> > splitting it into 4 smaller ones (each with individual views),
which
> > involves using a nested splitter. At any time, the user can pick
a
> > different
> > viewpoint (perspective, various orthogonal ones etc) from
comboboxes on
> the
> > tools dialog to change to a different view. This involves calling
> > deleteView() on the pane and then a createView() with the new
viewing
> > class.
> > If the user toggles between split and single viewpoints, I have
to call
> > deleteView on all the views, delete the nested splitter and
create a
> single
> > view (and vice-versa for going from single view to multi).
> >
> > This is all working *fairly* fine, except that for some
reason, the
> > first view (top-left in the 2 x 2 nested splitter) does not draw
properly
> > once you try to delete and re-create it. It works fine on
application
> > start-up, but if you try to change the viewpoint or un-split,
then
> re-split
> > the view, it just renders black. Looking at debugging output, I
can see
> > that
> > in the function which re-splits the views, the other 3 views
haven't
had
> > their windows created or Direct3D devices initialised (meaning
their
> > windows
> > haven't been initialised yet), but the first view has valid data
in it,
> > like
> > it wasn't ever deleted. This is very strange, as I'm deleting the
> splitter
> > object itself when I un-split the view (otherwise I get an
assertion
for
> > having views that don't have any windows created for them). Does
anyone
> > know
> > of any behaviour that is specific to the first view in a
splitter? The
> pane
> > in question does redraw, it just draws a black background though
(perhaps
> > an
> > initialisation function is not being called?).
> >
> > Thanks in advance,
> >
> > - Lachlan
> >
> > P.S. I have a hunch that the reason it works fine on app
startup is
> > because the views are initially created in an OnCreateClient()
call,
> which
> > has a valid CCreateContext member to use for their creation. The
other
> > functions are called by me directly, so they have no such luxury.
I
have
> > tried fabricating my own CCreateContext with any combination of
valid
> data
> > I
> > can find (GetActiveDocument(), the dynamic class to be used for
the
view,
> a
> > pointer to the document template, etc), but in that case, the
window
> > doesn't
> > even refresh!
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by BEA Weblogic Workshop
> > FREE Java Enterprise J2EE developer tools!
> > Get your free copy of BEA WebLogic Workshop 8.1 today.
> > http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
> > _______________________________________________
> > Gamedevlists-windows mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
> > Archives:
> > http://sourceforge.net/mailarchive/forum.php?forum_id=555
> >
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
> _______________________________________________
> Gamedevlists-windows mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_id=555
>
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Gamedevlists-windows mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=555
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Gamedevlists-windows mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=555