NodeBarProperty Class Reference

Child node of NodeSetSentinel that stores individual property records for a bars. More...

#include <ngsentry.h>

Inheritance diagram for NodeBarProperty:

Node CCObject SimpleCCObject List of all members.

Public Member Functions

 NodeBarProperty ()
 See Node::GetDebugDetails See Node::ShowDebugTreeDetails Default constructor for a NodeBarProperty, which retains bar attributes in an undoable storage.
 NodeBarProperty (Node *pContext, AttachNodeDirection eDir)
 Constructor for a NodeBarProperty, which retains bar attributes in an undoable storage.
size_t HowMany () const
void Clear ()
BarDataTypeBar (INT32 n)
 Read the bars property.
const BarDataTypeBar (INT32 n) const
size_t Add (const BarDataType &bdt)
 Appends the given property to the end of the array of bar properties.
BOOL MakeChange (INT32 n, const BarDataType &bdt)
 Creates a duplicate of this node and then hides this node, writing the given changes into the duplicate.
virtual NodeSimpleCopy ()
 See Node::SimpleCopy.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.

Protected Member Functions

virtual UINT32 GetNodeSize () const
 See Node::GetNodeSize.
void CopyNodeContents (NodeBarProperty *pCopy)
 See Node::SimpleCopy.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *)
 Writes out a bar property record.
virtual BOOL CanWriteChildrenWeb (BaseCamelotFilter *)
 Prevents children of the sentinel being written out in the web format.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *)
 Web files don't write out SetSentinel records. This code assumes the document will only contain one SetSentinel.
virtual BOOL WriteBeginChildRecordsWeb (BaseCamelotFilter *)
 Begins the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the DOWN record does not get written.
virtual BOOL WriteEndChildRecordsWeb (BaseCamelotFilter *)
 Ends the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the UP record does not get written.

Private Member Functions

 CC_DECLARE_DYNAMIC (NodeBarProperty)

Private Attributes

std::vector< BarDataTypem_vecBars
size_t m_nCount
BarDataType m_NoBar

Detailed Description

Child node of NodeSetSentinel that stores individual property records for a bars.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/9/99
See also:
SGNameProp; SGNameItem; Node; NodeSetSentinel; NameGallery

Definition at line 192 of file ngsentry.h.


Constructor & Destructor Documentation

NodeBarProperty::NodeBarProperty  ) 
 

See Node::GetDebugDetails See Node::ShowDebugTreeDetails Default constructor for a NodeBarProperty, which retains bar attributes in an undoable storage.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc

Definition at line 579 of file ngsentry.cpp.

00580   : m_nCount(0)
00581 {
00582     m_vecBars.reserve(MAX_BAR_PROPERTIES);
00583 
00584     m_NoBar.IsLive = TRUE;
00585 }

NodeBarProperty::NodeBarProperty Node pContext,
AttachNodeDirection  eDir
 

Constructor for a NodeBarProperty, which retains bar attributes in an undoable storage.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
See Node::Node [INPUTS]
See also:
Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc

Definition at line 600 of file ngsentry.cpp.

00601   : Node(pContext, eDir),
00602     m_nCount(0)
00603 {
00604     m_vecBars.reserve(MAX_BAR_PROPERTIES);
00605 }


Member Function Documentation

size_t NodeBarProperty::Add const BarDataType bdt  ) 
 

Appends the given property to the end of the array of bar properties.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
bdt --- the BarDataType to add to the end of the array [INPUTS]
Returns:
The index of the entry that was appended, or UINT_MAX for an error.
See also:
Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc

Definition at line 644 of file ngsentry.cpp.

00645 {
00646     // Test for overflow.
00647     if (HowMany() >= MAX_BAR_PROPERTIES)
00648     {
00649         ERROR3("NodeBarProperty::Add: array overflow");
00650         return UINT_MAX;
00651     }
00652 
00653     // Append to the end.
00654     m_vecBars[m_nCount] = bdt;
00655     return m_nCount++;
00656 }

const BarDataType & NodeBarProperty::Bar INT32  n  )  const
 

Definition at line 623 of file ngsentry.cpp.

00624 {
00625     if (n >= 0)
00626         return m_vecBars[n];
00627 
00628     return m_NoBar;
00629 }

BarDataType & NodeBarProperty::Bar INT32  n  ) 
 

Read the bars property.

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/5/00
Parameters:
Entry to retrieve [INPUTS]

Definition at line 615 of file ngsentry.cpp.

00616 {
00617     if (n >= 0)
00618         return m_vecBars[n];
00619 
00620     return m_NoBar;
00621 }

BOOL NodeBarProperty::CanWriteChildrenWeb BaseCamelotFilter  )  [protected, virtual]
 

Prevents children of the sentinel being written out in the web format.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
FALSE.

Reimplemented from Node.

Definition at line 839 of file ngsentry.cpp.

00840 {
00841     return FALSE;
00842 }

NodeBarProperty::CC_DECLARE_DYNAMIC NodeBarProperty   )  [private]
 

void NodeBarProperty::Clear  )  [inline]
 

Definition at line 202 of file ngsentry.h.

00202 { m_nCount = 0; }

void NodeBarProperty::CopyNodeContents NodeBarProperty pCopy  )  [protected]
 

See Node::SimpleCopy.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Definition at line 742 of file ngsentry.cpp.

00743 {
00744     ERROR3IF(pCopy == 0, "NodeBarProperty::CopyNodeContents: null input");
00745     Node::CopyNodeContents(pCopy);
00746 
00747     // copy over the data of the first count bars
00748     for( size_t i = 0; i < m_nCount; i++ )
00749         pCopy->m_vecBars[i] = m_vecBars[i];
00750 
00751     pCopy->m_nCount = m_nCount;
00752 }

