quality.cpp

Go to the documentation of this file.
00001 // $Id: quality.cpp 1361 2006-06-25 16:43:38Z 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 // Quality class used for controlling rendering quality (known as WYSIWYG in ArtWorks)
00100 
00101 /*
00102 */
00103 
00104 #include "camtypes.h"
00105 #include "qualattr.h"
00106 //#include "ensure.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 //#include "rndrgn.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "ink.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 //#include "tim.h"
00110 //#include "attrmgr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00111 #include "layer.h"
00112 
00113 #include "cxftags.h"
00114 //#include "cxfdefs.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00115 //#include "cxfrec.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00116 //#include "camfiltr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00117 
00118 // For now all GetxxxQuality fns are based on ArtWorks values. Once we are happy
00119 // with them they should be made inline fns.
00120 
00121 CC_IMPLEMENT_DYNCREATE(QualityAttribute, AttributeValue)
00122 CC_IMPLEMENT_DYNCREATE(AttrQuality, NodeAttribute)
00123 
00124 DocColour* AttrQuality::pCurrentColour = NULL;
00125 
00126 // Give this file in memory dumps
00127 // Declare smart memory handling in Debug builds
00128 #define new CAM_DEBUG_NEW
00129 
00130 /********************************************************************************************
00131 
00132     Preference: DefaultQuality
00133     Section:    Rendering
00134     Range:      10 to 110.
00135     Purpose:    The quality level to give to new views.
00136 
00137 ********************************************************************************************/ 
00138 
00139 Quality Quality::DefaultQuality;
00140 
00141 
00142 
00143 /********************************************************************************************
00144 
00145 >   enum Quality::Line Quality::GetLineQuality() const
00146 
00147     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00148     Created:    15/4/94
00149     Inputs:     -
00150     Outputs:    -
00151     Returns:    -
00152     Purpose:    Determines how lines should be rendered based on the quality. Returns
00153                 Quality::NoLine, ThinLine or FullLine.
00154 
00155 ********************************************************************************************/
00156 
00157 enum Quality::Line Quality::GetLineQuality() const
00158 {
00159     if (QualityValue > 50 || QualityValue == QualityGuideLayer)
00160         return ((enum Quality::Line) FullLine);
00161     else if (QualityValue > 30)
00162         return (enum Quality::Line) ThinLine;
00163     else
00164         return (enum Quality::Line) BlackLine;
00165 }
00166 
00167 /********************************************************************************************
00168 
00169 >   enum Quality::Fill Quality::GetFillQuality() const
00170 
00171     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00172     Created:    15/4/94
00173     Inputs:     -
00174     Outputs:    -
00175     Returns:    -
00176     Purpose:    Determines how fills should be rendered based on the quality. Returns
00177                 Quality::NoFill, Solid or Graduated.
00178 
00179 ********************************************************************************************/
00180 
00181 enum Quality::Fill Quality::GetFillQuality() const
00182 {
00183     if (QualityValue >= 60)
00184         return (enum Quality::Fill) Graduated;
00185     else if (QualityValue > 30)
00186         return (enum Quality::Fill) Solid;
00187     else if (QualityValue > 10)
00188         return (enum Quality::Fill) Bitmaps;
00189     else
00190         return (enum Quality::Fill) NoFill;
00191 }
00192 
00193 /********************************************************************************************
00194 
00195 >   enum Quality::Blend Quality::GetBlendQuality() const
00196 
00197     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00198     Created:    15/4/94
00199     Inputs:     -
00200     Outputs:    -
00201     Returns:    -
00202     Purpose:    Determines how Blends should be rendered based on the quality. Returns
00203                 Quality::NoBlend, StartAndEnd or FullBlend.
00204 
00205 ********************************************************************************************/
00206 
00207 enum Quality::Blend Quality::GetBlendQuality() const
00208 {
00209     if (QualityValue <= 20)
00210         return (enum Quality::Blend) StartAndEnd;
00211     else
00212         return (enum Quality::Blend) FullBlend;
00213 }
00214 
00215 /********************************************************************************************
00216 
00217 >   enum Quality::Transparency Quality::GetTransparencyQuality() const
00218 
00219     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00220     Created:    15/4/94
00221     Inputs:     -
00222     Outputs:    -
00223     Returns:    -
00224     Purpose:    Determines how Transparencys should be rendered based on the quality. Returns
00225                 Quality::NoTransparency, or FullTransparency. NOTE: ALWAYS NOTRANS currently.
00226 
00227 ********************************************************************************************/
00228 
00229 enum Quality::Transparency Quality::GetTransparencyQuality() const
00230 {
00231     // don't know how this is going to work yet
00232     return (enum Quality::Transparency) NoTransparency;
00233 }
00234 
00235 /********************************************************************************************
00236 
00237 >   enum Quality::Antialias Quality::GetAntialiasQuality() const
00238 
00239     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00240     Created:    15/4/94
00241     Inputs:     -
00242     Outputs:    -
00243     Returns:    -
00244     Purpose:    Determines how Antialiass should be rendered based on the quality. Returns
00245                 Quality::NoAntialias, or FullAntialias
00246 
00247 ********************************************************************************************/
00248 
00249 enum Quality::Antialias Quality::GetAntialiasQuality() const
00250 {
00251     if (QualityValue <= 100)
00252         return (enum Quality::Antialias) NoAntialias;
00253     else
00254         return (enum Quality::Antialias) FullAntialias;
00255 }
00256 
00257 /********************************************************************************************
00258 
00259 >   void Quality::SetDefault()
00260 
00261     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00262     Created:    22/4/94
00263     Inputs:     -
00264     Outputs:    -
00265     Returns:    -
00266     Purpose:    Resets value to the default value, whatever that might be.
00267     Errors:     ENSUREs if out of range.
00268     Scope:      Public
00269 
00270 ********************************************************************************************/
00271 
00272 void Quality::SetDefault()
00273 {
00274     QualityValue = QUALITY_DEFAULT;
00275 }
00276 
00277 /********************************************************************************************
00278 
00279 >   BOOL Quality::SetQuality(INT32 NewQuality)
00280 
00281     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00282     Created:    15/4/94
00283     Inputs:     NewQuality should be from 0 to MAX_QUALITY.
00284     Returns:    TRUE if changed, FALSE if out of range OR STAYED SAME.
00285     Purpose:    Sets numeric value for quality. You should be using this, except in very
00286                 special situations.
00287     Errors:     ENSUREs if out of range.
00288     SeeAlso:    Quality::GetQuality
00289 
00290 ********************************************************************************************/
00291 
00292 BOOL Quality::SetQuality(INT32 NewQuality)
00293 {
00294     if ( (NewQuality < 0 || NewQuality > QUALITY_MAX) && NewQuality != QUALITY_GUIDELAYER)
00295     {
00296         ENSURE(FALSE, "Bad quality in SetQuality");
00297         return FALSE;
00298     }
00299     else
00300     {
00301         if (QualityValue != NewQuality)
00302         {
00303             QualityValue = NewQuality;
00304             return TRUE;
00305         }
00306         else
00307             return FALSE;                               // not an error, just 'no-change'
00308     }
00309 }
00310 
00311 /********************************************************************************************
00312 
00313 >   INT32 Quality::GetQuality() const
00314 
00315     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00316     Created:    15/4/94
00317     Inputs:     -
00318     Outputs:    -
00319     Returns:    Numeric value for quality.
00320     Purpose:    You should use the GetxxxQuality fns. Only in very special situations are
00321                 you allowed to call this function. It was Protected to stop you from using
00322                 it, but this has had to change for technical reasons.
00323                 So, what does this function actually do. It tells you the numical value of
00324                 the quality.
00325     SeeAlso:    Quality::SetQuality
00326 
00327 ********************************************************************************************/
00328 
00329 INT32 Quality::GetQuality() const
00330 {
00331     return QualityValue;
00332 }
00333 
00334 
00335 /********************************************************************************************
00336 
00337 >   void QualityAttribute::Render(RenderRegion *pRegion)
00338 
00339     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00340     Created:    23/04/94
00341     Inputs:     pRegion - the render region to render this attribute into.
00342     Purpose:    Sets the quality attribute for the given render region.
00343     SeeAlso:    QualityAttribute; RenderStack; AttributeValue; NodeAttribute;
00344                 QualityAttribute::Restore; QualityAttribute::SimpleCopy;
00345                 AttributeValue::Render; AttributeValue::Restore; AttributeValue::SimpleCopy
00346 
00347 ********************************************************************************************/
00348 
00349 void QualityAttribute::Render(RenderRegion *pRegion, BOOL Temp)
00350 {
00351     pRegion->SetQuality(this, Temp);
00352 }
00353 
00354 /********************************************************************************************
00355 
00356 >   void QualityAttribute::Restore(RenderRegion *pRegion, BOOL Temp)
00357 
00358     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00359     Created:    23/04/94
00360     Inputs:     pRegion - the render region to restore the attribute into.
00361                 Temp    - TRUE if this is a temporary attribute, FALSE if it is
00362                           permanent (e.g. it's in a document tree).
00363     Purpose:    Restores the quality attribute for the given render region.
00364     SeeAlso:    QualityAttribute; RenderStack; AttributeValue; NodeAttribute;
00365                 QualityAttribute::Render; QualityAttribute::SimpleCopy;
00366                 AttributeValue::Render; AttributeValue::Restore; AttributeValue::SimpleCopy
00367 
00368 ********************************************************************************************/
00369 
00370 void QualityAttribute::Restore(RenderRegion *pRegion, BOOL Temp)
00371 {
00372     pRegion->RestoreQuality(this, Temp);
00373 }
00374 
00375 /********************************************************************************************
00376 
00377 >   void QualityAttribute::SimpleCopy(AttributeValue *pValue)
00378 
00379     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00380     Created:    23/04/94
00381     Inputs:     pAttr - pointer to the AttributeValue to copy.
00382     Purpose:    See AttributeValue::SimpleCopy
00383     SeeAlso:    QualityAttribute; RenderStack; AttributeValue; NodeAttribute;
00384                 QualityAttribute::Render; QualityAttribute::Restore;
00385                 AttributeValue::Render; AttributeValue::Restore; AttributeValue::SimpleCopy
00386 
00387 ********************************************************************************************/
00388 
00389 void QualityAttribute::SimpleCopy(AttributeValue *pValue)
00390 {
00391     QualityValue = ((QualityAttribute *) pValue)->QualityValue;
00392 }
00393 
00394 /********************************************************************************************
00395 
00396 >   BOOL QualityAttribute::Init()
00397 
00398     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00399     Created:    23/04/94
00400     Returns:    TRUE - initialised ok; FALSE if not.
00401     Purpose:    Registers quality attribute, and provides a default attribute.
00402     Errors:     Out of memory.
00403     SeeAlso:    AttributeManager
00404 
00405 ********************************************************************************************/
00406 
00407 BOOL QualityAttribute::Init()
00408 {
00409     // Defaults to QUALITY_DEFAULT (not surprisingly)
00410     QualityAttribute *pAttr = new QualityAttribute;
00411     if (pAttr == NULL)
00412         return FALSE;
00413 
00414     UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(NodeRenderableInk), 
00415                                                          pAttr);
00416     if (ID == ATTR_BAD_ID)
00417         return FALSE;
00418     ENSURE(ID == ATTR_QUALITY, "Incorrect ID for attribute!");
00419     return TRUE;
00420 }
00421 
00422 /********************************************************************************************
00423 
00424 >   NodeAttribute *QualityAttribute::MakeNode()
00425 
00426     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00427     Created:    23/04/94
00428     Returns:    Pointer to the new node, or NULL if out of memory.
00429     Purpose:    Make a AttrQuality node from this line width attribute.
00430     Errors:     Out of memory
00431     SeeAlso:    AttributeValue::MakeNode
00432 
00433 ********************************************************************************************/
00434 
00435 NodeAttribute *QualityAttribute::MakeNode()
00436 {
00437     // Create new attribute node
00438     AttrQuality *pAttr = new AttrQuality();
00439 
00440     // Copy attribute value into the new node.
00441     pAttr->Value.SimpleCopy(this);
00442 
00443     // Return the new node
00444     return pAttr;
00445 }
00446 
00447 /********************************************************************************************
00448 
00449 >   BOOL QualityAttribute::IsDifferent(AttributeValue *pAttr)
00450 
00451     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00452     Created:    23/04/94
00453     Purpose:    See base class version.
00454     Errors:     The two attributes are not of the same type.
00455     SeeAlso:    AttributeValue::IsDifferent
00456 
00457 ********************************************************************************************/
00458 
00459 BOOL QualityAttribute::IsDifferent(AttributeValue *pAttr)
00460 {
00461     ENSURE(GetRuntimeClass() == pAttr->GetRuntimeClass(), 
00462            "Different attribute types in AttributeValue::IsDifferent()");
00463     return ((QualityAttribute *) pAttr)->QualityValue != QualityValue;
00464 }
00465 
00466 
00467 /********************************************************************************************
00468 
00469 >   AttrQuality::AttrQuality(Node* ContextNode,  
00470                     AttachNodeDirection Direction,  
00471                     BOOL Locked, 
00472                     BOOL Mangled,  
00473                     BOOL Marked, 
00474                     BOOL Selected    
00475             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected, TRUE)  
00476 
00477     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00478     Created:    23/04/94
00479     Inputs:     See base class
00480     Purpose:    Creates a Quality Attribute.
00481     SeeAlso:    NodeAttribute
00482 
00483 ********************************************************************************************/
00484 
00485 AttrQuality::AttrQuality(Node* ContextNode,  
00486                     AttachNodeDirection Direction,  
00487                     BOOL Locked, 
00488                     BOOL Mangled,  
00489                     BOOL Marked, 
00490                     BOOL Selected    
00491             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
00492 {                         
00493 } 
00494 
00495 /********************************************************************************************
00496 
00497 >   AttrQuality::AttrQuality()
00498 
00499     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00500     Created:    23/04/94
00501     Purpose:    Default constructor for Quality Attribute class
00502 
00503 ********************************************************************************************/
00504 
00505 AttrQuality::AttrQuality()
00506 {
00507 }
00508 
00509 /********************************************************************************************
00510 
00511 >   void AttrQuality::Render( RenderRegion* pRender)
00512 
00513     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00514     Created:    23/04/94
00515     Inputs:     pRender - the render region to render the attribute into.
00516     Purpose:    Renders a quality attribute.
00517 
00518 ********************************************************************************************/
00519 
00520 void AttrQuality::Render( RenderRegion* pRender)
00521 {
00522     pRender->SetQuality(&Value, FALSE);
00523 
00524     Layer* pLayer = (Layer*)FindParent(CC_RUNTIME_CLASS(Layer));
00525     if (pLayer != NULL)
00526     {
00527         // Copy layer's colour
00528         Colour = *(pLayer->GetGuideColour());
00529 
00530         // Make static reference point to this colour
00531         pCurrentColour = &Colour;
00532     }
00533 }
00534 
00535 /********************************************************************************************
00536 
00537 >   Node* AttrQuality::SimpleCopy() 
00538 
00539     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00540     Created:    23/04/94
00541     Returns:    A copy of the node, or NULL if memory runs out 
00542     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
00543                 The function is virtual, and must be defined for all derived classes.  
00544     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of 
00545                 memory error and the function returns NULL. 
00546     Scope:      protected
00547 
00548 ********************************************************************************************/
00549      
00550 Node* AttrQuality::SimpleCopy()
00551 {
00552     AttrQuality* NodeCopy = new AttrQuality();
00553     if (NodeCopy == NULL)
00554         return NULL; 
00555     CopyNodeContents(NodeCopy);
00556     return NodeCopy;
00557 } 
00558 
00559 /********************************************************************************************
00560 
00561 >   INT32 AttrQuality::operator==(const NodeAttribute& Attrib)
00562 
00563     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00564     Created:    23/04/94
00565     Inputs:     Atrib:  The attribute to compare, which must be an AttrQuality 
00566     Returns:    Non-zero if objects are equal, zero if not.
00567     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
00568                 a description of why it's required. 
00569     Errors:     An ENSURE failure will occur if Attrib does not have a AttrQuality 
00570                 runtime class.
00571     SeeAlso:    NodeAttribute::operator==
00572 
00573 ********************************************************************************************/
00574 
00575 INT32 AttrQuality::operator==(const NodeAttribute& Attrib)
00576 {
00577     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrQuality)), 
00578         "Trying to compare two objects with different types"); 
00579     AttrQuality* Attr = (AttrQuality*) &Attrib;
00580     return (Attr->Value.QualityValue == Value.QualityValue);
00581 } 
00582 
00583 
00584 /********************************************************************************************
00585 
00586 >   virtual UINT32 AttrQuality::GetAttrNameID(void)  
00587 
00588     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00589     Created:    23/04/94
00590     Returns:    Attribute description ID
00591     Purpose:    Returns back a string resource ID describing the attribute
00592 
00593 ********************************************************************************************/
00594 
00595 UINT32 AttrQuality::GetAttrNameID(void)  
00596 {
00597     return (_R(IDS_QUALITY)); 
00598 }               
00599                  
00600 
00601 /********************************************************************************************
00602 
00603 >   void AttrQuality::CopyNodeContents( AttrQuality* NodeCopy)
00604 
00605     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00606     Created:    23/04/94
00607     Outputs:    NodeCopy - A copy of this node.
00608     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
00609     Errors:     An assertion failure will occur if NodeCopy is NULL
00610     Scope:      protected
00611                                      
00612 ********************************************************************************************/
00613 
00614 void AttrQuality::CopyNodeContents( AttrQuality* NodeCopy)
00615 {
00616     NodeAttribute::CopyNodeContents( NodeCopy );
00617     
00618     // Copy contents specific to derived class here
00619     NodeCopy->Value.QualityValue = Value.QualityValue;
00620 } 
00621 
00622 
00623 
00624 /***********************************************************************************************
00625 >   void AttrQuality::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00626 
00627     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00628     Created:    18/12/2003
00629     Outputs:    -
00630     Purpose:    Polymorphically copies the contents of this node to another
00631     Errors:     An assertion failure will occur if NodeCopy is NULL
00632     Scope:      protected
00633                                      
00634 ***********************************************************************************************/
00635 
00636 void AttrQuality::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00637 {
00638     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00639     ENSURE(IS_A(pNodeCopy, AttrQuality), "PolyCopyNodeContents given wrong dest node type");
00640 
00641     if (IS_A(pNodeCopy, AttrQuality))
00642         CopyNodeContents((AttrQuality*)pNodeCopy);
00643 }
00644 
00645 
00646 
00647 #ifdef _DEBUG
00648 
00649 /********************************************************************************************
00650 
00651 >   void AttrQuality::ShowDebugTreeDetails() const
00652 
00653     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00654     Created:    23/04/94
00655     Purpose:    Displays debugging info of the tree
00656 
00657 ********************************************************************************************/
00658 
00659 void AttrQuality::ShowDebugTreeDetails() const
00660 {
00661     // Display a bit of debugging info
00662     // For now, we will just call the base class version
00663     NodeAttribute::ShowDebugTreeDetails();  
00664 }
00665 #endif
00666 
00667 
00668 void AttrQuality::GetDebugDetails(StringBase* Str)
00669 {
00670 #ifdef _DEBUG
00671     NodeAttribute::GetDebugDetails( Str );
00672 
00673     String_256 TempStr;
00674     TempStr._MakeMsg( TEXT("\r\nQuality=#1%ld\r\n"), Value.QualityValue.GetQuality() );
00675     (*Str) += TempStr;
00676 #endif
00677 }
00678 
00679 
00680 /********************************************************************************************
00681 
00682 >   virtual UINT32 AttrQuality::GetNodeSize() const
00683 
00684     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00685     Created:    23/04/94
00686     Returns:    The size of the node in bytes
00687     Purpose:    For finding the size of the node 
00688     SeeAlso:    Node::GetSubtreeSize
00689 
00690 ********************************************************************************************/
00691 
00692 UINT32 AttrQuality::GetNodeSize() const 
00693 {     
00694     return (sizeof(AttrQuality)); 
00695 }  
00696 
00697 //-------------------------------------------------------------------------
00698 //-------------------------------------------------------------------------
00699 //-------------------------------------------------------------------------
00700 
00701 /********************************************************************************************
00702 
00703   > virtual BOOL AttrQuality::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00704 
00705     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00706     Created:    25/7/96
00707     Inputs:     pFilter = ptr to the filter
00708     Returns:    TRUE if record is written, FALSE if not
00709     Purpose:    Writes the quality record to the filter.
00710                 *** DOESN'T WRITE ANYTHING OUT IN THE WEB FORMAT ***
00711     SeeAlso:    -
00712 
00713 ********************************************************************************************/
00714 
00715 BOOL AttrQuality::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00716 {
00717     return FALSE;
00718 }
00719 
00720 /********************************************************************************************
00721 
00722   > virtual BOOL AttrQuality::WritePreChildrenNative(BaseCamelotFilter* pFilter)
00723 
00724     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00725     Created:    25/7/96
00726     Inputs:     pFilter = ptr to the filter
00727     Returns:    TRUE if record is written, FALSE if not
00728     Purpose:    Writes the quality attribute record to the filter.
00729     SeeAlso:    -
00730 
00731 ********************************************************************************************/
00732 
00733 BOOL AttrQuality::WritePreChildrenNative(BaseCamelotFilter* pFilter)
00734 {
00735 #ifdef DO_EXPORT
00736     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
00737 
00738     BOOL ok = TRUE;
00739 
00740     CXaraFileRecord Rec(TAG_QUALITY,TAG_QUALITY_SIZE);
00741 
00742     if (ok) ok = Rec.Init();
00743     if (ok) ok = Rec.WriteINT32(Value.QualityValue.GetQuality());
00744     if (ok) ok = pFilter->Write(&Rec);
00745 
00746     return ok;
00747 #else
00748     return FALSE;
00749 #endif
00750 }
00751 

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