attrmgr.cpp File Reference

(r1785/r1445)

#include "camtypes.h"
#include "toollist.h"
#include "attrappl.h"
#include "optsmsgs.h"
#include "qualattr.h"
#include "nodetext.h"
#include "helpuser.h"
#include "filltool.h"
#include "ndoptmz.h"
#include "colormgr.h"
#include "attrmap.h"
#include "isetattr.h"
#include "strkattr.h"
#include "unicdman.h"
#include "fontman.h"
#include "userattr.h"
#include "webattr.h"
#include "nodeshad.h"
#include "attrbev.h"
#include "brshattr.h"
#include "fthrattr.h"
#include "clipattr.h"
#include "lineattr.h"
#include "coldlog.h"
#include "cxftags.h"
#include "ophist.h"

Go to the source code of this file.

Defines

#define COL_ACCURACY   (0.001)
 Used in initialisation of default attributes, and when ensuring no current attributes use deleted colour(s), to find a suitable default colour to use. Two default colours are currently provided, accessed by passing in NameResID of _R(IDS_WHITENAME), _R(IDS_BLACKNAME), in order to get the default white or black colour respectively.
#define TSIZE(C)   (AttributeTableSize * sizeof(C))

Functions

 DECLARE_SOURCE ("$Revision: 1445 $")
 CC_IMPLEMENT_DYNAMIC (CurrentAttrChangedMsg, Msg) const INT32 AttributeTableGranularity
static BOOL UpdateDeletedColour (ColourList *ColList, DocColour *TheColour, IndexedColour **NewDefault)
 static function called by UpdateForDeletedColours. Ensures that the given DocColour is a safe colour to use (does not reference a deleted IndexedColour). If it needs to be fixed, a default colour will be found (or created if necessary) in the given colour list and the colour will be made to reference the new default.

Variables

static BOOL UseLastAttrApplied = FALSE


Define Documentation

#define COL_ACCURACY   (0.001)
 

Used in initialisation of default attributes, and when ensuring no current attributes use deleted colour(s), to find a suitable default colour to use. Two default colours are currently provided, accessed by passing in NameResID of _R(IDS_WHITENAME), _R(IDS_BLACKNAME), in order to get the default white or black colour respectively.

static void AttributeManager::FindDefaultColour(ColourList *ColList, UINT32 NameResID, DocColour *Result)

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/12/94
Parameters:
ColList - The colour list in which the default should reside [INPUTS] NameResID - the ID of the name string for the desired default colour (see below)
(An appropriate colour may have been added to ColList if necessary) [OUTPUTS] Result - Is filled in with an appropriate colour. In the case of total failure, this may be an immediate DocColour, but will always be set to a safe/valid default.
Returns:
-

Errors: ERROR3 if Result==NULL. Otherwise, will always return a valid result - even if it failed to allocate memory for a new IndexedColour, it'll return safely.

Definition at line 235 of file attrmgr.cpp.

#define TSIZE  )     (AttributeTableSize * sizeof(C))
 

Definition at line 1983 of file attrmgr.cpp.


Function Documentation

CC_IMPLEMENT_DYNAMIC CurrentAttrChangedMsg  ,
Msg 
const
 

DECLARE_SOURCE "$Revision: 1445 $"   ) 
 

static BOOL UpdateDeletedColour ColourList ColList,
DocColour TheColour,
IndexedColour **  NewDefault
[static]
 

static function called by UpdateForDeletedColours. Ensures that the given DocColour is a safe colour to use (does not reference a deleted IndexedColour). If it needs to be fixed, a default colour will be found (or created if necessary) in the given colour list and the colour will be made to reference the new default.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/12/94
Parameters:
ColList - The list in which IndexedColours referenced by the DocColours [INPUTS] should reside.
TheColour - The DocColour to be fixed

NewDefault - NULL, or a pointer to the default colour returned from a previous call to this function. This makes fixing several colours in a row a lot more efficient.

Parameters:
(ColList may have a new colour appended) [OUTPUTS] NewDefault will point at the new default black colour, or will be NULL if the return value was FALSE.
Returns:
TRUE if it had to fix this colour (In this case, NewDefault is returned pointing at the default used). FALSE if the colour did not need fixing (in which case NewDefault is untouched).
Notes: The return value should be used to determine if a CurrentAttrChanged Msg needs to be broadcast.

The NewDefault value should be set to NULL before the first call to this function. On subsequent calls, pass in the same value; if a change is made, this allows the system to be more efficient, and guarantees all changed colours reference the correct default colour.

Scope: private static function

Returns:
Errors: -
See also:
AttributeManager::UpdateForDeletedColours

Definition at line 1632 of file attrmgr.cpp.

01634 {
01635     if (TheColour == NULL)          // No colour to fix!
01636         return FALSE;
01637 
01638     IndexedColour *RefColour = TheColour->FindParentIndexedColour();
01639     if( RefColour == NULL ||        // Not referencing an IndexedColour, so nothing to fix
01640         !RefColour->IsDeleted() )   // Not deleted, so doesn't need fixing
01641         return FALSE;
01642 
01643     // Inform the SelRange that attributes have changed (or will do very shortly)
01644     // This will flush the cache of common attributes which could contain an indexed
01645     // colour which has or will be deleted.
01646     SelRange* Sel = GetApplication()->FindSelection();
01647     if (Sel) 
01648         Sel->AttrsHaveChanged(); 
01649     
01650     // We've got a dead colour on our hands! Medic! Medic!
01651     // If the passed-in NewDefault already points at an appropriate attribute,
01652     // then use it, else call FindDefaultColour to find/create one for us
01653     if (*NewDefault != NULL)
01654         TheColour->MakeRefToIndexedColour(*NewDefault);
01655     else
01656     {
01657         AttributeManager::FindDefaultColour(ColList, _R(IDS_BLACKNAME), TheColour);
01658         *NewDefault = TheColour->FindParentIndexedColour();
01659     }
01660 
01661     return TRUE;
01662 }


Variable Documentation

BOOL UseLastAttrApplied = FALSE [static]
 

Definition at line 197 of file attrmgr.cpp.


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