UINT32 NodeBarProperty::GetNodeSize  )  const [protected, virtual]
 

See Node::GetNodeSize.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Reimplemented from Node.

Definition at line 704 of file ngsentry.cpp.

00705 {
00706     return sizeof(*this);
00707 }

size_t NodeBarProperty::HowMany  )  const [inline]
 

Definition at line 201 of file ngsentry.h.

00201 { return m_nCount; }

BOOL NodeBarProperty::MakeChange INT32  n,
const BarDataType bdt
 

Creates a duplicate of this node and then hides this node, writing the given changes into the duplicate.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
n --- the index of the bar to change [INPUTS] bdt --- the new data for the given bar
Returns:
TRUE if successful.
See also:
Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc

Definition at line 673 of file ngsentry.cpp.

00674 {
00675     PORTNOTETRACE("dialog","NodeBarProperty::MakeChange - do nothing");
00676 #ifndef EXCLUDE_FROM_XARALX
00677     // Package up the parameters into an OpParam.
00678     OpChangeBarPropParam prm;
00679     prm.m_nIndex = n;
00680     prm.m_pbdtInfo = &bdt;
00681     prm.m_Prop = this;
00682 
00683     // Call the op to duplicate and hide this node.
00684     OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGE_BAR_PROPERTY);
00685     ERROR3IF(pDesc == 0, "NodeBarProperty::MakeChange: can't find descriptor");
00686     pDesc->Invoke(&prm);
00687     return TRUE;
00688 #else
00689     return FALSE;
00690 #endif
00691 }

void NodeBarProperty::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/2003
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Definition at line 768 of file ngsentry.cpp.

00769 {
00770     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00771     ENSURE(IS_A(pNodeCopy, NodeBarProperty), "PolyCopyNodeContents given wrong dest node type");
00772 
00773     if (IS_A(pNodeCopy, NodeBarProperty))
00774         CopyNodeContents((NodeBarProperty*)pNodeCopy);
00775 }

Node * NodeBarProperty::SimpleCopy void   )  [virtual]
 

See Node::SimpleCopy.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery Notes: If you add any data members to class NodeBarProperty, then you should define a (non-virtual) CopyNodeContents function and call that to do the copy.

Reimplemented from Node.

Definition at line 723 of file ngsentry.cpp.

00724 {
00725     NodeBarProperty* pCopy = new NodeBarProperty;
00726     ERRORIF(pCopy == 0, _R(IDE_NOMORE_MEMORY), 0);
00727     CopyNodeContents(pCopy);
00728     return pCopy;
00729 }

BOOL NodeBarProperty::WriteBeginChildRecordsWeb BaseCamelotFilter  )  [protected, virtual]
 

Begins the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the DOWN record does not get written.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
TRUE.

Reimplemented from Node.

Definition at line 877 of file ngsentry.cpp.

00878 {
00879     return TRUE;
00880 }

BOOL NodeBarProperty::WriteEndChildRecordsWeb BaseCamelotFilter  )  [protected, virtual]
 

Ends the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the UP record does not get written.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
TRUE.

Reimplemented from Node.

Definition at line 897 of file ngsentry.cpp.

00898 {
00899     return TRUE;
00900 }

BOOL NodeBarProperty::WritePreChildrenNative BaseCamelotFilter pFilter  )  [protected, virtual]
 

Writes out a bar property record.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
TRUE if the node has written out a record to the filter, FALSE otherwise.

Reimplemented from Node.

Definition at line 789 of file ngsentry.cpp.

00790 {
00791 #ifdef DO_EXPORT
00792     // Write out the SetProperty record header.
00793     CXaraFileRecord rec(TAG_BARPROPERTY, TAG_BARPROPERTY_SIZE);
00794     if (!rec.Init() || !rec.WriteINT32(HowMany()))
00795     {
00796         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00797         return FALSE;
00798     }
00799 
00800     // Write out each property in ascending index order.
00801     for (UINT32 i = 0; i < HowMany(); i++)
00802     {
00803         const BarDataType& bdt = Bar(i);
00804         BYTE nCode = bdt.IsLive |
00805                      (bdt.IsHorizontal << 1) |
00806                      (bdt.RequiresShuffle << 2) |
00807                      (bdt.ButtonsExtend << 3) |
00808                      (bdt.ButtonsScale << 4) |
00809                      (bdt.GroupsStretch << 5);
00810 
00811         if (!rec.WriteINT32(bdt.Spacing) || !rec.WriteBYTE(nCode) || !rec.WriteBYTE(bdt.SameSize))
00812         {
00813             pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00814             return FALSE;           
00815         }
00816     }
00817     
00818     // We've built up a record, now write it out.
00819     UINT32 r = pFilter->Write(&rec);
00820     if (r == 0) pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00821     return (BOOL) r;
00822 #else
00823     return FALSE;
00824 #endif
00825 }

BOOL NodeBarProperty::WritePreChildrenWeb BaseCamelotFilter  )  [protected, virtual]
 

Web files don't write out SetSentinel records. This code assumes the document will only contain one SetSentinel.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
FALSE.

Reimplemented from Node.

Definition at line 857 of file ngsentry.cpp.

00858 {
00859     return FALSE;
00860 }


Member Data Documentation

size_t NodeBarProperty::m_nCount [private]
 

Definition at line 235 of file ngsentry.h.

BarDataType NodeBarProperty::m_NoBar [private]
 

Definition at line 236 of file ngsentry.h.

std::vector<BarDataType> NodeBarProperty::m_vecBars [private]
 

Definition at line 234 of file ngsentry.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:56:34 2007 for Camelot by  doxygen 1.4.4