rendwnd.cpp

Go to the documentation of this file.
00001 // $Id: rendwnd.cpp 1593 2006-07-29 11:22:30Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 //
00099 // The CRendWnd class implementation.
00100 //
00101 
00102 
00103 #include "camtypes.h"
00104 #include "rendwnd.h"
00105 #include "camelot.h"                            // for IsWin32s()
00106 //#include "ensure.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 //#include "palman.h"
00108 #include "ccdc.h"
00109 #include "prncamvw.h"
00110 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00111 #include "camview.h"
00112 #include "camframe.h"
00113 #include "keypress.h"
00114 
00115 DECLARE_SOURCE("$Revision: 1593 $");
00116 
00117 #if 0
00118 #ifdef _DEBUG
00119 #undef THIS_FILE
00120 static char BASED_CODE THIS_FILE[] = __FILE__;
00121 #endif
00122 #endif
00123 
00124 CC_IMPLEMENT_DYNCREATE(OpToggleDoubleBuffer, Operation)
00125 
00126 IMPLEMENT_DYNAMIC_CLASS( CRenderWnd, wxWindow )
00127 
00128 // Declare smart memory handling in Debug builds
00129 #define new CAM_DEBUG_NEW
00130 
00131 BEGIN_EVENT_TABLE( CRenderWnd, wxWindow )
00132     EVT_PAINT(              CRenderWnd::OnPaint )           
00133     EVT_ERASE_BACKGROUND(   CRenderWnd::OnErase )
00134     EVT_LEFT_DOWN(          CRenderWnd::OnLButtonDown )
00135     EVT_LEFT_DCLICK(        CRenderWnd::OnLButtonDblClk )
00136     EVT_LEFT_UP(            CRenderWnd::OnLButtonUp )
00137     EVT_MIDDLE_DOWN(        CRenderWnd::OnMButtonDown )
00138     EVT_MIDDLE_DCLICK(      CRenderWnd::OnMButtonDblClk )
00139     EVT_MIDDLE_UP(          CRenderWnd::OnMButtonUp )
00140     EVT_RIGHT_DOWN(         CRenderWnd::OnRButtonDown )
00141     EVT_RIGHT_DCLICK(       CRenderWnd::OnRButtonDblClk )
00142     EVT_RIGHT_UP(           CRenderWnd::OnRButtonUp )
00143     EVT_MOTION(             CRenderWnd::OnMouseMove )
00144     EVT_MOUSEWHEEL(         CRenderWnd::OnMouseWheel )
00145     EVT_SIZE(               CRenderWnd::OnSize)
00146     EVT_SET_CURSOR(         CRenderWnd::OnSetCursor )
00147     EVT_KEY_DOWN(           CRenderWnd::OnKey)
00148     EVT_KEY_UP(             CRenderWnd::OnKey)
00149     EVT_CHAR(               CRenderWnd::OnChar)
00150     EVT_IDLE(               CRenderWnd::OnIdle)
00151     
00152 #if defined(__WXGTK__)
00153     EVT_ENTER_WINDOW(       CRenderWnd::OnEnter )
00154     EVT_LEAVE_WINDOW(       CRenderWnd::OnLeave )
00155 #endif
00156 END_EVENT_TABLE()
00157 
00158 BOOL CRenderWnd::m_DoubleBuffer = FALSE;
00159 
00160 CRenderWnd::CRenderWnd(CCamView* pView) :
00161     m_pView(pView), m_pCCClientDC(NULL)
00162 {
00163     m_DCUsers=0;
00164     // Nothing else to do for now...
00165 }
00166 
00167 CRenderWnd::~CRenderWnd()
00168 {
00169     TRACEUSER("Gerry", _T("Deleting CRenderWnd at 0x%08x\n"), this);
00170     if (m_DCUsers)
00171     {
00172         ERROR3("CRenderWnd::~CRenderWnd non-zero DC user count - leaking a DC");
00173     }
00174     else
00175     {
00176         if (m_pCCClientDC)
00177         {
00178             delete(m_pCCClientDC);
00179             m_pCCClientDC = NULL;
00180         }
00181     }
00182 }
00183 
00184 /*********************************************************************************************
00185 >   virtual void CRenderWnd::AllocateDC(BOOL KeepIt=TRUE)
00186 
00187     Author:     Alex Bligh <alex@alex.org.uk>
00188     Created:    12/06/2006
00189     Inputs:     None
00190     Outputs:    None
00191     Returns:    Pointer to the CCClientDC
00192     Purpose:    Returns a pointer to the appropriate client DC, allocating it if necessary
00193     Errors:     -
00194     Scope:      Public
00195     SeeAlso:    CCamView::OnCreate()
00196 
00197 **********************************************************************************************/ 
00198 
00199 void CRenderWnd::AllocateDC(BOOL KeepIt/*=TRUE*/)
00200 {
00201     ERROR3IF((m_DCUsers && !m_pCCClientDC), "We have users, but no client DC");
00202     if (!m_pCCClientDC)
00203         m_pCCClientDC = new CCClientDC(this); // OK if it fails
00204     
00205     if (KeepIt)
00206         m_DCUsers++;
00207     return;
00208 }
00209 
00210 /*********************************************************************************************
00211 >   virtual wxClientDC * CRenderWnd::GetClientDC()
00212 
00213     Author:     Alex Bligh <alex@alex.org.uk>
00214     Created:    12/06/2006
00215     Inputs:     None
00216     Outputs:    None
00217     Returns:    Pointer to the CCClientDC
00218     Purpose:    Returns a pointer to the appropriate client DC, allocating it if necessary
00219     Errors:     -
00220     Scope:      Public
00221     SeeAlso:    CCamView::OnCreate()
00222 
00223 **********************************************************************************************/ 
00224 
00225 wxClientDC * CRenderWnd::GetClientDC()
00226 {
00227     if (!m_pCCClientDC)
00228         AllocateDC(FALSE);
00229     return (wxClientDC*)(m_pCCClientDC?m_pCCClientDC->GetDC():NULL);
00230 }
00231 
00232 /*********************************************************************************************
00233 >   void CRenderWnd::DoneWithDC()
00234 
00235     Author:     Alex Bligh <alex@alex.org.uk>
00236     Created:    12/06/2006
00237     Purpose:    Hints that we've done with our DC
00238     SeeAlso:    View; PaperRenderRegion.
00239 
00240 Note this is merely a hint. This routine is not guaranteed to eb called
00241 
00242 **********************************************************************************************/ 
00243 
00244 void CRenderWnd::DoneWithDC()
00245 {
00246     ERROR3IF((m_DCUsers<=0), "We have no users, but I'm being told I'm done with");
00247 
00248     if (m_DCUsers>0)
00249         m_DCUsers--;
00250 
00251     // Note we use a lazy-destroy from our idle handler
00252 }
00253 
00254 /*********************************************************************************************
00255 >   void CRenderWnd::OnIdle()
00256 
00257     Author:     Alex Bligh <alex@alex.org.uk>
00258     Created:    12/06/2006
00259     Purpose:    Laze deletion of our client DC on idle
00260     SeeAlso:    View; PaperRenderRegion.
00261 
00262 We appear to need to create and delete DCs or rendering into the first RenderWindow doesn't
00263 work. Who knows why.
00264 
00265 **********************************************************************************************/ 
00266 
00267 void CRenderWnd::OnIdle(wxIdleEvent &event)
00268 {
00269     if (PrintMonitor::IsPrintingNow())
00270         return;
00271 
00272     if ((m_DCUsers<=0) && m_pCCClientDC)
00273     {
00274         delete m_pCCClientDC;
00275         m_pCCClientDC=NULL;
00276     }
00277 }
00278 
00279 /*********************************************************************************************
00280 >   virtual BOOL CRenderWnd::Create(const wxRect& rect,
00281                                     wxWindow* parent, UINT32 id)
00282     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00283     Created:    ages ago
00284     Inputs:     Windows instance-style flags; a
00285                 rectangle describing the position of the scroller; a pointer to its
00286                 parent window; a child window numeric identifier
00287     Outputs:    -
00288     Returns:    TRUE if the window is successfully created.
00289     Purpose:    Registers a new window class with the operating system, which accepts
00290                 double clicks, is byte-aligned in video RAM and is responsible for
00291                 drawing is own backgrounds.
00292     Errors:     -
00293     Scope:      Public
00294     SeeAlso:    CCamView::OnCreate()
00295 
00296 **********************************************************************************************/ 
00297 BOOL CRenderWnd::Create(const wxRect& rect,
00298                         wxWindow *pParent, UINT32 id)
00299 {
00300     BOOL ok=wxWindow::Create(pParent, id, rect.GetTopLeft(), rect.GetSize(), wxNO_FULL_REPAINT_ON_RESIZE);
00301     SetExtraStyle(wxWS_EX_PROCESS_IDLE);
00302 #if defined(__WXGTK__)
00303 	::SetDoubleBuffer(this, m_DoubleBuffer);
00304 #endif
00305     return ok;
00306 }
00307 
00308 
00309 
00311 // CRenderWnd message handlers.
00312 
00313 /*********************************************************************************************
00314 >   afx_msg void CRenderWnd::OnPaint()
00315 
00316     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00317     Created:    ages ago
00318     Inputs:     -
00319     Outputs:    -
00320     Returns:    -
00321     Purpose:    Creates a CPaintDC and sends a private WM_RENDERVIEW message, together with
00322                 a pointer to the CPaintDC in the LPARAM, to the parent CCamView. Uses a
00323                 CCPaintDC so we can get to the rectangle list subsequently.
00324     Errors:     -
00325     Scope:      Protected
00326     SeeAlso:    CCamView::OnRenderView()
00327 
00328 **********************************************************************************************/ 
00329 void CRenderWnd::OnPaint( wxPaintEvent &evnt )
00330 {
00331     if ((!CCamApp::IsDisabled()) && (!PrintMonitor::IsPrintingNow()))
00332     {
00333         CCPaintDC dc(this);
00334 //      wxPalette* OldPal = PaletteManager::StartPaintPalette(&dc);
00335 
00336         if (m_pView)
00337             m_pView->OnDraw(dc.GetDC());
00338 
00339 //      PaletteManager::StopPaintPalette(&dc, OldPal);
00340     }
00341     else
00342     {
00343         // if we were printing, we have to draw something - white will do
00344         if (PrintMonitor::IsPrintingNow())
00345         {
00346             // Draw a white rectangle here
00347             wxPaintDC MyPaint(this);
00348 
00349             // Lets have a white brush...
00350             MyPaint.SetBrush(wxBrush(wxColour(*wxWHITE)));
00351             MyPaint.SetPen(*wxTRANSPARENT_PEN);
00352 
00353             wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
00354 
00355             while (upd)
00356             {
00357                 wxRect rect(upd.GetRect());
00358                 MyPaint.DrawRectangle(rect);
00359                 upd++;
00360             }
00361 
00362             // ask for a full redraw at the end
00363             PrintMonitor::WantFullRedraw(TRUE);
00364         }
00365         else
00366         {
00367             wxPaintDC dc( this );                               // Clear paint condition 
00368         }
00369     }
00370 }
00371 
00372 
00373 
00374 /*********************************************************************************************
00375 >   afx_msg void CRenderWnd::OnLButtonDown(UINT32, CPoint)
00376 
00377     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00378     Created:    ages ago
00379     Inputs:     Not used.
00380     Outputs:    -
00381     Returns:    -
00382     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00383                 CRenderWnd::PassMsgToParent().
00384     Errors:     -
00385     Scope:      Protected
00386     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnLButtonDown()
00387 
00388 **********************************************************************************************/ 
00389 void CRenderWnd::OnLButtonDown( wxMouseEvent &evnt )
00390 {
00391     if (m_pView)
00392         m_pView->OnLButtonDown(evnt);
00393 }
00394 
00395 
00396 
00397 /*********************************************************************************************
00398 >   afx_msg void CRenderWnd::OnLButtonDblClk(UINT32, CPoint)
00399 
00400     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00401     Created:    ages ago
00402     Inputs:     Not used.
00403     Outputs:    -
00404     Returns:    -
00405     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00406                 CRenderWnd::PassMsgToParent().
00407     Errors:     -
00408     Scope:      Protected
00409     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnLButtonDblClk()
00410 
00411 **********************************************************************************************/ 
00412 void CRenderWnd::OnLButtonDblClk( wxMouseEvent &evnt )
00413 {
00414     if (m_pView)
00415         m_pView->OnLButtonDblClk(evnt);
00416 }
00417 
00418 
00419 
00420 /*********************************************************************************************
00421 >   afx_msg void CRenderWnd::OnLButtonUp(UINT32, CPoint)
00422 
00423     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00424     Created:    ages ago
00425     Inputs:     Not used.
00426     Outputs:    -
00427     Returns:    -
00428     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00429                 CRenderWnd::PassMsgToParent().
00430     Errors:     -
00431     Scope:      Protected
00432     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnLButtonUp()
00433 
00434 **********************************************************************************************/ 
00435 void CRenderWnd::OnLButtonUp( wxMouseEvent &evnt )
00436 {
00437     if (m_pView)
00438         m_pView->OnLButtonUp(evnt);
00439 }
00440 
00441 
00442 
00443 /*********************************************************************************************
00444 >   afx_msg void CRenderWnd::OnMouseMove(UINT32, CPoint)
00445 
00446     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00447     Created:    ages ago
00448     Inputs:     Not used.
00449     Outputs:    -
00450     Returns:    -
00451     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00452                 CRenderWnd::PassMsgToParent().
00453     Errors:     -
00454     Scope:      Protected
00455     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnMouseMove()
00456 
00457 **********************************************************************************************/ 
00458 void CRenderWnd::OnMouseMove( wxMouseEvent &event )
00459 {
00460     if (m_pView)
00461         m_pView->OnMouseMove( event );
00462     
00463 #if defined(__WXGTK__)
00464     wxSetCursorEvent    CursorEvent( event.m_x, event.m_y );
00465     OnSetCursor( CursorEvent );
00466     if( CursorEvent.HasCursor() )
00467     {
00468         // The window cursor seems to be ignored, but is needed for
00469         // CaptureMouse to work
00470         wxSetCursor( CursorEvent.GetCursor() );
00471         SetCursor( CursorEvent.GetCursor() );
00472     }
00473 #endif
00474 }
00475 
00476 /*********************************************************************************************
00477 >   void CRenderWnd::OnKey( wxKeyEvent & event )
00478 
00479     Author:     Alex Bligh (alex@alex.org.uk)
00480     Created:    2 May 2006
00481     Inputs:     reference to the event
00482     Outputs:    -
00483     Returns:    -
00484     Purpose:    This DOES NOT ACTUALLY HANDLE EVENTS, it only notes a key has been 
00485                 pressed and stops the mouse motion mangler eating the next mouse move.
00486     Errors:     -
00487     Scope:      Protected
00488     SeeAlso:    -
00489 
00490 **********************************************************************************************/ 
00491 
00492 void CRenderWnd::OnKey( wxKeyEvent & event )
00493 {
00494     if (m_pView)
00495         m_pView->DontSkipNextMouse();
00496     
00497     event.Skip(); // Pass the key event on to someone who really wants it.
00498 }
00499 
00500 void CRenderWnd::OnChar( wxKeyEvent & event )
00501 {
00502     TRACEUSER( "jlh92", _T("CRenderWnd::OnChar \"%c\" \n"), event.GetUnicodeKey() );
00503 
00504     if( !AfxGetApp().HandleKeyPress( event ) )
00505         event.Skip(); // Pass the key event on to someone who really wants it.
00506 }
00507 
00508 /*********************************************************************************************
00509 >   afx_msg void CRenderWnd::OnRButtonDown(UINT32, CPoint)
00510 
00511     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00512     Created:    ages ago
00513     Inputs:     Not used.
00514     Outputs:    -
00515     Returns:    -
00516     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00517                 CRenderWnd::PassMsgToParent().
00518     Errors:     -
00519     Scope:      Protected
00520     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnRButtonDown()
00521 
00522 **********************************************************************************************/ 
00523 void CRenderWnd::OnRButtonDown( wxMouseEvent &evnt )
00524 {
00525     if (m_pView)
00526         m_pView->OnRButtonDown(evnt);
00527 }
00528 
00529 
00530 
00531 /*********************************************************************************************
00532 >   afx_msg void CRenderWnd::OnRButtonDblClk(UINT32, CPoint)
00533 
00534     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00535     Created:    ages ago
00536     Inputs:     Not used.
00537     Outputs:    -
00538     Returns:    -
00539     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00540                 CRenderWnd::PassMsgToParent().
00541     Errors:     -
00542     Scope:      Protected
00543     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnRButtonDblClk()
00544 
00545 **********************************************************************************************/ 
00546 void CRenderWnd::OnRButtonDblClk( wxMouseEvent &evnt )
00547 {
00548     if (m_pView)
00549         m_pView->OnRButtonDblClk(evnt);
00550 }
00551 
00552 
00553 
00554 /*********************************************************************************************
00555 >   afx_msg void CRenderWnd::OnRButtonUp(UINT32, CPoint)
00556 
00557     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00558     Created:    ages ago
00559     Inputs:     Not used.
00560     Outputs:    -
00561     Returns:    -
00562     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00563                 CRenderWnd::PassMsgToParent().
00564     Errors:     -
00565     Scope:      Protected
00566     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnRButtonUp()
00567 
00568 **********************************************************************************************/ 
00569 void CRenderWnd::OnRButtonUp( wxMouseEvent &evnt )
00570 {
00571     if (m_pView)
00572         m_pView->OnRButtonUp(evnt);
00573 }
00574 
00575 
00576 /*********************************************************************************************
00577 >   afx_msg void CRenderWnd::OnMButtonDown(UINT32, CPoint)
00578 
00579     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00580     Created:    ages ago
00581     Inputs:     Not used.
00582     Outputs:    -
00583     Returns:    -
00584     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00585                 CRenderWnd::PassMsgToParent().
00586     Errors:     -
00587     Scope:      Protected
00588     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnLButtonDown()
00589 
00590 **********************************************************************************************/ 
00591 void CRenderWnd::OnMButtonDown( wxMouseEvent &evnt )
00592 {
00593     if (m_pView)
00594         m_pView->OnMButtonDown(evnt);
00595 }
00596 
00597 
00598 
00599 /*********************************************************************************************
00600 >   afx_msg void CRenderWnd::OnMButtonDblClk(UINT32, CPoint)
00601 
00602     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00603     Created:    ages ago
00604     Inputs:     Not used.
00605     Outputs:    -
00606     Returns:    -
00607     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00608                 CRenderWnd::PassMsgToParent().
00609     Errors:     -
00610     Scope:      Protected
00611     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnLButtonDblClk()
00612 
00613 **********************************************************************************************/ 
00614 void CRenderWnd::OnMButtonDblClk( wxMouseEvent &evnt )
00615 {
00616     if (m_pView)
00617         m_pView->OnMButtonDblClk(evnt);
00618 }
00619 
00620 
00621 
00622 /*********************************************************************************************
00623 >   afx_msg void CRenderWnd::OnMButtonUp(UINT32, CPoint)
00624 
00625     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00626     Created:    ages ago
00627     Inputs:     Not used.
00628     Outputs:    -
00629     Returns:    -
00630     Purpose:    Passes the mouse message on to the parent CCamView via a call to
00631                 CRenderWnd::PassMsgToParent().
00632     Errors:     -
00633     Scope:      Protected
00634     SeeAlso:    CRenderWnd::PassMsgToParent(); CCamView::OnLButtonUp()
00635 
00636 **********************************************************************************************/ 
00637 void CRenderWnd::OnMButtonUp( wxMouseEvent &evnt )
00638 {
00639     if (m_pView)
00640         m_pView->OnMButtonUp(evnt);
00641 }
00642 
00643 
00644 /*********************************************************************************************
00645 >   void CRenderWnd::OnMouseWheel(wxMouseEvent &event)
00646 
00647     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00648     Created:    03/02/2006
00649     Inputs:     Not used.
00650     Outputs:    -
00651     Returns:    -
00652     Purpose:    Passes the mouse message on to the parent CCamView
00653     Errors:     -
00654     Scope:      Protected
00655     SeeAlso:    -
00656 
00657 **********************************************************************************************/ 
00658 
00659 void CRenderWnd::OnMouseWheel( wxMouseEvent &evnt )
00660 {
00661     if (m_pView)
00662         m_pView->OnMouseWheel(evnt);
00663 }
00664 
00665 
00666 /*********************************************************************************************
00667 >   void CRenderWnd::OnSize( wxSizeEvent &evnt )
00668 
00669     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00670     Created:    03/02/2006
00671     Inputs:     Not used.
00672     Outputs:    -
00673     Returns:    -
00674     Purpose:    Does nothing, skipping the event
00675     Errors:     -
00676     Scope:      Protected
00677     SeeAlso:    -
00678 
00679 **********************************************************************************************/ 
00680 
00681 void CRenderWnd::OnSize( wxSizeEvent &evnt )
00682 {
00683     TRACEUSER("Gerry", _T("CRenderWnd::OnSize(%d, %d)\n"), evnt.m_size.x, evnt.m_size.y);
00684     evnt.Skip();
00685 }
00686 
00687 
00688 
00689 /*********************************************************************************************
00690 >   void CRenderWnd::OnErase( wxEraseEvent &evnt )
00691 
00692     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00693     Created:    03/02/2006
00694     Inputs:     Not used.
00695     Outputs:    -
00696     Returns:    -
00697     Purpose:    Does nothing
00698     Errors:     -
00699     Scope:      Protected
00700     SeeAlso:    -
00701 
00702 **********************************************************************************************/ 
00703 void CRenderWnd::OnErase( wxEraseEvent &evnt )
00704 {
00705     // Do nothing
00706 }
00707 
00708 /*********************************************************************************************
00709 >   void CCamView::OnSetCursor(wxSetCursorEvent& event)
00710 
00711     Author:     Luke_Hart (Xara Group Ltd) <camelotdev@xara.com>
00712     Created:    08/02/06
00713     Inputs:     The event.
00714     Outputs:    -
00715     Returns:    -
00716     Purpose:    Eat the cursor update requests to stop anyone else playing with them, this is 
00717                 needed on MSW or the cursor reverts to the normal arrow.
00718     Errors:     -
00719     Scope:      Protected
00720     SeeAlso:    
00721 
00722 **********************************************************************************************/ 
00723 
00724 void CRenderWnd::OnSetCursor( wxSetCursorEvent& event )
00725 {
00726     if( NULL != m_pView )
00727         m_pView->OnSetCursor( event );
00728 }
00729 
00730 #if defined(__WXGTK__)
00731 void CRenderWnd::OnEnter( wxMouseEvent &event )
00732 {
00733     TRACEUSER( "Luke", _T("OnEnter %p\n"), event.GetEventObject() );
00734     
00735 //  if( event.GetEventObject() != m_pFrame )
00736 //      return;
00737     
00738     wxPoint             pt( event.GetPosition() );
00739     wxSetCursorEvent    CursorEvent( pt.x, pt.y );
00740     m_pView->OnSetCursor( CursorEvent );
00741     if( CursorEvent.HasCursor() )
00742     {
00743         wxSetCursor( CursorEvent.GetCursor() );
00744     }
00745 }
00746 
00747 void CRenderWnd::OnLeave( wxMouseEvent &event )
00748 {
00749     TRACEUSER( "Luke", _T("OnLeave %p\n"), event.GetEventObject() );
00750 
00751 //  if( event.GetEventObject() != m_pFrame )
00752 //      return;
00753     
00754     ::wxSetCursor( *wxSTANDARD_CURSOR );
00755 }
00756 #endif
00757 
00758 void CRenderWnd::SetDoubleBuffer(BOOL DoubleBuffer)
00759 {
00760     m_DoubleBuffer = DoubleBuffer;
00761     // Now go through and set or clear double buffering on each window
00762     wxWindow * pWindow = CCamFrame::GetMainFrame();
00763     if (pWindow) ReflectDoubleBufferingInChildren(pWindow);
00764 }
00765 
00766 void CRenderWnd::ReflectDoubleBufferingInChildren(wxWindow * pWindow)
00767 {
00768 #if defined(__WXGTK__)
00769     // Process this one
00770     if (pWindow->IsKindOf(CLASSINFO(CRenderWnd)))
00771 		::SetDoubleBuffer(pWindow, m_DoubleBuffer);
00772 #endif
00773 
00774     // Now process children if any
00775     wxWindowList::Node * pNode = pWindow->GetChildren().GetFirst();
00776     while (pNode)
00777     {
00778         ReflectDoubleBufferingInChildren(pNode->GetData());
00779         pNode = pNode->GetNext();
00780     }
00781     return;
00782 }
00783 
00784 /********************************************************************************************
00785 
00786 >   OpToggleDoubleBuffer::OpToggleDoubleBuffer() : Operation()
00787 
00788     Author:     Alex Bligh <alex@alex.org.uk>
00789     Created:    14 Mar 2006
00790     Inputs:     -
00791     Outputs:    -
00792     Returns:    -
00793     Purpose:    Constructs an OpToggleDoubleBuffer object.
00794     Errors:     -
00795     SeeAlso:    -
00796 
00797 ********************************************************************************************/
00798 
00799 OpToggleDoubleBuffer::OpToggleDoubleBuffer() : Operation()
00800 {
00801 
00802 }
00803 
00804 
00805 
00806 /********************************************************************************************
00807 
00808 >   OpToggleDoubleBuffer::~OpToggleDoubleBuffer()
00809 
00810     Author:     Alex Bligh <alex@alex.org.uk>
00811     Created:    14 Mar 2006
00812     Inputs:     -
00813     Outputs:    -
00814     Returns:    -
00815     Purpose:    Destructs an OpToggleDoubleBuffer object.
00816     Errors:     -
00817     SeeAlso:    -
00818 
00819 ********************************************************************************************/
00820 
00821 OpToggleDoubleBuffer::~OpToggleDoubleBuffer()
00822 {
00823     // Empty
00824 }
00825 
00826 
00827 
00828 /********************************************************************************************
00829 
00830 >   void OpToggleDoubleBuffer::Do(OpDescriptor*)
00831 
00832     Author:     Alex Bligh <alex@alex.org.uk>
00833     Created:    14 Mar 2006
00834     Inputs:     Pointer to Operation Descriptor
00835     Outputs:    -
00836     Returns:    -
00837     Purpose:    Actually "DO" a ToggleFore operation.
00838     Errors:     -
00839     SeeAlso:    -
00840 
00841 ********************************************************************************************/
00842 
00843 void OpToggleDoubleBuffer::Do(OpDescriptor*)
00844 {
00845     CRenderWnd::SetDoubleBuffer(!CRenderWnd::GetDoubleBuffer());
00846     End();
00847 }
00848 
00849 
00850 
00851 /********************************************************************************************
00852 
00853 >   OpState OpToggleDoubleBuffer::GetState(String_256* UIDescription, OpDescriptor*)
00854 
00855     Author:     Alex Bligh <alex@alex.org.uk>
00856     Created:    14 Mar 2006
00857     Inputs:     Pointer to Operation Descriptor
00858                 Text Description
00859     Outputs:    -
00860     Returns:    -
00861     Purpose:    Find the state of the OpToggleDoubleBuffer operation.
00862     Errors:     -
00863     SeeAlso:    -
00864 
00865 ********************************************************************************************/
00866 
00867 OpState OpToggleDoubleBuffer::GetState(String_256* UIDescription, OpDescriptor*)
00868 {
00869     // Default to !ticked and greyed
00870     OpState blobby(FALSE, TRUE);
00871     blobby.Ticked = CRenderWnd::GetDoubleBuffer();
00872     blobby.Greyed = FALSE;
00873     return(blobby);
00874 }
00875 
00876 
00877 
00878 /********************************************************************************************
00879 
00880 >   BOOL OpToggleDoubleBuffer::Init()
00881 
00882     Author:     Alex Bligh <alex@alex.org.uk>
00883     Created:    14 Mar 2006
00884     Inputs:     -
00885     Outputs:    -
00886     Returns:    -
00887     Purpose:    Create an OpDescriptor for the OpToggleDoubleBuffer operation
00888     Errors:     -
00889     SeeAlso:    -
00890 
00891 ********************************************************************************************/
00892 
00893 BOOL OpToggleDoubleBuffer::Init()   
00894 {
00895     return Operation::RegisterOpDescriptor( 
00896                                             0, 
00897                                             _R(IDS_TOGGLE_DOUBLEBUFFER),
00898                                             CC_RUNTIME_CLASS(OpToggleDoubleBuffer), 
00899                                             OPTOKEN_TOGGLEDOUBLEBUFFER,
00900                                             OpToggleDoubleBuffer::GetState,
00901                                             0,                      // help ID
00902                                             0,// _R(IDBBL_FOREBACKGRNDOP),
00903                                             0,                      // bitmap ID
00904                                             0,                      // control ID
00905                                             SYSTEMBAR_ILLEGAL,      // group bar ID
00906                                             TRUE,
00907                                             FALSE,
00908                                             TRUE,
00909                                             NULL,
00910                                             0,
00911                                             0,
00912                                             TRUE
00913                                            );
00914 }
00915 

Generated on Sat Nov 10 03:48:50 2007 for Camelot by  doxygen 1.4.4