csrstack.cpp

Go to the documentation of this file.
00001 // $Id: csrstack.cpp 1646 2006-08-02 15:32:50Z luke $
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 // The Cursor Stack (implementation).
00099 
00100 /*
00101 */
00102 
00103 
00104 #include "camtypes.h"
00105 
00106 #include "csrstack.h"
00107 //#include "ensure.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "errors.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 
00110 //#include "cursor.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00111 
00112 DECLARE_SOURCE("$Revision $");
00113 
00114 // Own up in memory dumps
00115 CC_IMPLEMENT_MEMDUMP(CursorStack, CC_CLASS_MEMDUMP)
00116 
00117 #define new CAM_DEBUG_NEW
00118 
00119 
00120 // As Camelot is a single-threaded application, all DocViews share one cursor stack,
00121 // along with the rest of the application.  This is it.
00122 CursorStack* CursorStack::Global;
00123 INT32 CursorIdent::NextUniqueID = 1;
00124 
00125 
00126 /********************************************************************************************
00127 >   static BOOL CursorStack::Init()
00128 
00129     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00130     Created:    12/11/93
00131     Inputs:     -
00132     Outputs:    -
00133     Returns:    TRUE if initialisation was successful.
00134     Purpose:    Initialises the cursor system, loading the standard OS-provided cursors,
00135                 such as the arrow and the hour-glass, creating the application's cursor
00136                 stack etc.
00137     Errors:     -
00138     SeeAlso:    CursorStack::DeInit; Cursor::Init
00139 ********************************************************************************************/
00140 
00141 BOOL CursorStack::Init()
00142 {
00143     Global = new CursorStack;
00144     if (!Global || !Global->IsValid() || !Cursor::Init())
00145     {
00146         delete Global;
00147         Global = 0;
00148         return FALSE;
00149     }
00150     Global->Push(Cursor::Arrow);    // This is about the only occurrence of Push
00151                                     // that can legitimately ignore the return value, since
00152                                     // this cursor should always be on the stack.
00153     Global->SetActive();
00154     return TRUE;
00155 }
00156 
00157 
00158 
00159 
00160 /********************************************************************************************
00161 >   static void CursorStack::DeInit()
00162 
00163     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00164     Created:    12/11/93
00165     Inputs:     -
00166     Outputs:    -
00167     Returns:    -
00168     Purpose:    Shuts down the cursor system, releasing resources allocated by the Init()
00169                 member function.
00170     Errors:     -
00171     SeeAlso:    CursorStack::Init; Cursor::DeInit
00172 ********************************************************************************************/
00173 
00174 void CursorStack::DeInit()
00175 {
00176     if (!Global) return;
00177     Global->Pop();              // undo the push done in Init()
00178     delete Global;
00179     Global = 0;
00180     Cursor::DeInit();
00181 }
00182 
00183 
00184 
00185 
00186 /********************************************************************************************
00187 >   CursorStack::CursorStack()
00188 
00189     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00190     Created:    11/11/93
00191     Inputs:     -
00192     Outputs:    -
00193     Returns:    -
00194     Purpose:    Constructs an empty stack of Cursor objects, with a maximum depth (by default
00195                 this is 10 deep).
00196     Errors:     The allocation of the stack may fail, if so all subsequent calls to Push
00197                 and Pop will be ignored.
00198     SeeAlso:    CursorStack::CursorStack
00199 ********************************************************************************************/
00200 
00201 CursorStack::CursorStack(INT32 maxdepth)
00202 {
00203     nSentinel = maxdepth;
00204     nNextFreeSlot = 0;
00205     BusyCount = 0;
00206     
00207     pcStack = new CursorIdent[maxdepth];        // array of CursorIdent objects
00208 
00209 #ifdef  _DEBUG
00210     if( !pcStack )
00211         TRACEUSER( "JustinF", _T("Failed to allocate stack in CursorStack::CursorStack!\n"));
00212 #endif  // _DEBUG
00213 }
00214 
00215 
00216 
00217 
00218 /********************************************************************************************
00219 >   virtual CursorStack::~CursorStack()
00220 
00221     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00222     Created:    11/11/93
00223     Inputs:     -
00224     Outputs:    -
00225     Returns:    -
00226     Purpose:    Destroys a CursorStack object.
00227     Errors:     -
00228     SeeAlso:    CursorStack::CursorStack
00229 ********************************************************************************************/
00230 
00231 CursorStack::~CursorStack()
00232 {
00233     #ifdef  _DEBUG
00234         if (nNextFreeSlot != 0)
00235             TRACE( _T("WARNING: Cursor Stack at 0x%p not empty (%d deep) upon destruction!\n"),
00236                   this, nNextFreeSlot);
00237     #endif  // _DEBUG
00238 
00239     delete[] pcStack;
00240 }
00241 
00242 
00243 
00244 
00245 /********************************************************************************************
00246 >   BOOL CursorStack::IsValid() const
00247 
00248     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00249     Created:    11/11/93
00250     Inputs:     -
00251     Outputs:    -
00252     Returns:    TRUE if the stack was allocated OK.
00253     Purpose:    Tests if the object was successfully constructed, and is coherent.
00254     Errors:     -
00255     SeeAlso:    -
00256 ********************************************************************************************/
00257 
00258 BOOL CursorStack::IsValid() const
00259 {
00260     return pcStack != 0 && (nNextFreeSlot >= 0 && nNextFreeSlot <= nSentinel);
00261 }
00262 
00263 
00264 
00265 
00266 /********************************************************************************************
00267 >   INT32 CursorStack::Push(Cursor* pCursor, BOOL ActivateNow = TRUE)
00268 
00269     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00270     Created:    11/11/93
00271     Modified:   27/1/95 by Jim
00272     Inputs:     pCursor - A pointer to a Cursor object.
00273                 ActivateNow - if TRUE (the default), the cursor will be immediately activated
00274                 (will become visible immediately). If FALSE, the cursor will not be displayed
00275                 until the mouse pointer is moved over the appropriate window/area. (The latter
00276                 form is used by tools so that there is no cursor-flicker when a tool is
00277                 selected)
00278     Outputs:    -
00279     Returns:    Unique ID which should be used to reference this cursor while it's in the stack
00280     Purpose:    Pushes the parameter onto the stack, making it top-most and hence the Cursor
00281                 which will become active when SetActive() is called (this is done automatically
00282                 by default, or if you pass in ActivateNow == TRUE)
00283                 The Unique ID returned will be required by calls to SetTop and Pop so that
00284                 we don't have any problems with the wrong cursors being popped and deleted
00285     Errors:     Tests for stack overflow.
00286     SeeAlso:    CursorStack::Pop; CursorStack::SetActive
00287 ********************************************************************************************/
00288 
00289 INT32 CursorStack::Push(Cursor* pCursor, BOOL ActivateNow)
00290 {
00291     ENSURE(nNextFreeSlot < nSentinel, "Overflow in CursorStack::Push!\n");
00292 
00293     INT32 retID = pcStack[nNextFreeSlot++].StoreNewCursor(pCursor);
00294     if (ActivateNow)
00295         SetActive();
00296 
00297     return retID;
00298 }
00299 
00300 
00301 
00302 
00303 /********************************************************************************************
00304 >   Cursor* CursorStack::Pop(INT32 cursorID)
00305 
00306     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>/Jim
00307     Created:    11/11/93
00308     Modified:   27/1/95
00309     Inputs:     Unique ID of the cursor you want to pop from the stack
00310     Outputs:    -
00311     Returns:    A pointer to the Cursor object that was previously at the top of the stack.
00312                 Returns NULL if the stack is empty or a cursor of that ID is not found
00313     Purpose:    Removes a cursor from the stack. Because of the strange, asynchronous nature
00314                 of Camelot, and the way cursors are seemingly added and removed from the stack
00315                 at random, when popping a cursor from the stack, a unique ID is used to identify
00316                 which cursor you actually want to remove. That one is removed, whether it's at the
00317                 top of the stack or not.
00318     Errors:     Checks for stack underflow. Also, it now handles stack underflow, as well.
00319                 Will ERROR in debug builds if the ID is not found in the stack.
00320     SeeAlso:    CursorStack::Push; CursorStack::SetActive
00321 ********************************************************************************************/
00322 
00323 Cursor* CursorStack::Pop(INT32 cursorID)
00324 {
00325     ERROR2IF(nNextFreeSlot <= 0,NULL, "Underflow in CursorStack::Pop!\n");
00326     
00327     // For old code which doesn't pass the ID, we'll pop the top one off and hope
00328     if (cursorID == 0)
00329     {   
00330         Cursor* pc = pcStack[--nNextFreeSlot].pCursor;
00331         return pc;
00332     }
00333     else
00334     {
00335         INT32 n=0;      // Counter to go through the stack
00336         
00337         // Yes, I know this while loop could be more cleverly implemented, but I'm
00338         // sticking with easier to understand code, and letting the optimiser do
00339         // the hard work.
00340 
00341         // Find the ID on the stack and remove it, sealing the hole up
00342         while(n<nNextFreeSlot)
00343         {
00344             if (pcStack[n].UniqueID == cursorID)
00345             {
00346                 Cursor* pc = pcStack[n].pCursor;    // for return
00347 
00348                 // Now, what's the best way of closing up the gap?
00349                 INT32 m = n+1;                      // Point at the next item on stack
00350                 while (m<nNextFreeSlot)             // Don't copy anything if n is the last one
00351                 {
00352                     pcStack[n].pCursor = pcStack[m].pCursor;
00353                     pcStack[n].UniqueID = pcStack[m].UniqueID;
00354                     n++;
00355                     m++;
00356                 }
00357 
00358                 // Now the gap has been closed, let's decrement the nextfree counter
00359                 nNextFreeSlot--;
00360                 if (nNextFreeSlot > 0)
00361                     SetActive();
00362 
00363                 // Finally, return the pointer to the cursor we've just removed from the stack
00364                 return pc;
00365 
00366             }
00367             n++;
00368         }
00369 
00370         // If we arrive here, there wasn't a valid cursor on the stack, so complain
00371         ERROR2(NULL,"Unique ID not found in cursor stack\n");
00372     
00373     }
00374 
00375 }
00376 
00377 
00378 
00379 
00380 /********************************************************************************************
00381 >   Cursor* CursorStack::SetTop(Cursor* pCursor, INT32 cursorID = 0)
00382 
00383     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00384     Created:    11/11/93
00385     Modified:   28/1/95 by Jim
00386     Inputs:     pCursor points to a Cursor object.
00387                 cursorID is the unique ID of the cursor that wants to be changed
00388     Outputs:    -
00389     Returns:    A pointer to the Cursor object that was previously occupied by the cursor replaced
00390                 or NULL if there wasn't one.
00391     Purpose:    Replaces a cursor on the stack with a new Cursor object.  Combines a pop and
00392                 a push.  Note that the function detects if the stack is empty and will skip
00393                 the initial pop if it is. The unique ID is used to find which cursor is actually
00394                 to be replaced. If the cursor passed to this function is the same as the one
00395                 already occupying the slot, no switching is done, otherwise the top cursor on the
00396                 stack will be switched on (not necessarily the one passed to this function).
00397     Errors:     -
00398     SeeAlso:    CursorStack::Push; CursorStack::Pop
00399 ********************************************************************************************/
00400 
00401 Cursor* CursorStack::SetTop(Cursor* pCursor, INT32 cursorID)
00402 {
00403     // cursorID will be zero if unmodified code is used.
00404     if (cursorID == 0)
00405     {
00406         ERROR3("CursorStack::SetTop called without a valid cursorID. Please change the offending code.\n");
00407         Cursor* pc;
00408         if (nNextFreeSlot > 0)
00409         {
00410             pc = pcStack[nNextFreeSlot - 1].pCursor;
00411             pcStack[nNextFreeSlot - 1].pCursor = pCursor;
00412         }
00413         else
00414         {
00415             pc = NULL;
00416             Push(pCursor);
00417         }
00418         SetActive();
00419         return pc;
00420     }
00421     else
00422     {
00423         // This is the new case
00424         INT32 n=0;      // Counter to go through the stack
00425         
00426         // Find the ID on the stack and replace it with the new cursor
00427         while(n<nNextFreeSlot)
00428         {
00429             if (pcStack[n].UniqueID == cursorID)
00430             {
00431                 Cursor* pc = pcStack[n].pCursor;    // for return
00432                 if (pc == pCursor)
00433                     return pc;                      // Don't try and set the cursor if it's the same
00434 
00435                 // Replace this cursor with the new one
00436                 pcStack[n].pCursor = pCursor;
00437 
00438                 if (nNextFreeSlot > 0) SetActive();
00439 
00440                 // Finally, return the pointer to the cursor we've just removed from the stack
00441                 return pc;
00442 
00443             }
00444             n++;
00445         }
00446         // Oh dear, we seem not to have found this cursorID on the stack. 
00447         ERROR2(NULL,"cursorID not found on stack in SetTop.\n");
00448     }
00449 }
00450 
00451 
00452 
00453 
00454 /********************************************************************************************
00455 >   void CursorStack::SetActive() const
00456 
00457     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00458     Created:    11/11/93
00459     Inputs:     -
00460     Outputs:    -
00461     Returns:    -
00462     Purpose:    Makes the Cursor object on the top of the stack the active cursor.
00463     Errors:     Checks that the stack isn't empty. Returns if it is
00464     SeeAlso:    Cursor::SetActive
00465 ********************************************************************************************/
00466 
00467 void CursorStack::SetActive( bool fOnlyRendWnd /*= true*/ ) const
00468 {
00469     if (nNextFreeSlot <= 0)
00470     {
00471         ERROR3("Stack empty in CursorStack::SetActive!\n");
00472         return;
00473     }
00474     
00475     // If BusyCount > 0 show the busy cursor instead of the topmost one
00476     if (BusyCount > 0)
00477         Cursor::Busy->SetActive();
00478     else
00479         pcStack[nNextFreeSlot - 1].pCursor->SetActive( fOnlyRendWnd );
00480 }
00481 
00482 Cursor* CursorStack::GetActive()
00483 {
00484     if( Global->nNextFreeSlot <= 0 )
00485     {
00486         ERROR3("Stack empty in CursorStack::SetActive!\n");
00487         return NULL;
00488     }
00489     
00490     // If BusyCount > 0 show the busy cursor instead of the topmost one
00491     if( Global->BusyCount > 0 )
00492     {
00493         return Cursor::Busy;
00494     }
00495     else
00496     {
00497         return Global->pcStack[Global->nNextFreeSlot - 1].pCursor;
00498     }
00499 }
00500 
00501 /********************************************************************************************
00502 >   BOOL CursorStack::IsActive(const Cursor* pCursor) const
00503 
00504     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00505     Created:    12/11/93
00506     Inputs:     A pointer to a (constant) Cursor object.
00507     Outputs:    -
00508     Returns:    TRUE if the top of the stack is the same as the parameter, FALSE if it isn't
00509                 or if the stack is empty.
00510     Purpose:    Tests if a particular cursor is on the top of the stack, ie. is currently
00511                 visible and active.
00512     Errors:     -
00513     SeeAlso:    -
00514 ********************************************************************************************/
00515 
00516 BOOL CursorStack::IsActive(const Cursor* pCursor) const
00517 {
00518 //  return (nNextFreeSlot > 0) ? (pcStack[nNextFreeSlot - 1] == pCursor) : FALSE;
00519 
00520     // if BusyCount>0 that means the busy cursor is active, so check for that situation
00521 
00522     if (BusyCount > 0)
00523     {
00524         return (pCursor == Cursor::Busy);
00525     }
00526     else
00527     {
00528         if (nNextFreeSlot>0 && (pcStack[nNextFreeSlot - 1].pCursor == pCursor))
00529 
00530             return TRUE;
00531 
00532         return FALSE;
00533     }
00534 }
00535 
00536 /********************************************************************************************
00537 
00538 >   void CursorStack::BeginBusy()
00539 
00540     Author:     Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
00541     Created:    28/1/95
00542     Inputs:     -
00543     Outputs:    -
00544     Returns:    -
00545     Purpose:    Tells the cursor stack to show the busy cursor. Multiple calls will increment
00546                 a usage count, and the cursor won't disappear until the usage count drops
00547                 to zero.
00548     Errors:     -
00549     SeeAlso:    CursorStack::EndBusy; CursorStack::SmashBusy
00550 
00551 ********************************************************************************************/
00552 
00553 void CursorStack::BeginBusy()
00554 {
00555     BusyCount++;
00556     SetActive();
00557 }
00558 
00559 /********************************************************************************************
00560 
00561 >   void CursorStack::EndBusy()
00562 
00563     Author:     Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
00564     Created:    28/1/95
00565     Inputs:     -
00566     Outputs:    -
00567     Returns:    -
00568     Purpose:    Turns off the busy cursor (if there has only been one call to BeginBusy) for this
00569                 cursor stack. Waits until BusyCount reaches zero before turning off the busy
00570                 cursor.
00571     Errors:     ERROR3 if busy count drops below zero.
00572     SeeAlso:    CursorStack::BeginBusy; CursorStack::SmashBusy
00573 
00574 ********************************************************************************************/
00575 
00576 void CursorStack::EndBusy()
00577 {
00578     if ((--BusyCount) < 0)
00579     {
00580         BusyCount=0;
00581         ERROR3("Too many calls to CursorStack::EndBusy\n");
00582     }
00583     SetActive();
00584 }
00585 
00586 
00587 
00588 /********************************************************************************************
00589 
00590 >   void CursorStack::SmashBusy()
00591 
00592     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00593     Created:    24/8/95
00594     Inputs:     -
00595     Outputs:    -
00596     Returns:    -
00597     Purpose:    Turns off the busy cursor (without exceptions) for this cursor stack.
00598                 Resets the Busy count to zero.
00599                 Called by Progress.cpp's SmashBusyJob to ensure the cursor is off.
00600 
00601     SeeAlso:    CursorStack::BeginBusy; CursorStack::EndBusy
00602 
00603 ********************************************************************************************/
00604 
00605 void CursorStack::SmashBusy()
00606 {
00607     if (BusyCount == 0)     // Not showing a busy cursor, so return ASAP
00608         return;
00609 
00610     // Turn off the busy cursor
00611     BusyCount = 0;
00612     SetActive();
00613 }
00614 
00615 
00616 /********************************************************************************************
00617 
00618 >   void BeginBusyCursor()
00619 
00620     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00621     Created:    16/11/93
00622     Modified:   28/1/95 by Jim
00623     Inputs:     -
00624     Outputs:    -
00625     Returns:    -
00626     Purpose:    Tells the global cursor stack to display a busy cursor
00627     Errors:     -
00628     SeeAlso:    CursorStack::Push; CursorStack::SetActive; EndBusyCursor; SmashBusyCursor
00629 
00630 ********************************************************************************************/
00631 
00632 void BeginBusyCursor()
00633 {
00634     //CursorStack::Global->Push(Cursor::Busy);
00635     if (CursorStack::Global)
00636         CursorStack::Global->BeginBusy();
00637 }
00638 
00639 
00640 /********************************************************************************************
00641 
00642 >   void EndBusyCursor()
00643 
00644     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00645     Created:    16/11/93
00646     Modified:   28/1/95 by Jim
00647     Inputs:     -
00648     Outputs:    -
00649     Returns:    -
00650     Purpose:    Tells the global cursor stack to stop displaying the busy cursor. If more
00651                 than one call has been previously made to beginBusyCursor, the busy cursor
00652                 isn't removed - a usage count is decremented.
00653     Errors:     ERROR3 failure if the cursor stack isn't displaying a busy cursor at all
00654     SeeAlso:    CursorStack::Pop; CursorStack::SetActive; BeginBusyCursor; SmashBusyCursor
00655 
00656 ********************************************************************************************/
00657 
00658 void EndBusyCursor()
00659 {
00660     if (CursorStack::Global)
00661         CursorStack::Global->EndBusy();
00662 }
00663 
00664 
00665 /********************************************************************************************
00666 
00667 >   void SmashBusyCursor()
00668 
00669     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00670     Created:    24/8/95
00671     Inputs:     -
00672     Outputs:    -
00673     Returns:    -
00674     Purpose:    Tells the global cursor stack to stop displaying the busy cursor, regardless
00675                 of how many calls have been previously made to beginBusyCursor.
00676 
00677     SeeAlso:    BeginBusyCursor; EndBusyCursor
00678 
00679 ********************************************************************************************/
00680 
00681 void SmashBusyCursor()
00682 {
00683     if (CursorStack::Global)
00684         CursorStack::Global->SmashBusy();
00685 }
00686 
00687 
00688 // new static functions to replace member functions. Will be properly commented in time
00689 // (and probably have the G prefix removed too)
00690 
00691 BOOL CursorStack::GIsValid()
00692 {
00693     return Global->IsValid();
00694 }
00695 
00696 INT32 CursorStack::GPush(Cursor* pCursor, BOOL ActivateNow )
00697 {
00698     return Global->Push( pCursor, ActivateNow );
00699 }
00700 
00701 Cursor* CursorStack::GPop(INT32 cursorID)
00702 {
00703     return Global->Pop(cursorID);
00704 }
00705 
00706 Cursor* CursorStack::GSetTop(Cursor* pCursor, INT32 cursorID)
00707 {
00708     return Global->SetTop(pCursor, cursorID);
00709 }
00710 
00711 void CursorStack::GSetActive()
00712 {
00713     Global->SetActive();
00714 }
00715 
00716 BOOL CursorStack::GIsActive(const Cursor* pCursor)
00717 {
00718     return Global->IsActive(pCursor);
00719 }
00720 
00721 /**************** CursorIdent class functions ************************/
00722 
00723 /********************************************************************************************
00724 
00725 >   CursorIdent::CursorIdent()
00726 
00727     Author:     Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
00728     Created:    27/1/95
00729     Inputs:     -
00730     Outputs:    -
00731     Returns:    -
00732     Purpose:    Default constructor for a CursorIdent object. Defaults fields
00733                 to zero so that new objects are invalid.
00734     Errors:     -
00735     SeeAlso:    -
00736 
00737 ********************************************************************************************/
00738 
00739 CursorIdent::CursorIdent()
00740     {
00741         pCursor = 0;
00742         UniqueID = 0;
00743     }
00744 
00745 /********************************************************************************************
00746 
00747 >   CursorIdent::~CursorIdent()
00748 
00749     Author:     Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
00750     Created:    27/1/95
00751     Inputs:     -
00752     Outputs:    -
00753     Returns:    -
00754     Purpose:    Default constructor for CursorIdent objects. Sets all fields back to zero
00755                 so that a destructed object is invalid.
00756     Errors:     -
00757     SeeAlso:    -
00758 
00759 ********************************************************************************************/
00760 
00761 CursorIdent::~CursorIdent()
00762     {
00763         pCursor = 0;
00764         UniqueID = 0;
00765     }
00766 
00767 /********************************************************************************************
00768 
00769 >   INT32 CursorIdent::StoreNewCursor(Cursor* NewCursor)
00770 
00771     Author:     Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
00772     Created:    27/1/95
00773     Inputs:     NewCursor points at the cursor that's being stored in this ident object
00774     Outputs:    -
00775     Returns:    new unique ID (which is also stored in the object)
00776     Purpose:    This function stores a pointer to a cursor in an ident object
00777                 and generates a new unique ID which it returns, as well as storing it in
00778                 the object itself. It also increments the static NextUniqueID counter.
00779     Errors:     -
00780     SeeAlso:    -
00781 
00782 ********************************************************************************************/
00783 
00784 INT32 CursorIdent::StoreNewCursor(Cursor* NewCursor)
00785 {
00786     pCursor = NewCursor;
00787     UniqueID = NextUniqueID++;
00788     return UniqueID;
00789 }

Generated on Sat Nov 10 03:44:55 2007 for Camelot by  doxygen 1.4.4