rulers.cpp File Reference

(r1785/r1535)

#include "camtypes.h"
#include "rulers.h"
#include "sprdmsg.h"
#include "optsmsgs.h"
#include "userrect.h"
#include "grid.h"
#include "appprefs.h"
#include "layerprp.h"
#include "camelot.h"

Go to the source code of this file.

Defines

#define new   CAM_DEBUG_NEW
#define MAX_LEGEND_CHARS   12
#define LABEL_SPACING_STRING   _T("8888")
#define ACCEPTIBLE_DEVIATION_FROM_INTEGER   1e-10
#define NEAR_ENOUGH_INTEGER(a)   ( fabs(fmod(a,1)) < ACCEPTIBLE_DEVIATION_FROM_INTEGER )
#define MAKE_INTEGER(a)   ( (INT32)( (a) + ACCEPTIBLE_DEVIATION_FROM_INTEGER*3 ) )

Functions

 DECLARE_SOURCE ("$Revision: 1535 $")
BOOL SafeAppendString (StringBase *, const StringBase &, BOOL=TRUE)
 Recache semi-permenent data associated with redrawing the rulers ie values which only change on change of page/grid/zoom/spread etc.


Define Documentation

#define ACCEPTIBLE_DEVIATION_FROM_INTEGER   1e-10
 

Definition at line 135 of file rulers.cpp.

#define LABEL_SPACING_STRING   _T("8888")
 

Definition at line 134 of file rulers.cpp.

#define MAKE_INTEGER  )     ( (INT32)( (a) + ACCEPTIBLE_DEVIATION_FROM_INTEGER*3 ) )
 

Definition at line 137 of file rulers.cpp.

#define MAX_LEGEND_CHARS   12
 

Definition at line 133 of file rulers.cpp.

#define NEAR_ENOUGH_INTEGER  )     ( fabs(fmod(a,1)) < ACCEPTIBLE_DEVIATION_FROM_INTEGER )
 

Definition at line 136 of file rulers.cpp.

#define new   CAM_DEBUG_NEW
 

Definition at line 131 of file rulers.cpp.


Function Documentation

DECLARE_SOURCE "$Revision: 1535 $"   ) 
 

BOOL SafeAppendString StringBase pstrAppendum,
const StringBase strAppendee,
BOOL  fAddSep = TRUE
 

Recache semi-permenent data associated with redrawing the rulers ie values which only change on change of page/grid/zoom/spread etc.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/7/95
Parameters:
pstrAppendum pointer to the string to append to [INPUTS] strAppendee the string to append fAddSep if TRUE (the default) will append a space after strAppendee string.
pstrAppendum the appended string [OUTPUTS]
Returns:
TRUE if it was trivial to append, FALSE if the string to be appended had to be truncated.
See also:
SelRange::LayerDescription

Definition at line 5070 of file range.cpp.

05071 {
05072     INT32 nTotal = pstrAppendum->Length() + strAppendee.Length() + (fAddSep != 0);
05073     INT32 nMax = pstrAppendum->MaxLength();
05074     BOOL fNoTrunc= (nTotal < nMax);
05075     if (fNoTrunc)
05076     {
05077         // We can append without fear of overflow . . .
05078         *pstrAppendum += strAppendee;
05079         if (fAddSep) *pstrAppendum += TEXT(" ");
05080     }
05081     else
05082     {
05083         // We have to truncate the string to append, to avoid overflow . . .
05084         INT32 nTruncCount = strAppendee.Length() - (nTotal - nMax);
05085         if (nTruncCount > 0)
05086         {
05087             // We have some room for more text, so append the truncated string.
05088             String_256 strTrunc;
05089             strAppendee.Left(&strTrunc, nTruncCount);
05090             *pstrAppendum += strTrunc;
05091             if (fAddSep) *pstrAppendum += TEXT(" ");
05092         }
05093     }
05094 
05095     // Return FALSE if we had to truncate.
05096     return fNoTrunc;
05097 }


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