Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

rendition.h

00001 //  Copyright (c) 1996-2002 by Autodesk, Inc.
00002 //
00003 //  By using this code, you are agreeing to the terms and conditions of
00004 //  the License Agreement included in the documentation for this code.
00005 //
00006 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00007 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00008 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00009 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00010 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00011 //
00012 //  Use, duplication, or disclosure by the U.S. Government is subject to
00013 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00014 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00015 //  Data and Computer Software), as applicable.
00016 //
00017 
00018 #if !defined RENDITION_HEADER
00019 #define RENDITION_HEADER
00020 
00021 #include "whiptk/whipcore.h"
00022 #include "whiptk/rendopts.h"
00023 #include "whiptk/dwginfo.h"
00024 #include "whiptk/color.h"
00025 #include "whiptk/colormap.h"
00026 #include "whiptk/backgrnd.h"
00027 #include "whiptk/fill.h"
00028 #include "whiptk/view.h"
00029 #include "whiptk/viewport.h"
00030 #include "whiptk/visible.h"
00031 #include "whiptk/lweight.h"
00032 #include "whiptk/marksize.h"
00033 #include "whiptk/marksymb.h"
00034 #include "whiptk/projection.h"
00035 #include "whiptk/url.h"
00036 #include "whiptk/layer.h"
00037 #include "whiptk/object_node.h"
00038 #include "whiptk/font.h"
00039 #include "whiptk/code_page.h"
00040 #include "whiptk/linepat.h"
00041 #include "whiptk/dashpat.h"
00042 #include "whiptk/linestyle.h"
00043 #include "whiptk/plotinfo.h"
00044 #include "whiptk/merge_control.h"
00045 #include "whiptk/font_extension.h"
00046 #include "whiptk/plot_optimized.h"
00047 #include "whiptk/fillpat.h"
00048 #include "whiptk/blockref.h"
00049 #include "whiptk/penpat.h"
00050 
00051 #define WHIP_ATTRIBUTE_LIST \
00052     WHIP_ATTRIBUTE_MACRO(BlockRef,blockref)\
00053     WHIP_ATTRIBUTE_MACRO(Code_Page,code_page)\
00054     WHIP_ATTRIBUTE_MACRO(Color,color)\
00055     WHIP_ATTRIBUTE_MACRO(Color_Map,color_map)\
00056     WHIP_ATTRIBUTE_MACRO(Dash_Pattern,dash_pattern)\
00057     WHIP_ATTRIBUTE_MACRO(Fill,fill)\
00058     WHIP_ATTRIBUTE_MACRO(Fill_Pattern,fill_pattern)\
00059     WHIP_ATTRIBUTE_MACRO(Font,font)\
00060     WHIP_ATTRIBUTE_MACRO(Font_Extension,font_extension)\
00061     WHIP_ATTRIBUTE_MACRO(Layer,layer)\
00062     WHIP_ATTRIBUTE_MACRO(Line_Pattern,line_pattern)\
00063     WHIP_ATTRIBUTE_MACRO(Line_Style,line_style)\
00064     WHIP_ATTRIBUTE_MACRO(Line_Weight,line_weight)\
00065     WHIP_ATTRIBUTE_MACRO(Marker_Size,marker_size)\
00066     WHIP_ATTRIBUTE_MACRO(Marker_Symbol,marker_symbol)\
00067     WHIP_ATTRIBUTE_MACRO(Merge_Control,merge_control)\
00068     WHIP_ATTRIBUTE_MACRO(Object_Node,object_node)\
00069     WHIP_ATTRIBUTE_MACRO(Pen_Pattern,pen_pattern)\
00070     WHIP_ATTRIBUTE_MACRO(Projection,projection)\
00071     WHIP_ATTRIBUTE_MACRO(URL,url)\
00072     WHIP_ATTRIBUTE_MACRO(Viewport,viewport)\
00073     WHIP_ATTRIBUTE_MACRO(Visibility,visibility)
00074 
00075 
00088 
00089 
00093 class WHIPTK_API WT_Rendition
00094 {
00095     friend class WT_Opcode;
00096 private:
00097 
00098     WT_Integer32            m_changed_flags;
00099     WT_Rendering_Options    m_rendering_options;
00100     WT_Drawing_Info         m_drawing_info;
00101     WT_Plot_Info            m_plot_info;
00102     WT_URL_List             m_url_lookup_list;
00103 
00104     WT_Result sync_parts(WT_File & file, WT_Integer32 needed);
00105 
00106 #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00107     WT_##class_name            m_##class_lower;
00108     WHIP_ATTRIBUTE_LIST
00109 #undef WHIP_ATTRIBUTE_MACRO
00110 
00111 public:
00113     enum WT_Attribute_Bits
00114     {
00115         // For speed's sake, these should be ordered from most oftenly changed
00116         // to least oftenly changed...
00117         Color_Bit              = 0x00000001,
00118         Fill_Bit               = 0x00000002,
00119         Visibility_Bit         = 0x00000004,
00120         URL_Bit                = 0x00000008,
00121         Line_Weight_Bit        = 0x00000010,
00122         Line_Style_Bit         = 0x00000020,
00123         Marker_Size_Bit        = 0x00000040,
00124         Marker_Symbol_Bit      = 0x00000080,
00125         Layer_Bit              = 0x00000100,
00126         Color_Map_Bit          = 0x00000200,
00127         Line_Pattern_Bit       = 0x00000400,
00128         Projection_Bit         = 0x00000800,
00129         Font_Bit               = 0x00001000,
00130         Viewport_Bit           = 0x00002000,
00131         Code_Page_Bit          = 0x00004000,
00132         Dash_Pattern_Bit       = 0x00008000,
00133         Fill_Pattern_Bit       = 0x00010000,
00134         Merge_Control_Bit      = 0x00020000,
00135         BlockRef_Bit           = 0x00040000,
00136         Pen_Pattern_Bit        = 0x00080000,
00137         Font_Extension_Bit     = 0x00100000,
00138         Object_Node_Bit        = 0x00200000
00139     };
00140 
00142     WT_Rendition()
00143         : m_changed_flags(0)
00144         , m_color_map() // Normally we need to specify which version of the default colormap we want, but we don't yet know what version file we'll be reading.
00145     { }
00146 
00148     WT_Rendition (WT_Rendition const & other)
00149         : m_changed_flags     (other.m_changed_flags)
00150         , m_rendering_options (other.m_rendering_options)
00151         , m_drawing_info      (other.m_drawing_info)
00152         , m_plot_info         (other.m_plot_info)
00153         , m_url_lookup_list   (other.m_url_lookup_list)
00154         #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00155             , m_##class_lower (other.m_##class_lower)
00156             WHIP_ATTRIBUTE_LIST
00157         #undef WHIP_ATTRIBUTE_MACRO
00158     { }
00159 
00161     WT_Rendition & operator= (WT_Rendition const & other)
00162     {
00163         m_changed_flags     = other.m_changed_flags;
00164         m_rendering_options = other.m_rendering_options;
00165         m_drawing_info      = other.m_drawing_info;
00166         m_plot_info         = other.m_plot_info;
00167         m_url_lookup_list   = other.m_url_lookup_list;
00168 
00169         #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00170             m_##class_lower = other.m_##class_lower;
00171             WHIP_ATTRIBUTE_LIST
00172         #undef WHIP_ATTRIBUTE_MACRO
00173 
00174         return *this;
00175     }
00176 
00178     ~WT_Rendition()
00179     { }
00180 
00182 
00183     WT_Drawing_Info & drawing_info()
00184     {   return m_drawing_info; }
00185 
00187     WT_Rendering_Options & rendering_options()
00188     {   return m_rendering_options; }
00189 
00191     WT_Plot_Info & plot_info()
00192     {   return m_plot_info; }
00193 
00195     WT_URL_List  & url_lookup_list()
00196     {   return m_url_lookup_list; }
00198 
00204     #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00205         WT_##class_name const & class_lower()    const { return m_##class_lower; }
00206         WHIP_ATTRIBUTE_LIST
00207     #undef WHIP_ATTRIBUTE_MACRO
00208 
00209 
00215     #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00216         WT_##class_name & class_lower() { m_changed_flags |= class_name##_Bit; return m_##class_lower; }
00217         WHIP_ATTRIBUTE_LIST
00218     #undef WHIP_ATTRIBUTE_MACRO
00219 
00220 
00222 
00226     WT_Result sync(WT_File & file, WT_Integer32 required = 0)
00227     {
00228         WT_Integer32   needed = required & m_changed_flags;
00229         WD_CHECK(m_rendering_options.sync(file));
00230         if (needed)
00231         {
00232             m_changed_flags &= ~needed;
00233             return sync_parts(file, needed);
00234         }
00235         return WT_Result::Success;
00236     }
00237 
00238 };
00239 
00241 
00242 #endif // RENDITION_HEADER

Generated on Tue May 17 12:07:44 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1