rendopts.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 #if !defined RENDOPTS_HEADER
00020 #define RENDOPTS_HEADER
00021 
00025 
00026 #include "whiptk/whipcore.h"
00027 #include "whiptk/backgrnd.h"
00028 #include "whiptk/view.h"
00029 #include "whiptk/plot_optimized.h"
00030 #include "whiptk/inked_area.h"
00031 #include "whiptk/penpat_options.h"
00032 
00033 #define WHIP_RENDERING_OPTION_LIST\
00034     WHIP_RENDERING_OPTION(Background,background)\
00035     WHIP_RENDERING_OPTION(Inked_Area,inked_area)\
00036     WHIP_RENDERING_OPTION(PenPat_Options,penpat_options)\
00037     WHIP_RENDERING_OPTION(Plot_Optimized,plot_optimized)\
00038     WHIP_RENDERING_OPTION(View,view)
00039 
00051 
00052 
00053 class WHIPTK_API WT_Rendering_Options
00054 {
00055 protected:
00056     WT_Integer32            m_changed_flags;
00057 
00058 private:
00059 #define WHIP_RENDERING_OPTION(class_type, class_lower) \
00060     WT_##class_type            m_##class_lower;
00061     WHIP_RENDERING_OPTION_LIST
00062 #undef WHIP_RENDERING_OPTION
00063 
00064     WT_Result sync_parts(WT_File & file, WT_Integer32 needed);
00065 
00066 public:
00067 
00069     enum WT_Rendering_Option_Bits
00070     {
00071         // For speed's sake, these should be ordered from most oftenly changed
00072         // to least oftenly changed...
00073         View_Bit            = 0x00000001,
00074         Background_Bit      = 0x00000002,
00075         Plot_Optimized_Bit  = 0x00000004,
00076         Inked_Area_Bit      = 0x00000008,
00077         PenPat_Options_Bit  = 0x00000010
00078     };
00079 
00081 
00082     WT_Rendering_Options()
00083         : m_changed_flags(0)
00084     { }
00085     virtual ~WT_Rendering_Options()
00086     {}
00087 
00089     WT_Rendering_Options (WT_Rendering_Options const & other)
00090         : m_changed_flags     (other.m_changed_flags)
00091         #define WHIP_RENDERING_OPTION(class_name, class_lower) \
00092             , m_##class_lower (other.m_##class_lower)
00093             WHIP_RENDERING_OPTION_LIST
00094         #undef WHIP_RENDERING_OPTION
00095     { }
00097 
00099     WT_Rendering_Options & operator= (WT_Rendering_Options const & other)
00100     {
00101         m_changed_flags     = 0x7FFFFF; //
00102 
00103         #define WHIP_RENDERING_OPTION(class_name, class_lower) \
00104             m_##class_lower = other.m_##class_lower;
00105             WHIP_RENDERING_OPTION_LIST
00106         #undef WHIP_RENDERING_OPTION
00107 
00108         return *this;
00109     }
00110 
00111 
00117     #define WHIP_RENDERING_OPTION(class_type, class_lower) \
00118         WT_##class_type const & class_lower() const  { return m_##class_lower; }
00119         WHIP_RENDERING_OPTION_LIST
00120     #undef WHIP_RENDERING_OPTION
00121 
00122 
00128     #define WHIP_RENDERING_OPTION(class_type, class_lower) \
00129         WT_##class_type & class_lower() { m_changed_flags |= class_type##_Bit; return m_##class_lower; }
00130         WHIP_RENDERING_OPTION_LIST
00131     #undef WHIP_RENDERING_OPTION
00132 
00133 
00135 
00139     virtual WT_Result sync(WT_File & file)
00140     {
00141         if (m_changed_flags)
00142         {
00143             WT_Integer32    needed = m_changed_flags;
00144 
00145             m_changed_flags = 0;
00146             return sync_parts(file, needed);
00147         }
00148 
00149         return WT_Result::Success;
00150     }
00151 };
00152 
00154 
00155 #endif // RENDOPTS_HEADER

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5